EDKit.AbstractBasis
— TypeAbstractBasis
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.DensityMatrix
— TypeDensity Matrix under Many-body Basis
EDKit.DoubleBasis
— TypeDoubleBasis{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.FlipBasis
— TypeFlipBasis
Basis with translational and reflection symmetries.
EDKit.Lindblad
— TypeLindblad Equation: ∂ₜρ = -i[H, ρ] + ∑ᵢ LᵢρLᵢ⁺ - 1/2 ∑ᵢ {Lᵢ⁺Lᵢ, ρ} The object Lindblad
store the information of the supper operator.
EDKit.Operator
— TypeOperator{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.ParityBasis
— TypeParityBasis
Basis with translational and reflection symmetries.
Properties:
- dgt: Digits.
- I : Representing states.
- R : Normalization.
- P : {±1}, parity.
- B : Base.
EDKit.ParityFlipBasis
— TypeFlipBasis
Basis with translational and reflection symmetries.
EDKit.ProjectedBasis
— TypeProjectedBasis(;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.ProjectedBasis
— TypeProjectedBasis{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.SchmidtMatrix
— TypeSchmidtMatrix{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.SchmidtMatrix
— MethodSchmidtMatrix(T::DataType, b::AbstractBasis, Ainds::AbstractVector{Ta}) where Ta <: Integer
Construction of SchmidtMatrix
.
EDKit.TensorBasis
— TypeTensorBasis
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.TranslationFlipBasis
— TypeTranslationFlipBasis(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.TranslationFlipBasis
— TypeTranslationFlipBasis
Basis with translational and spin-flip symmetries.
EDKit.TranslationJudge
— TypeTranslationJudge
Structure used for selecting the basis contents.
Properties:
- F: Projective selection
- K: Momentum
- A: Length of unit cell
- B: Base
- C: Normalization coefficient
EDKit.TranslationJudge
— Method(::TranslationJudge)(dgt, i)
Select basis and return normalization.
EDKit.TranslationParityBasis
— TypeTranslationParityBasis(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.TranslationParityBasis
— TypeTranslationParityBasis
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.TranslationalBasis
— TypeTranslationalBasis(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.TranslationalBasis
— TypeTranslationalBasis
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.copy
— MethodDeep copy digits.
Base.copy
— Methodcopy(b::TensorBasis)
Copy basis with a deep copied dgt
.
Base.eltype
— Methodeltype(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.length
— Methodlength(b::AbstractBasis)
Length of the digits.
Base.size
— Methodsize(b::AbstractBasis, [dim])
Dimension of the Operator
object construct by the basis.
EDKit.binary_search
— Methodbinary_search(list::AbstractVector{<:Integer}, i<:Integer)
Return the position of i in a sorted list using binary search algorithm.
EDKit.change!
— Methodchange!(b::AbstractBasis, i::Integer)
Change the digits to the target index, and return the new normalization.
EDKit.change!
— Methodchange!(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!
— Methodchange!(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!
— Functioncolmn!(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.commutation
— Methodcommutation(L,ρ)
Compute commutation -i[H, ρ]
EDKit.commutation_mat
— Methodcommutation_mat(L)
Matrix representation for -i[H,⋅].
EDKit.content
— Methodcontent(b::AbstractBasis, i::Integer)
Return index of ith vector in this basis.
EDKit.covmat
— Methodcovmat(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 orOperator
s.V
: Target state represented by a vector, or target states represented by a matrix.
Outputs:
- cm: (Symmetric real) matrix.
EDKit.density_norm
— MethodReturn the operator norm (N = |⟨I|ρ⟩|).
The renormed (ρ/N = I + ⋯) is the correct density matrix.
EDKit.dissipation
— Methoddissipation(L,ρ)
Compute dissipation D[L]ρ = L⋅ρ⋅L⁺ - 1/2{L⁺L,ρ}
EDKit.dissipation_mat
— Methoddissipation_mat(L)
Matrix representation for D[L].
EDKit.dividerange
— Methoddividerange(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_S
— Methodent_S(v::AbstractVector, Aind::AbstractVector{<:Integer}, b::AbstractBasis; α::Real=1, cutoff::Real=1e-20)
Conpute the entanglement entropy of a state.
EDKit.ent_S
— Methodent_S(ψ::MPS, b::Integer)
Return entanglement entropy between site b
and b+1
.
Inputs:
- ψ: MPS
- b: Link index
EDKit.ent_S
— Methodent_specs(ψ::MPS)
Return entanglement entropies.
Inputs:
- ψ: MPS
Outputs:
- S: Vector of entropy
EDKit.ent_spec
— Methodent_spec(v::AbstractVector, Aind::AbstractVector{<:Integer}, b::AbstractBasis)
Conpute the entanglement spectrum.
EDKit.ent_specs
— Methodent_specs(ψ::MPS, b::Integer)
Return entanglement spectrum between site b
and b+1
.
Inputs:
- ψ: MPS
- b: Link index
EDKit.entropy
— Methodentropy(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.expm
— Methodexpm(A, order::Integer=10)
Matrix exponential using Taylor expansion.
EDKit.expv
— Methodexpv(A, v::AbstractVecOrMat; order=10, λ=1)
Compute exp(λA)*v using Taylor expansion
EDKit.index
— MethodReturn normalization and index.
EDKit.index
— Methodindex(b::TranslationParityBasis)
Return normalization and index.
EDKit.index
— Methodindex(b::TranslationalBasis)
Index of the state in TranslationalBasis
, together with the normalization.
Outputs:
N
: Normalization for the stateb.dgt
.i
: Index for the stateb.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.index
— Methodindex(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.index
— Methodindex(dgt::AbstractVector{T}, sites::AbstractVector{<:Integer}; base::Integer=2) where T <: Integer
Convert a sub-digits (subarray of dgt
) to the integer index.
EDKit.inner_product
— MethodInner product ⟨v₁|v₂⟩. For two set of vector.
EDKit.int_type
— Methodint_type(b::AbstractBasis)
Return index data type. This is for basis with large indices exceeding the upper bound of Int64
.
EDKit.lindblad
— MethodConstruction for Lindblad
.
EDKit.majoranaform
— Methodmajoranaform(A::AbstractMatrix, B::AbstractMatrix)
Return the Majorana quadratic form Ĥ = -i/4 ∑ Hᵢⱼ ωᵢωⱼ from the fermion quadratic form Ĥ = 1/2 ∑(Aᵢⱼ cᵢ⁺cⱼ + Bᵢⱼcᵢ⁺cⱼ⁺ + h.c.).
EDKit.mat2op
— MethodConvert a matrix to an ITensor operator
EDKit.mpo2pmps
— Methodmpo2pmps(O, S)
Convert MPO to Pauli MPS.
EDKit.mps2vec
— Methodmps2vec(psi::MPS, B::AbstractBasis)
Convert MPS to a vector, with a given basis B
.
EDKit.mps2vec
— Methodmps2vec(psi::MPS)
Convert MPS to a vector
EDKit.mul
— MethodMulti-threaded operator multiplication.
EDKit.op2mat
— MethodConvert a ITensor operator to a matrix
EDKit.operator
— Methodoperator(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.parity_schmidt
— MethodHelper function for schmidt
on parity basis.
EDKit.pauli
— Functionpauli(i, L=1)
Return ith (size-L) Pauli matrices.
EDKit.pauli
— Methodpauli(Is::AbstractVector{<:Real})
Return a matrix from Pauli coefficients
EDKit.pauli_list
— Functionpauli_list(A)
Return pauli components of a 2×2 matrix A
.
EDKit.pauli_mtr
— MethodCompute tr(A * B), where A is a Pauli matrix.
EDKit.pauli_op_mat
— Functionpauli_op_mat(f)
Matrix representation for f(ρ).
EDKit.pbcmps
— Methodpbcmps(sites, tensors)
Construct an MPS from a list of tensor.
EDKit.pmps2mpo
— Methodpmps2mpo(ψ, s)
Convert Pauli MPS to MPO.
EDKit.productstate
— Methodproductstate(s, states)
Return a product MPS
Inputs:
- s : Vector of indices
- states: Vector of vector representing local states
EDKit.productstate
— Methodproductstate(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.renyi_entropy
— MethodCompute general Renyi entropy
EDKit.renyi_zero_entropy
— MethodCompute Renyi-0 entropy, which is thenumber of non-zero Schmidt values.
EDKit.schmidt
— Methodschmidt(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 subsystemA
, the remaining indices are regarded as subsystemB
.b
: Basis.
Outputs:
S
: Matrix S in the decomposition: |v⟩ = Sᵢⱼ |Aᵢ⟩|Bⱼ⟩.
EDKit.schmidt
— MethodSchmidt decomposition for TranslationalBasis
.
EDKit.selectindex
— Methodselectindex(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_threaded
— Methodselectindex_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.selectindexnorm
— Methodselectindexnorm(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_threaded
— Methodselectindexnorm_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.shannon_entropy
— MethodCompute Shannon entropy
EDKit.simplify
— MethodSimplify the solutions.
EDKit.spin
— Methodspin(s::String; D::Integer=2)
Return matrix for spin operators.
EDKit.spin
— Methodspin(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.spinflip
— Methodspinflip(v::AbstractVector{<:Integer}, base::Integer)
Flip spins Sz on each site.
EDKit.tebd_n!
— Methodtebd_n!(ψ, G1, G2; cutoff=1e-14, maxdim=30)
n-site TEBD.
EDKit.vec2tensor!
— Methodvec2tensor!(dest, v)
Convert vector v
to tensor, with row-major convention.
Inputs:
- dest: Tensor to write
- v : Vector
EDKit.vec2tensor
— Methodvec2tensor(v; base=2)
Convert vector v
to tensor, with row-major convention.
LinearAlgebra.norm
— Methodnorm(b::AbstractBasis, i::Integer)
Return norm of ith vector in this basis.
LinearAlgebra.normalize!
— MethodNormalize the density operator so that tr[ρ]=1.