EDKit.AbstractBasisType
AbstractBasis

Abstract type for all concrete Basis types. The most important function for a Basis type is the index of a given digits and the digits representation of its ith content:

• index : Return the norm and the index of the digits of the given basis.
• change!: Change the digits to the target index, and return the new normalization.

If we want to calculate the schmidt decomposition (in real space), we can use the schmidt function.

EDKit.DoubleBasisType
DoubleBasis{Tb1<:AbstractBasis, Tb2<:AbstractBasis}

Basis for constructing transition matrix from one symmetry sector to another. Note that DoubleBasis can be used as the projector, meaning that it will ignore the symmetry violation. Therefore, extra care is needed when working with this basis.

Properties:

• dgt: Digits.
• B1 : Basis of the target symmetry sector.
• B2 : Basis of the starting symmetry sector.
• B : Base.
EDKit.LindbladType

Lindblad Equation: ∂ₜρ = -i[H, ρ] + ∑ᵢ LᵢρLᵢ⁺ - 1/2 ∑ᵢ {Lᵢ⁺Lᵢ, ρ} The object Lindblad store the information of the supper operator.

EDKit.OperatorType
Operator{Tv}

Object that store the local operator.

Properties:

• M : Vector{SparseMatrixCSC{Tv, Int}}, local operators represented by CSC sparse matrices.
• I : Vector{Vector{Int}}, indices of sites that the operators act on.
• B : Basis.
EDKit.ParityBasisType
ParityBasis

Basis with translational and reflection symmetries.

Properties:

• dgt: Digits.
• I : Representing states.
• R : Normalization.
• P : {±1}, parity.
• B : Base.
EDKit.ProjectedBasisType
ProjectedBasis(;L, N, base=2, alloc=1000, threaded=true)

Construction method for ProjectedBasis with fixed particle number (or total U(1) charge).

Inputs:

• dtype : Data type for indices.
• L : Length of the system.
• N : Quantum number of up spins / particle number / U(1) charge.
• base : Base, default = 2.
• alloc : Size of the prealloc memory for the basis content, used only in multithreading, default = 1000.
• threaded: Whether use the multithreading, default = true.
• small_N : Whether use the small-N algorithm.

Outputs:

• b : ProjectedBasis.
EDKit.ProjectedBasisType
ProjectedBasis{Ti}

Basis for subspace that is spanned only by product states. It is basically like the TensorBasis, but contains only a subset of all basis vectors, selected by a given function.

Properties:

• dgt: Digits.
• I : List of indicies.
• B : Base.
EDKit.SchmidtMatrixType

SchmidtMatrix{Tm <: Number, Ta <: SubArray, Tb <: SubArray, Ti <: Integer}

Struct that is used to construct the Schmidt matrix:

|Ψ⟩ = ∑ᵢⱼ Mᵢᵢ|ψᵢ⟩ ⊗ |ψⱼ⟩

Properties:

• M : Schidt matrix.
• A : View of region A.
• B : View of region B.
• base: Base.
EDKit.SchmidtMatrixMethod
SchmidtMatrix(T::DataType, b::AbstractBasis, Ainds::AbstractVector{Ta}) where Ta <: Integer

Construction of SchmidtMatrix.

EDKit.TensorBasisType
TensorBasis

Basis without any symmetries. The index is computed by:

I(i₁, i₂, ⋯, iₙ) = i₁ B^(n-1) + i₂ B^(n-2) + ⋯ + iₙ

In many bases this basis need not be constructed explicitly.

EDKit.TranslationFlipBasisType

TranslationFlipBasis(f, k, p, L; base=2, alloc=1000, threaded=true)

Construction for TranslationFlipBasis.

Inputs:

• f : Selection function for the basis contents.
• k : Momentum number from 0 to L-1.
• p : Parity number (under spin flip) ±1.
• L : Length of the system.
• base : Base, default = 2.
• alloc : Size of the prealloc memory for the basis content, used only in multithreading, default = 1000.
• threaded: Whether use the multithreading, default = true.

Outputs:

• b: TranslationFlipBasis.
EDKit.TranslationJudgeType

TranslationJudge

Structure used for selecting the basis contents.

Properties:

• F: Projective selection
• K: Momentum
• A: Length of unit cell
• B: Base
• C: Normalization coefficient
EDKit.TranslationParityBasisType
TranslationParityBasis(f, k, p, L; base=2, alloc=1000, threaded=true)

Construction for TranslationParityBasis.

Inputs:

• f : Selection function for the basis contents.
• k : Momentum number from 0 to L-1.
• p : Parity number ±1.
• L : Length of the system.
• N : Particle numper.
• a : Length of unit cell.
• base : Base, default = 2.
• alloc : Size of the prealloc memory for the basis content, used only in multithreading, default = 1000.
• threaded: Whether use the multithreading, default = true.

Outputs:

• b: TranslationParityBasis.
EDKit.TranslationParityBasisType
TranslationParityBasis

Basis with translational and reflection symmetries.

Properties:

• dgt: Digits.
• I : Representing states.
• R : Normalization.
• C : {±1}, momentum phase.
• P : {±1}, parity.
• A : Length of unit cell.
• B : Base.
EDKit.TranslationalBasisType
TranslationalBasis(f, k, L; base=2, alloc=1000, threaded=true)

Construction for TranslationalBasis.

Inputs:

• dtype : Data type of index.
• L : Length of the system.
• f : Selection function for the basis contents.
• k : Momentum number from 0 to L-1.
• N : Particle number.
• a : Length of unit cell.
• base : Base, default = 2.
• alloc : Size of the prealloc memory for the basis content, used only in multithreading, default = 1000.
• threaded: Whether use the multithreading, default = true.

Outputs:

• b: TranslationalBasis.
EDKit.TranslationalBasisType
TranslationalBasis

Basis for subspace that is spanned by momentum states, which can also incorporate projected restriction. For each basis vector represented by dgt, the vector is |aₙ⟩ = ∑ᵢ Tⁱ |dgt⟩. The normalized basis is |n⟩ = Rₙ⁻¹ |aₙ⟩, where Rₙ is the normalization.

Properties:

• dgt: Digits.
• I : List of indicies.
• R : List of normalization.
• C : Unit phase factor.
• B : Base.
Base.eltypeMethod

eltype(b::AbstractBasis)

Element data type of the basis.

• Return Int64 for onsite basis.
• Return ComplexF64 by default otherwise.

Used for type promotion when constructing matrix representation of an Operator.

Base.sizeMethod

size(b::AbstractBasis, [dim])

Dimension of the Operator object construct by the basis.

EDKit.binary_searchMethod

binary_search(list::AbstractVector{<:Integer}, i<:Integer)

Return the position of i in a sorted list using binary search algorithm.

EDKit.change!Method

change!(b::AbstractBasis, i::Integer)

Change the digits to the target index, and return the new normalization.

EDKit.change!Method
change!(dgt::AbstractVector{<:Integer}, sites::AbstractVector{<:Integer}, ind::Integer; base::Integer=2)

Change the sub-digits to that with the target index. This method is the inverse of index.

EDKit.change!Method
change!(dgt::AbstractVector{<:Integer}, ind::Integer; base::Integer=2)

Change the digits to that with the target index. This method is the inverse of index.

EDKit.colmn!Function
colmn!(target::AbstractVecOrMat, M::SparseMatrixCSC, I::Vector{Int}, b::AbstractBasis, coeff=1)

Central helper function for operator multiplication.

For a local matrix M acting on indices I, colmn! return the j-th colume (given by b.dgt) in the many-body basis. The result is writen inplace on the vector target.

EDKit.covmatMethod

covmat(ol::AbstractVector, v::AbstractVecOrMat{<:Number})

Return the covariant matrix for a given list of operators: Cᵢⱼ = 1/2⟨v|{hᵢ,hⱼ}|v⟩ - ⟨v|hᵢ|v⟩⟨v|hⱼ|v⟩, or for a set of vector, Cᵢⱼ = 1/2Tr[ρ{hᵢ,hⱼ}] - Tr[ρhᵢ]Tr[ρhⱼ], where ρ = 1/N∑ₙ|vₙ⟩⟨vₙ|.

Inputs:

• ol: List of operators, represented by matrices or Operators.
• V : Target state represented by a vector, or target states represented by a matrix.

Outputs:

• cm: (Symmetric real) matrix.
EDKit.dividerangeMethod

dividerange(maxnum::Integer, nthreads::Integer)

Divide the interation range equally according to the number of threads.

Inputs:

• maxnum : Maximum number of range.
• nthreads: Number of threads.

Outputs:

• list: List of ranges.
EDKit.ent_SMethod

ent_S(v::AbstractVector, Aind::AbstractVector{<:Integer}, b::AbstractBasis; α::Real=1, cutoff::Real=1e-20)

Conpute the entanglement entropy of a state.

EDKit.ent_SMethod
ent_S(ψ::MPS, b::Integer)

Return entanglement entropy between site b and b+1.

Inputs:

• ψ: MPS
• b: Link index
EDKit.ent_SMethod
ent_specs(ψ::MPS)

Return entanglement entropies.

Inputs:

• ψ: MPS

Outputs:

• S: Vector of entropy
EDKit.ent_specMethod

ent_spec(v::AbstractVector, Aind::AbstractVector{<:Integer}, b::AbstractBasis)

Conpute the entanglement spectrum.

EDKit.ent_specsMethod
ent_specs(ψ::MPS, b::Integer)

Return entanglement spectrum between site b and b+1.

Inputs:

• ψ: MPS
• b: Link index
EDKit.entropyMethod

entropy(s::AbstractVector{<:Real}; α::Real=1, cutoff::Real=1e-20)

Compute the entropy of Schmidt values.

Inputs:

• s : Schmidt values.
• α : Renyi index.
• cutoff: Cutoff of the Schmidt values.

Outputs:

• S: Entanglement entropy.
EDKit.expmMethod
expm(A, order::Integer=10)

Matrix exponential using Taylor expansion.

EDKit.expvMethod
expv(A, v::AbstractVecOrMat; order=10, λ=1)

Compute exp(λA)*v using Taylor expansion

EDKit.indexMethod
index(b::TranslationalBasis)

Index of the state in TranslationalBasis, together with the normalization.

Outputs:

• N: Normalization for the state b.dgt.
• i: Index for the state b.dgt.

Notes:

To calculate the index of a given digits, we first shift the digits to that of the minimum index, then search for the place in the basis. Because of the restriction from the momentum, some state with zero normalization (which is not included in the basis) will appear. To avoid exception in the matrix constructon of Operation, we allow the index to not in the basis content. When this happend, we return index 1, and normalization 0, so it has no effect on the matrix being filled.

EDKit.indexMethod
index(dgt::AbstractVector{T}; base::Integer=2, dtype::DataType=T) where T <: Integer

Convert a digits to the integer index using the relation:

number = ∑ᵢ bits[i] * base^(L-i) + 1

The summaton is evaluate using the efficieint polynomial evaluation method.

Inputs:

• dgt : Digits.
• base : Base.
EDKit.indexMethod
index(dgt::AbstractVector{T}, sites::AbstractVector{<:Integer}; base::Integer=2) where T <: Integer

Convert a sub-digits (subarray of dgt) to the integer index.

EDKit.int_typeMethod

int_type(b::AbstractBasis)

Return index data type. This is for basis with large indices exceeding the upper bound of Int64.

EDKit.majoranaformMethod
majoranaform(A::AbstractMatrix, B::AbstractMatrix)

Return the Majorana quadratic form Ĥ = -i/4 ∑ Hᵢⱼ ωᵢωⱼ from the fermion quadratic form Ĥ = 1/2 ∑(Aᵢⱼ cᵢ⁺cⱼ + Bᵢⱼcᵢ⁺cⱼ⁺ + h.c.).

EDKit.mps2vecMethod
mps2vec(psi::MPS, B::AbstractBasis)

Convert MPS to a vector, with a given basis B.

EDKit.operatorMethod
operator(mats::AbstractVector{<:AbstractMatrix}, inds::AbstractVector{<:AbstractVector}, B::AbstractBasis)

Constructor for Operator.

Inputs:

• mats: List of matrices for local operators.
• inds: List of sites on which local operators act.
• B : Basis.

Outputs:

• O : Operator.
EDKit.productstateMethod

productstate(s, states)

Return a product MPS

Inputs:

• s : Vector of indices
• states: Vector of vector representing local states
EDKit.productstateMethod
productstate(v::AbstractVector{<:Integer}, B::AbstractBasis)

Construction for product state.

Inputs:

• v: Vector representing the product state.
• B: Basis.

Outputs:

• s: Vector representing the many-body state.
EDKit.schmidtMethod

schmidt(v::AbstractVector, Ainds::AbstractVector{<:Integer}, b::AbstractOnsiteBasis)

Schmidt decomposition of state v, with respect to given lattice bipartition.

Inputs:

• v : State represented by a (abstract) vector.
• Ainds: List of indices in subsystem A, the remaining indices are regarded as subsystem B.
• b : Basis.

Outputs:

• S: Matrix S in the decomposition: |v⟩ = Sᵢⱼ |Aᵢ⟩|Bⱼ⟩.
EDKit.selectindexMethod

selectindex(f, L, rg; base=2, alloc=1000)

Select the legal indices for a basis.

Inputs:

• f : Function for digits that tells whether a digits is valid.
• L : Length of the system.
• rg : Range of interation.
• base : (Optional) Base, base=2 by default.
• alloc: (Optional) Pre-allocation memory for the list of indices, alloc=1000 by default.

Outputs:

• I: List of indices in a basis.
EDKit.selectindex_threadedMethod
selectindex_threaded(f, L, rg; base=2, alloc=1000)

Select the legal indices with multi-threads.

Inputs:

• f : Function for digits that tells whether a digits is valid as well as its normalization.
• L : Length of the system.
• base : (Optional) Base, base=2 by default.
• alloc: (Optional) Pre-allocation memory for the list of indices, alloc=1000 by default.

Outputs:

• I: List of indices in a basis.
EDKit.selectindexnormMethod
selectindexnorm(f, L, rg; base=2, alloc=1000)

Select the legal indices and corresponding norm for a basis.

Inputs:

• f : Function for digits that tells whether a digits is valid as well as its normalization.
• L : Length of the system.
• rg : Range of interation.
• base : (Optional) Base, base=2 by default.
• alloc: (Optional) Pre-allocation memory for the list of indices, alloc=1000 by default.

Outputs:

• I: List of indices in a basis.
• R: List of normalization for each states.
EDKit.selectindexnorm_threadedMethod
selectindexnorm_threaded(f, L, rg; base=2, alloc=1000)

Select the legal indices and corresponding norm for a basis with multi-threads.

Inputs:

• f : Function for digits that tells whether a digits is valid as well as its normalization.
• L : Length of the system.
• base : (Optional) Base, base=2 by default.
• alloc: (Optional) Pre-allocation memory for the list of indices, alloc=1000 by default.

Outputs:

• I: List of indices in a basis.
• R: List of normalization for each states.
EDKit.spinMethod
spin(s::String; D::Integer=2)

Return matrix for spin operators.

EDKit.spinMethod
spin(spins::Tuple{<:Number, String}...; D::Integer=2)

Return matrix for spin operators. The spins should be an iterable onject, each item is of the form (::Number, ::String).

EDKit.spinflipMethod
spinflip(v::AbstractVector{<:Integer}, base::Integer)

Flip spins Sz on each site.

EDKit.vec2tensor!Method
vec2tensor!(dest, v)

Convert vector v to tensor, with row-major convention.

Inputs:

• dest: Tensor to write
• v : Vector
EDKit.vec2tensorMethod
vec2tensor(v; base=2)

Convert vector v to tensor, with row-major convention.