Exact Diagonalization solver
Core ED types and functions
KeldyshED.EDCore
— TypeLightweight Exact Diagonalization solver for finite systems of fermions.
Fields
full_hs::KeldyshED.Hilbert.FullHilbertSpace
: Full Hilbert space of the system.subspaces::Vector{KeldyshED.Hilbert.HilbertSubspace}
: List of the invariant subspaces of the Hamiltonian.eigensystems::Vector{KeldyshED.EigenSystem}
: Eigensystems of the Hamiltonian within the invariant subspaces.creation_connection::Vector{Dict{Int64, Int64}}
: Subspace-to-subspace connections generated by the creation operators $c^\dagger_i$. If a creation operator, whose compound index $i$ translates into a linear indexl
byfull_hs.soi
, acts between subspaces $s$ and $s'$, thencreation_connection[l][s] = s'
.
annihilation_connection::Vector{Dict{Int64, Int64}}
: Subspace-to-subspace connections generated by the annihilation operators $c_i$. If an annihilation operator, whose compound index $i$ translates into a linear indexl
byfull_hs.soi
, acts between subspaces $s$ and $s'$, thenannihilation_connection[l][s] = s'
.
cdag_matrices::Array{Dict{Int64, Matrix{ScalarType}}, 1} where ScalarType<:Number
: Matrices of the creation operators $c^\dagger_i$ in the eigenbasis of the Hamiltonian. If a creation operator, whose compound index $i$ translates into a linear indexl
byfull_hs.soi
, acts between subspaces $s$ and $s'$, then the corresponding block of its matrix form is available ascdag_matrices[l][s]
.
c_matrices::Array{Dict{Int64, Matrix{ScalarType}}, 1} where ScalarType<:Number
: Matrices of the annihilation operators $c_i$ in the eigenbasis of the Hamiltonian. If an annihilation operator, whose compound index $i$ translates into a linear indexl
byfull_hs.soi
, acts between subspaces $s$ and $s'$, then the corresponding block of its matrix form is available asc_matrices[l][s]
.
gs_energy::Float64
: Ground state energy of the system.
KeldyshED.EigenSystem
— TypePartial eigensystem within one invariant subspace of the Hamiltonian.
Fields
eigenvalues::Vector{Float64}
: Eigenvalues $E_n$ of the Hamiltonian $\hat H$, in ascending order. The energy reference point is shifted so that the global energy minimum is zero.
unitary_matrix::Matrix{ScalarType} where ScalarType<:Number
: Unitary transformation matrix $\hat U$ from the Fock basis to the eigenbasis, $\hat H = \hat U \mathrm{diag}(E_n) \hat U^\dagger$.
KeldyshED.EDCore
— MethodEDCore(
hamiltonian::KeldyshED.Operators.OperatorExpr{S<:Number},
soi::KeldyshED.Hilbert.SetOfIndices;
symmetry_breakers
) -> EDCore
Reduce a given Hamiltonian to a block-diagonal form and diagonalize it.
This constructor uses the autopartition procedure
, and the QR algorithm to diagonalize the blocks. The invariant subspaces of the Hamiltonian are chosen such that all creation and annihilation operators carrying compound indices from the provided set soi
map one subspace to one subspace.
It is possible to pass an optional list of operator expressions (symmetry_breakers
) that are required to share invariant subspaces with the Hamiltonian. As those operators can break some symmetries of the Hamiltonian, taking them into account can result in a less refined subspace partition and block structure.
Base.show
— Methodshow(io::IO, ed::EDCore)
Print various information about solution of an Exact Diagonalization problem.
KeldyshED.c_connection
— Functionc_connection(
ed::EDCore,
op_linear_index::Int64,
sp_index::Int64
) -> Union{Nothing, Int64}
Extract a subspace-to-subspace connection generated by an annihilation operator from an Exact Diagonalization solver. Returns nothing
if no such connection exists.
Arguments
ed
: The Exact Diagonalization solver object.op_linear_index
: Linear index of the annihilation operator as defined byed.full_hs.soi
.sp_index
: Initial subspace index.
c_connection(
ed::EDCore,
indices::Vector{Union{Int64, String}},
sp_index::Int64
) -> Union{Nothing, Int64}
Extract a subspace-to-subspace connection generated by an annihilation operator from an Exact Diagonalization solver. Returns nothing
if no such connection exists.
Arguments
ed
: The Exact Diagonalization solver object.indices
: Compound index of the annihilation operator (must be part ofed.full_hs.soi
).sp_index
: Initial subspace index.
c_connection(
ed::EDCore,
op_linear_index::Int64
) -> BitMatrix
Extract a matrix of subspace-to-subspace connections generated by an annihilation operator from an Exact Diagonalization solver. This method returns a square boolean matrix of size length(ed.subspaces)
with true
elements corresponding to the existing connections between the subspaces.
Arguments
ed
: The Exact Diagonalization solver object.op_linear_index
: Linear index of the annihilation operator as defined byed.full_hs.soi
.
c_connection(
ed::EDCore,
indices::Vector{Union{Int64, String}}
) -> BitMatrix
Extract a matrix of subspace-to-subspace connections generated by an annihilation operator from an Exact Diagonalization solver. This method returns a square boolean matrix of size length(ed.subspaces)
with true
elements corresponding to the existing connections between the subspaces.
Arguments
ed
: The Exact Diagonalization solver object.indices
: Compound index of the annihilation operator (must be part ofed.full_hs.soi
).
KeldyshED.cdag_connection
— Functioncdag_connection(
ed::EDCore,
op_linear_index::Int64,
sp_index::Int64
) -> Union{Nothing, Int64}
Extract a subspace-to-subspace connection generated by a creation operator from an Exact Diagonalization solver. Returns nothing
if no such connection exists.
Arguments
ed
: The Exact Diagonalization solver object.op_linear_index
: Linear index of the creation operator as defined byed.full_hs.soi
.sp_index
: Initial subspace index.
cdag_connection(
ed::EDCore,
indices::Vector{Union{Int64, String}},
sp_index::Int64
) -> Union{Nothing, Int64}
Extract a subspace-to-subspace connection generated by a creation operator from an Exact Diagonalization solver. Returns nothing
if no such connection exists.
Arguments
ed
: The Exact Diagonalization solver object.indices
: Compound index of the creation operator (must be part ofed.full_hs.soi
).sp_index
: Initial subspace index.
cdag_connection(
ed::EDCore,
op_linear_index::Int64
) -> BitMatrix
Extract a matrix of subspace-to-subspace connections generated by a creation operator from an Exact Diagonalization solver. This method returns a square boolean matrix of size length(ed.subspaces)
with true
elements corresponding to the existing connections between the subspaces.
Arguments
ed
: The Exact Diagonalization solver object.op_linear_index
: Linear index of the creation operator as defined byed.full_hs.soi
.
cdag_connection(
ed::EDCore,
indices::Vector{Union{Int64, String}}
) -> BitMatrix
Extract a matrix of subspace-to-subspace connections generated by a creation operator from an Exact Diagonalization solver. This method returns a square boolean matrix of size length(ed.subspaces)
with true
elements corresponding to the existing connections between the subspaces.
Arguments
ed
: The Exact Diagonalization solver object.indices
: Compound index of the creation operator (must be part ofed.full_hs.soi
).
KeldyshED.monomial_connection
— Functionmonomial_connection(
ed::EDCore,
mon::KeldyshED.Operators.Monomial,
sp_index::Int64
) -> Union{Nothing, Int64}
Extract a subspace-to-subspace connection generated by a monomial operator (a product of canonical operators $c$/$c^\dagger$) from an Exact Diagonalization solver. Returns nothing
if no such connection exists.
Arguments
ed
: The Exact Diagonalization solver object.mon
: Monomial in question.sp_index
: Initial subspace index.
monomial_connection(
ed::EDCore,
mon::KeldyshED.Operators.Monomial
) -> BitMatrix
Extract a matrix of subspace-to-subspace connections generated by a monomial operator (a product of canonical operators $c$/$c^\dagger$) from an Exact Diagonalization solver. This method returns a square boolean matrix of size length(ed.subspaces)
with true
elements corresponding to the existing connections between the subspaces.
Arguments
ed
: The Exact Diagonalization solver object.mon
: Monomial in question.
KeldyshED.c_matrix
— Functionc_matrix(
ed::EDCore,
op_linear_index::Int64,
sp_index::Int64
) -> Matrix{ScalarType} where ScalarType<:Number
Extract a non-vanishing matrix block of an annihilation operator from an Exact Diagonalization solver. The block is written in the eigenbasis of the Hamiltonian.
Arguments
ed
: The Exact Diagonalization solver object.op_linear_index
: Linear index of the annihilation operator as defined byed.full_hs.soi
.sp_index
: Initial subspace index.
The final subspace index is uniquely determined by the pair (op_linear_index
, sp_index
) as there is at most one non-vanishing matrix per such a pair.
c_matrix(
ed::EDCore,
indices::Vector{Union{Int64, String}},
sp_index::Int64
) -> Matrix{ScalarType} where ScalarType<:Number
Extract a non-vanishing matrix block of an annihilation operator from an Exact Diagonalization solver. The block is written in the eigenbasis of the Hamiltonian.
Arguments
ed
: The Exact Diagonalization solver object.indices
: Compound index of the annihilation operator (must be part ofed.full_hs.soi
).sp_index
: Initial subspace index.
The final subspace index is uniquely determined by the pair (indices
, sp_index
) as there is at most one non-vanishing matrix per such a pair.
KeldyshED.cdag_matrix
— Functioncdag_matrix(
ed::EDCore,
op_linear_index::Int64,
sp_index::Int64
) -> Matrix{ScalarType} where ScalarType<:Number
Extract a non-vanishing matrix block of a creation operator from an Exact Diagonalization solver. The block is written in the eigenbasis of the Hamiltonian.
Arguments
ed
: The Exact Diagonalization solver object.op_linear_index
: Linear index of the creation operator as defined byed.full_hs.soi
.sp_index
: Initial subspace index.
The final subspace index is uniquely determined by the pair (op_linear_index
, sp_index
) as there is at most one non-vanishing matrix per such a pair.
cdag_matrix(
ed::EDCore,
indices::Vector{Union{Int64, String}},
sp_index::Int64
) -> Matrix{ScalarType} where ScalarType<:Number
Extract a non-vanishing matrix block of a creation operator from an Exact Diagonalization solver. The block is written in the eigenbasis of the Hamiltonian.
Arguments
ed
: The Exact Diagonalization solver object.indices
: Compound index of the creation operator (must be part ofed.full_hs.soi
).sp_index
: Initial subspace index.
The final subspace index is uniquely determined by the pair (indices
, sp_index
) as there is at most one non-vanishing matrix per such a pair.
KeldyshED.monomial_matrix
— Functionmonomial_matrix(
ed::EDCore{ScalarType<:Number},
mon::KeldyshED.Operators.Monomial,
sp_index::Int64
) -> Any
Extract a non-vanishing matrix block a monomial operator (a product of canonical operators $c$/$c^\dagger$) from an Exact Diagonalization solver. The block is written in the eigenbasis of the Hamiltonian.
Arguments
ed
: The Exact Diagonalization solver object.mon
: Monomial in question.sp_index
: Initial subspace index.
The final subspace index is uniquely determined by the pair (mon
, sp_index
) as there is at most one non-vanishing matrix per such a pair.
KeldyshED.operator_blocks
— Functionoperator_blocks(
ed::EDCore{EDScalarType<:Number},
op::KeldyshED.Operators.OperatorExpr{OPScalarType<:Number},
sp_index::Int64
) -> Dict{Int64, Matrix{_A}} where _A
Compute blocks of the matrix representation of an operator acting on states in a given (initial) subspace. The computed blocks are returned as a dictionary final subspace index => matrix
, and the matrices are written in the eigenbasis of the Hamiltonian.
Arguments
ed
: The Exact Diagonalization solver object.op
: Operator expression.sp_index
: Initial subspace index.
operator_blocks(
ed::EDCore{EDScalarType<:Number},
op::KeldyshED.Operators.OperatorExpr{OPScalarType<:Number}
) -> Dict{Tuple{Int64, Int64}, Matrix{_A}} where _A
Compute blocks of the matrix representation of an operator.
The computed blocks are returned as a dictionary (initial subspace index, final subspace index) => matrix
, and the matrices are written in the eigenbasis of the Hamiltonian.
Arguments
ed
: The Exact Diagonalization solver object.op
: Operator expression.
Utility functions
KeldyshED.fock_states
— Functionfock_states(ed::EDCore) -> Vector{Vector{UInt64}}
Collect lists of basis Fock states spanning invariant subspaces stored in a given Exact Diagonalization object ed
.
KeldyshED.energies
— Functionenergies(ed::EDCore) -> Vector{Vector{Float64}}
Collect lists of energy levels from all invariant subspaces stored in a given Exact Diagonalization object ed
.
KeldyshED.unitary_matrices
— Functionunitary_matrices(ed::EDCore) -> Vector
Collect unitary transformation matrices $\hat U$ from all invariant subspaces stored in a given Exact Diagonalization object ed
.
KeldyshED.tofockbasis
— Methodtofockbasis(
M::Array{Array{T<:Number, 2}, 1},
ed::EDCore
) -> Vector
Transform a block-diagonal matrix written in the eigenbasis into the Fock state basis.
Arguments
M
: List of matrices' diagonal blocks.ed
: An Exact Diagonalization object defining the invariant subspace structure and partial eigenbases within the subspaces.
KeldyshED.toeigenbasis
— Methodtoeigenbasis(
M::Array{Array{T<:Number, 2}, 1},
ed::EDCore
) -> Vector
Transform a block-diagonal matrix written in the Fock state basis into the eigenbasis.
Arguments
M
: List of matrices' diagonal blocks.ed
: An Exact Diagonalization object defining the invariant subspace structure and partial eigenbases within the subspaces.
KeldyshED.full_hs_matrix
— Functionfull_hs_matrix(
M::Array{Array{T<:Number, 2}, 1},
ed::EDCore
) -> Matrix{ScalarType} where ScalarType<:Number
Flatten a block-diagonal matrix and return a matrix acting in the full Hilbert space.
Arguments
M
: List of matrices' diagonal blocks.ed
: An Exact Diagonalization object defining the invariant subspace structure.