TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
triqs::hilbert_space::sub_hilbert_space

#include <triqs/hilbert_space/hilbert_space.hpp>

Detailed Description

Subspace of a fermionic Hilbert (Fock) space.

A subspace \( \mathcal{F}^{(m)} \subseteq \mathcal{F} \) of a triqs::hilbert_space::hilbert_space \(\mathcal{F} \) is defined by an ordered subset of occupation number basis states \( B_{\mathcal{F}^{(m)} } = \{ \lvert f_0 \rangle, \dots, \lvert f_{M-1} \rangle \} \subseteq B_{\mathcal{F}} \) such that \(\dim(\mathcal{F}^{(m)}) = M \leq \dim(\mathcal{F}) \).

The order of the Fock states on \( B_{\mathcal{F}^{(m)}} \) is defined as \( \lvert f_i \rangle < \lvert f_j \rangle \) if \( i < j \). This is not necessarily the same order as on \( B_{\mathcal{F}} \), where \(\lvert f_i \rangle < \lvert f_j \rangle \) if \( f_i < f_j \).

For fast lookup, we store

  • \( B_{\mathcal{F}^{(m)}} \), the ordered set of basis states in the subspace, as well as
  • a map from the Fock state \( \lvert f_i \rangle \) to the corresponding index \( i \in \{ 0, 1, \dots, M-1 \} \) within the ordered set of the subspace.

The subspace index \( m \) is used to distinguish between different subspaces of the same Hilbert (Fock) space.

Definition at line 193 of file hilbert_space.hpp.

Public Member Functions

 sub_hilbert_space (int m=-1)
 Construct an empty subspace with a given index \( m \).
void add_fock_state (fock_state_t f)
 Add a Fock state \( \lvert f \rangle \) to the subspace and increase its dimension by one.
auto const & get_all_fock_states () const
 Get \( B_{\mathcal{F}^{(m)}} \), the ordered set of all Fock states in the subspace.
auto get_fock_state (int i) const
 Get the Fock state \( \lvert f_i \rangle \in \mathcal{F}^{(m)} \) for a given index \( i \).
auto get_index () const
 Get the subspace index \( m \).
auto get_state_index (fock_state_t f) const
 Get the index \( i \) of a given Fock state \( \lvert f_i \rangle \) within this subspace.
bool has_state (fock_state_t f) const
 Check if a given Fock state \( \lvert f \rangle \) belongs to this subspace.
bool operator== (sub_hilbert_space const &hs) const
 Equal-to operator compares the subspace index \( m \) and the ordered set \( B_{\mathcal{F}^{(m)}} \).
void set_index (int m)
 Set the subspace index \( m \) of this subspace \( \mathcal{F}^{(m)} \).
auto size () const
 Get the dimension \( M = \dim(\mathcal{F}^{(m)}) \) of the subspace.

Static Public Member Functions

static std::string hdf5_format ()
 Get the HDF5 format tag.

Friends

void h5_read (h5::group g, std::string const &name, sub_hilbert_space &hs)
 Read a triqs::hilbert_space::sub_hilbert_space from HDF5.
void h5_write (h5::group g, std::string const &name, sub_hilbert_space const &hs)
 Write a triqs::hilbert_space::sub_hilbert_space to HDF5.

Constructor & Destructor Documentation

◆ sub_hilbert_space()

triqs::hilbert_space::sub_hilbert_space::sub_hilbert_space ( int m = -1)
inline

Construct an empty subspace with a given index \( m \).

Parameters
mSubspace index \( m \).

Definition at line 199 of file hilbert_space.hpp.

Member Function Documentation

◆ add_fock_state()

void triqs::hilbert_space::sub_hilbert_space::add_fock_state ( fock_state_t f)
inline

Add a Fock state \( \lvert f \rangle \) to the subspace and increase its dimension by one.

Given that the current dimension of the subspace is \( M \), the added state will be assigned the index \( M \) within the ordered set of Fock states of the subspace and the dimension of the subspace will be increased to \( M + 1 \).

Note
We do not check if the given state is already present in the subspace.
Parameters
fFock state \( \lvert f \rangle \) to be added.

Definition at line 225 of file hilbert_space.hpp.

◆ get_fock_state()

auto triqs::hilbert_space::sub_hilbert_space::get_fock_state ( int i) const
inlinenodiscard

Get the Fock state \( \lvert f_i \rangle \in \mathcal{F}^{(m)} \) for a given index \( i \).

Parameters
iInteger \( i \) representing the Fock state \( \lvert f_i \rangle \).
Returns
Fock state \( \lvert f_i \rangle \).

Definition at line 261 of file hilbert_space.hpp.

◆ get_state_index()

auto triqs::hilbert_space::sub_hilbert_space::get_state_index ( fock_state_t f) const
inlinenodiscard

Get the index \( i \) of a given Fock state \( \lvert f_i \rangle \) within this subspace.

Note
We do not check if the given state is present in the subspace.
Parameters
fFock state \( \lvert f_i \rangle \).
Returns
Integer \( i \).

Definition at line 245 of file hilbert_space.hpp.

◆ has_state()

bool triqs::hilbert_space::sub_hilbert_space::has_state ( fock_state_t f) const
inlinenodiscard

Check if a given Fock state \( \lvert f \rangle \) belongs to this subspace.

Parameters
fFock state \( \lvert f \rangle \).
Returns
True if \( f = f_i \) for some \( \lvert f_i \rangle \in \mathcal{F}^{(m)} \), false otherwise.

Definition at line 253 of file hilbert_space.hpp.

◆ set_index()

void triqs::hilbert_space::sub_hilbert_space::set_index ( int m)
inline

Set the subspace index \( m \) of this subspace \( \mathcal{F}^{(m)} \).

Parameters
mNew index \( m \).

Definition at line 273 of file hilbert_space.hpp.

◆ h5_read

void h5_read ( h5::group g,
std::string const & name,
sub_hilbert_space & hs )
friend

Read a triqs::hilbert_space::sub_hilbert_space from HDF5.

Parameters
gh5::group to be read from.
nameName of the subgroup.
hsSubspace to be read into.

Definition at line 298 of file hilbert_space.hpp.

◆ h5_write

void h5_write ( h5::group g,
std::string const & name,
sub_hilbert_space const & hs )
friend

Write a triqs::hilbert_space::sub_hilbert_space to HDF5.

Parameters
gh5::group to be written to.
nameName of the subgroup.
hsSubspace to be written.

Definition at line 285 of file hilbert_space.hpp.


The documentation for this class was generated from the following file: