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.FlipBasisType
FlipBasis

Basis with translational and reflection symmetries.

EDKit.GaussianStateType

Particle-number-preserving fermionic Gaussian state

A Gaussian state s is represented by a matrix B, |ψ⟩ = ∏ bₖ⁺|0⟩ = ∑ cᵢ⁺ Bᵢₖ. A GaussianState object can be access as a matrix. The element s[i,j] is the two-point function ⟨cᵢ⁺cⱼ⟩.

The boolean value N keeps track of the orthogonality of the representation.

EDKit.GaussianStateMethod
GaussianState(pos::AbstractVector{<:Integer}, L::Integer)

Initialize GaussianState with given particle positions and system length.

EDKit.GaussianStateMethod
GaussianState(dtype::DataType, pos::AbstractVector{<:Integer}, L::Integer)

Initialize GaussianState with given data type, particle positions and system length.

EDKit.GaussianStateMethod
GaussianState(dtype::DataType, vec::AbstractVector{Bool})

Initialize GaussianState with vector indicating particle positions.

EDKit.GaussianStateMethod
GaussianState(;L::Integer, N::Integer, config::String="Z2")

More initial configuration.

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.:*Method

Multiply general matrix to GaussianState, and by default normalize the output.

Base.:*Method

Multiply Unitary matrix to GaussianState.

Base.copyMethod

copy(b::TensorBasis)

Copy basis with a deep copied dgt.

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.lengthMethod

length(b::AbstractBasis)

Length of the digits.

Base.sizeMethod

size(b::AbstractBasis, [dim])

Dimension of the Operator object construct by the basis.

EDKit.apply!Method
apply!(U::Unitary, s::GaussianState, ind::AbstractVector{<:Integer})

Apply local unitary gate to GaussianState s on sites inds.

EDKit.avoid_vectorMethod

Compute null vectors: |A'ᵢ⟩ = |Aᵢ⟩ - ⟨v|Aᵢ⟩|v⟩

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.contentMethod

content(b::AbstractBasis, i::Integer)

Return index of ith vector in this basis.

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.delete_vectorMethod

Given a vector space spanned by column of A, and a vector v, find the nullspace of v inside A. The inpute vA is the pre-computed inner product ⟨v|Aᵢ⟩.

The algorithm first choose the pivot vector |Aₚ⟩ with largest overlap ‖⟨v|Aₚ⟩‖ with vector v, then calculate the vectors |Ãᵢ⟩ := |Aᵢ⟩ - (⟨v|Aᵢ⟩/⟨v|Aₚ⟩) * |Aₚ⟩, i ≠ p. The set of vectors {|Ãᵢ⟩} span the null space of v, though not orthogonal.

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_specMethod

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

Conpute the entanglement spectrum.

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.entropyMethod
entropy(s::GaussianState, i::AbstractVector{<:Integer}, j::AbstractVector{<:Integer})

Mutual information for GaussianState.

EDKit.entropyMethod
entropy(s::GaussianState, i::AbstractVector{<:Integer})

Entaglement entropy of gaussian state with system A chosen to be the sites {i}.

EDKit.evo_operatorMethod
evo_operator(H::AbstractMatrix, dt::Real; order::Integer=10)

Exponential for general matrix using series expansion.

EDKit.evo_operatorMethod
evo_operator(H::Hermitian, dt::Real)

Exponential for Hermitian matrix.

EDKit.expmFunction
expm(A::AbstractMatrix, order::Integer=10)

Matrix exponential using Taylor expansion.

EDKit.expmMethod
expm(A, order::Integer=10)

Matrix exponential using Taylor expansion.

EDKit.expvFunction
expv(A::AbstractMatrix, v::AbstractVecOrMat, order::Integer=10)

Compute exp(A)*v using Taylor expansion

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

Compute exp(λA)*v using Taylor expansion

EDKit.indexMethod

index(b::TranslationParityBasis)

Return normalization and index.

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 Ĥ = -i/4 ∑ Hᵢⱼ ωᵢωⱼ from the fermion quadratic form Ĥ = 1/2 ∑(Aᵢⱼ cᵢ⁺cⱼ + Bᵢⱼcᵢ⁺cⱼ⁺ + h.c.).

EDKit.mulMethod

Multi-threaded operator multiplication.

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(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.schmidtMethod

Schmidt decomposition for TranslationalBasis.

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.

LinearAlgebra.normMethod

norm(b::AbstractBasis, i::Integer)

Return norm of ith vector in this basis.