State algebra#

FockVector#

Public names: edinpy.fermion.FockVector and edinpy.boson.FockVector.

class edinpy.fermion.FockVector(coefficients, sector)[source]#

Ket represented by coordinates in a built Fock-space sector.

Parameters:
  • coefficients (array_like) – One-dimensional real or complex coefficients in the ordering of sector.basis. The length must equal sector.dimension.

  • sector (NParticleSector) – Built fermionic or bosonic sector that defines the basis and mode ordering.

Notes

Coefficients are stored as a read-only NumPy array. Operator action, Hermitian conjugation, inner products, normalization, and expectation values preserve the associated sector.

property coefficients#

Return the read-only coefficients in basis order.

Type:

numpy.ndarray

property basis#

Return the ordered Fock basis associated with the ket.

property modes#

Return the mode specification associated with the ket.

property dag#

Return the Hermitian-adjoint bra of the ket.

inner(other)[source]#

Return the Hilbert-space inner product with another ket.

Parameters:

other (FockState, StateSum, FockVector, or NullState) – Ket on the right-hand side. A second FockVector must use a compatible sector.

Returns:

Inner product <self|other>.

Return type:

numbers.Number

norm()[source]#

Return the Hilbert-space norm of the ket.

normalized()[source]#

Return a unit-normalized copy of the ket.

Raises:

ValueError – If the coefficient vector has zero norm.

to_vector(*, copy=True)[source]#

Return coefficients in the sector-basis ordering.

Parameters:

copy (bool, optional) – Return a writable copy when True. When False, return the read-only array stored by the Fock vector.

Returns:

One-dimensional real or complex coefficient array.

Return type:

numpy.ndarray

FockBra#

Public names: edinpy.fermion.FockBra and edinpy.boson.FockBra.

class edinpy.fermion.FockBra(ket)[source]#

Hermitian adjoint of a Fock-space ket.

Parameters:

ket (FockState, StateSum, FockVector, or NullState) – Ket whose Hermitian adjoint is represented by the bra.

Notes

Multiplication by a compatible ket evaluates an inner product. Multiplication by an operator returns a bra-operator product that can be completed with a ket, as in psi.dag * O * psi.

property dag#

Return the ket whose Hermitian adjoint defines this bra.

StateSum#

Public names: edinpy.fermion.StateSum and edinpy.boson.StateSum.

class edinpy.fermion.StateSum(states)[source]#

Finite symbolic linear combination of occupation-number basis states.

Parameters:

states (iterable of FockState) – Elementary Fock states belonging to the same statistics-specific representation. Amplitudes are stored on the individual states.

Notes

simplified() combines repeated occupation configurations and removes terms with zero total amplitude.

property states#

Return the elementary Fock-state terms in the sum.

Type:

tuple

simplified()[source]#

Combine duplicate occupation states and remove zero amplitudes.

property dag#

Return the Hermitian-adjoint bra of the state sum.

inner(other)[source]#

Return the Hilbert-space inner product with another ket.

Parameters:

other (FockState, StateSum, FockVector, or NullState) – Ket on the right-hand side of the inner product. Basis-aware vectors must belong to a compatible sector.

Returns:

Inner product <self|other>.

Return type:

numbers.Number

norm()[source]#

Return the Hilbert-space norm of the state sum.

normalized()[source]#

Return a unit-normalized state sum.

NullState#

Public names: edinpy.fermion.NullState and edinpy.boson.NullState.

class edinpy.fermion.NullState[source]#

Additive zero for Fock-space state algebra.

NullState is returned when an operator annihilates a basis state or when a symbolic state sum simplifies to zero. It participates in state addition, scalar multiplication, Hermitian conjugation, and inner products without requiring a special numerical representation.

property dag#

Return the Hermitian-adjoint bra of the additive zero.

inner(other)[source]#

Return zero for the inner product with any compatible ket.

norm()[source]#

Return zero for the Hilbert-space norm.

normalized()[source]#

Raise because the additive zero cannot be normalized.