# Canonical Fermionic and Hard-core Bosonic Systems

ExactDiagonalization.CanonicalFockSystems.BinaryBasesMethod
BinaryBases(states, nparticle::Integer)
BinaryBases(nstate::Integer, nparticle::Integer)
BinaryBases{A}(states, nparticle::Integer; kwargs...) where {A<:AbelianNumber}
BinaryBases{A}(nstate::Integer, nparticle::Integer; kwargs...) where {A<:AbelianNumber}

Construct a set of binary bases that preserves the particle number conservation.

ExactDiagonalization.CanonicalFockSystems.BinaryBasesMethod
BinaryBases(states)
BinaryBases(nstate::Integer)
BinaryBases{A}(states) where {A<:AbelianNumber}
BinaryBases{A}(nstate::Integer) where {A<:AbelianNumber}

Construct a set of binary bases that subject to no quantum number conservation.

ExactDiagonalization.EDCore.SectorMethod
Sector(hilbert::Hilbert{<:Fock}; basistype=UInt, kwargs...) -> BinaryBases
Sector(hilbert::Hilbert{<:Fock}, quantumnumber::ParticleNumber; table=Table(hilbert, Metric(EDKind(hilbert), hilbert)), basistype=UInt) -> BinaryBases
Sector(hilbert::Hilbert{<:Fock}, quantumnumber::SpinfulParticle; table=Table(hilbert, Metric(EDKind(hilbert), hilbert)), basistype=UInt) -> BinaryBases

Construct the binary bases of a Hilbert space with the specified quantum number.

Base.countMethod
count(basis::BinaryBasis) -> Int
count(basis::BinaryBasis, start::Integer, stop::Integer) -> Int

Count the number of occupied single-particle states.

Base.isoneMethod
isone(basis::BinaryBasis, state::Integer) -> Bool

Judge whether the specified single-particle state is occupied for a basis.

Base.iszeroMethod
iszero(basis::BinaryBasis, state::Integer) -> Bool

Judge whether the specified single-particle state is unoccupied for a basis.

Base.iterateFunction
iterate(basis::BinaryBasis, state=nothing)

Iterate over the numbers of the occupied single-particle orbitals.

Base.oneMethod
one(basis::BinaryBasis, state::Integer) -> BinaryBasis

Get a new basis with the specified single-particle state occupied.

Base.zeroMethod
zero(basis::BinaryBasis, state::Integer) -> BinaryBasis

Get a new basis with the specified single-particle state unoccupied.

ExactDiagonalization.CanonicalFockSystems.sumableMethod
sumable(bs₁::BinaryBases, bs₂::BinaryBases) -> Bool

Judge whether two sets of binary bases could be direct summed.

Strictly speaking, two sets of binary bases could be direct summed if and only if they have no intersection. The time complexity to check the intersection is O(n log n), which costs a lot when the dimension of the binary bases is huge. It is also possible to judge whether they could be direct summed by close investigations on their ids, i.e. the single-particle states and occupation number. It turns out that this is a multi-variable pure integer linear programming problem. In the future, this function would be implemented based on this observation. At present, the direct summability should be handled by the users in priori.

QuantumLattices.:⊗Method
⊗(bs₁::BinaryBases, bs₂::BinaryBases) -> BinaryBases

Get the direct product of two sets of binary bases.

QuantumLattices.:⊗Method
⊗(basis₁::BinaryBasis, basis₂::BinaryBasis) -> BinaryBasis

Get the direct product of two binary bases.

QuantumLattices.QuantumOperators.matrixMethod
matrix(op::Operator, braket::NTuple{2, BinaryBases}, table; dtype=valtype(op)) -> SparseMatrixCSC{dtype, Int}
matrix(ops::Operators, braket::NTuple{2, BinaryBases}, table; dtype=valtype(eltype(ops))) -> SparseMatrixCSC{dtype, Int}

Get the CSC-formed sparse matrix representation of an operator.

Here, table specifies the order of the operator ids.