Exact Diagonalization solver

Core ED types and functions

KeldyshED.EDCoreType

Lightweight 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 index l by full_hs.soi, acts between subspaces $s$ and $s'$, then creation_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 index l by full_hs.soi, acts between subspaces $s$ and $s'$, then annihilation_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 index l by full_hs.soi, acts between subspaces $s$ and $s'$, then the corresponding block of its matrix form is available as cdag_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 index l by full_hs.soi, acts between subspaces $s$ and $s'$, then the corresponding block of its matrix form is available as c_matrices[l][s].
  • gs_energy::Float64: Ground state energy of the system.
source
KeldyshED.EigenSystemType

Partial 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$.
source
KeldyshED.EDCoreMethod
EDCore(
    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.

source
Base.showMethod
show(io::IO, ed::EDCore)

Print various information about solution of an Exact Diagonalization problem.

source
KeldyshED.c_connectionFunction
c_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 by ed.full_hs.soi.
  • sp_index: Initial subspace index.
source
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 of ed.full_hs.soi).
  • sp_index: Initial subspace index.
source
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 by ed.full_hs.soi.
source
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 of ed.full_hs.soi).
source
KeldyshED.cdag_connectionFunction
cdag_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 by ed.full_hs.soi.
  • sp_index: Initial subspace index.
source
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 of ed.full_hs.soi).
  • sp_index: Initial subspace index.
source
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 by ed.full_hs.soi.
source
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 of ed.full_hs.soi).
source
KeldyshED.monomial_connectionFunction
monomial_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.
source
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.
source
KeldyshED.c_matrixFunction
c_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 by ed.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.

source
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 of ed.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.

source
KeldyshED.cdag_matrixFunction
cdag_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 by ed.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.

source
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 of ed.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.

source
KeldyshED.monomial_matrixFunction
monomial_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.

source
KeldyshED.operator_blocksFunction
operator_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.
source
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.
source

Utility functions

KeldyshED.fock_statesFunction
fock_states(ed::EDCore) -> Vector{Vector{UInt64}}

Collect lists of basis Fock states spanning invariant subspaces stored in a given Exact Diagonalization object ed.

source
KeldyshED.energiesFunction
energies(ed::EDCore) -> Vector{Vector{Float64}}

Collect lists of energy levels from all invariant subspaces stored in a given Exact Diagonalization object ed.

source
KeldyshED.unitary_matricesFunction
unitary_matrices(ed::EDCore) -> Vector

Collect unitary transformation matrices $\hat U$ from all invariant subspaces stored in a given Exact Diagonalization object ed.

source
KeldyshED.tofockbasisMethod
tofockbasis(
    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.
source
KeldyshED.toeigenbasisMethod
toeigenbasis(
    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.
source
KeldyshED.full_hs_matrixFunction
full_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.
source