TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
triqs::hilbert_space::space_partition< S, OP >

#include <triqs/hilbert_space/space_partition.hpp>

Detailed Description

template<typename S, typename OP>
class triqs::hilbert_space::space_partition< S, OP >

Automatic partitioning of a Hilbert (Fock) space into invariant subspaces of a Hermitian operator.

Given a Hamiltonian \( \hat{H} \) acting on a Hilbert (Fock) space \( \mathcal{F} \) (see triqs::hilbert_space::hilbert_space) with basis \( B_{\mathcal{F}} = \{ \lvert f \rangle \}_{f = 0}^{\dim( \mathcal{F}) - 1} \), the class builds the finest partition of \( \mathcal{F} \) into invariant subspaces \(\{ \mathcal{F}^{(k)} \} \) such that

\[ \hat{H} \, \mathcal{F}^{(k)} \subseteq \mathcal{F}^{(k)} \quad \forall k, \qquad \mathcal{F} = \bigoplus_k \mathcal{F}^{(k)}. \]

Each invariant subspace \( \mathcal{F}^{(k)} \) is represented as the set of Fock state indices \( f \) whose basis states \( \lvert f \rangle \) belong to it, and the partition is encoded internally as a disjoint-set (union-find) data structure over \( \{ 0, \dots, \dim(\mathcal{F}) - 1 \} \).

The partition is built in two phases:

  • Phase I (the constructor) discovers the invariant subspaces of \( \hat{H} \) by acting with \( \hat{H} \) on every basis Fock state \( \lvert f \rangle \in B_{\mathcal{F}} \) and merging the subspace containing \(\lvert f \rangle \) with the subspace containing every \( \lvert f' \rangle \) that appears with non-vanishing amplitude in \( \hat{H} \lvert f \rangle \). An optional second operator (typically a hybridization) may be supplied and is applied in the same loop so that the resulting partition is invariant under both operators.
  • Phase II (merge_subspaces()) optionally merges subspaces further so that a given operator \( \hat{c}^\dagger \) and its Hermitian conjugate \( \hat{c} \) generate at most one-to-one connections between the resulting subspaces. This is implemented as a breadth-first traversal of the alternating \( \hat{c}^\dagger \hat{c} \hat{c}^\dagger \cdots \) connections between subspaces.

The algorithm is described in detail in Computer Physics Communications 200, March 2016, 274-284 (section 4.2).

Template Parameters
SMany-body state type.
OPImperative operator type.

Definition at line 78 of file space_partition.hpp.

Public Types

using amplitude_t = typename state_t::value_type
 Amplitude type of the many-body states.
using block_mapping_t = std::set<std::pair<idx_t, idx_t>>
 Set of subspace-to-subspace connections, stored as (from-subspace, to-subspace) index pairs.
using idx_t = uint32_t
 Index type for basis Fock states \( \lvert f \rangle \) and for invariant subspaces \( \mathcal{F}^{(k)} \).
using matrix_element_map_t = std::map<std::pair<idx_t, idx_t>, amplitude_t>
 Non-vanishing matrix elements of an operator \( \hat{O} \) in the Fock basis.
using operator_t = OP
 Imperative operator type.
using state_t = S
 Many-body state type.

Public Member Functions

 space_partition (space_partition const &)=default
 Default copy constructor.
 space_partition (state_t const &psi, operator_t const &H, bool store_matrix_elements=true, operator_t const &delta=operator_t())
 Construct a space partition by running Phase I of the automatic partition algorithm.
block_mapping_t find_mappings (operator_t const &op, bool diagonal_only=false)
 Find all subspace-to-subspace connections generated by a given operator.
matrix_element_map_t const & get_matrix_elements () const
 Get the stored non-vanishing matrix elements of the Hamiltonian.
idx_t lookup_basis_state (idx_t f)
 Look up the invariant subspace containing a given basis Fock state.
auto merge_subspaces (operator_t const &cd, operator_t const &c, bool store_matrix_elements=true)
 Run Phase II of the automatic partition algorithm.
idx_t n_subspaces () const
 Get the number of invariant subspaces in the current partition.

Friends

template<typename F>
void foreach (space_partition &sp, F f)
 Apply a callable object to every basis Fock state in the partitioned Hilbert (Fock) space.

Member Typedef Documentation

◆ matrix_element_map_t

template<typename S, typename OP>
using triqs::hilbert_space::space_partition< S, OP >::matrix_element_map_t = std::map<std::pair<idx_t, idx_t>, amplitude_t>

Non-vanishing matrix elements of an operator \( \hat{O} \) in the Fock basis.

Stored as a map \( (i, j) \mapsto \langle f_j \lvert \hat{O} \rvert f_i \rangle \), where \( i \) and \( j \) are the indices of the initial and final basis Fock states \( \lvert f_i \rangle \) and \(\lvert f_j \rangle \).

Definition at line 102 of file space_partition.hpp.

Constructor & Destructor Documentation

◆ space_partition()

template<typename S, typename OP>
triqs::hilbert_space::space_partition< S, OP >::space_partition ( state_t const & psi,
operator_t const & H,
bool store_matrix_elements = true,
operator_t const & delta = operator_t() )
inline

Construct a space partition by running Phase I of the automatic partition algorithm.

Partitions the Hilbert (Fock) space \( \mathcal{F} \) associated with \( | \psi \rangle \) into invariant subspaces \( \{ \mathcal{F}^{(k)} \} \) of the Hamiltonian \( \hat{H} \).

The constructor iterates over every basis Fock state \( \lvert f \rangle \in B_{\mathcal{F}} \), evaluates \(\hat{H} \lvert f \rangle \), and for every \( \lvert f' \rangle \) that appears with non-vanishing amplitude \( \langle f' \lvert \hat{H} \rvert f \rangle \neq 0 \) merges the subspace currently containing \( \lvert f \rangle \) with the one containing \( \lvert f' \rangle \) in a disjoint-set data structure.

If \( \hat{\Delta} \) is non-empty, it is applied in the same loop so that the resulting partition is also invariant under \( \hat{\Delta} \). The typical use case is a hybridization operator that must respect the same block structure as \( \hat{H} \).

Note
\( | \psi \rangle \) is used only as a reference state to deduce the dimension and the Hilbert (Fock) space; its amplitudes are irrelevant.
Parameters
psiSample many-body state \( | \psi \rangle \) defining the Hilbert (Fock) space \( \mathcal{F} \) to partition.
HHamiltonian \( \hat{H} \) as a triqs::hilbert_space::imperative_operator.
store_matrix_elementsIf true, store all non-vanishing matrix elements \( \langle f' \lvert \hat{H} \rvert f \rangle \) encountered during the traversal (can be retrieved via get_matrix_elements()).
deltaOptional additional operator \( \hat{\Delta} \) whose action must be respected by the partition.

Definition at line 129 of file space_partition.hpp.

Member Function Documentation

◆ find_mappings()

template<typename S, typename OP>
block_mapping_t triqs::hilbert_space::space_partition< S, OP >::find_mappings ( operator_t const & op,
bool diagonal_only = false )
inline

Find all subspace-to-subspace connections generated by a given operator.

For every basis Fock state \( \lvert f \rangle \in B_{\mathcal{F}} \), computes \( \hat{O} \lvert f \rangle \) and records the index pair \( (k, k') \) of the invariant subspaces \( \mathcal{F}^{(k)} \ni \lvert f \rangle \) and \( \mathcal{F}^{(k')} \ni \lvert f' \rangle \) for every \( \lvert f' \rangle \) that appears with non-vanishing amplitude.

Parameters
opImperative operator \( \hat{O} \) to analyze.
diagonal_onlyIf true, only retain self-connections \( \mathcal{F}^{(k)} \to \mathcal{F}^{(k)} \).
Returns
Set of (from-subspace, to-subspace) index pairs.

Definition at line 321 of file space_partition.hpp.

◆ get_matrix_elements()

template<typename S, typename OP>
matrix_element_map_t const & triqs::hilbert_space::space_partition< S, OP >::get_matrix_elements ( ) const
inline

Get the stored non-vanishing matrix elements of the Hamiltonian.

Only populated if Phase I was constructed with store_matrix_elements = true. Otherwise the returned map is empty.

Returns
Map of \( (i, j) \mapsto \langle f_j \lvert \hat{H} \rvert f_i \rangle \) for every non-vanishing matrix element, where \( i \) and \( j \) are the indices of the initial and final basis Fock states.

Definition at line 306 of file space_partition.hpp.

◆ lookup_basis_state()

template<typename S, typename OP>
idx_t triqs::hilbert_space::space_partition< S, OP >::lookup_basis_state ( idx_t f)
inline

Look up the invariant subspace containing a given basis Fock state.

Parameters
fBasis fock state \( \lvert f \rangle \).
Returns
Index \( k \) of the invariant subspace \( \mathcal{F}^{(k)} \) that contains \( \lvert f \rangle \).

Definition at line 295 of file space_partition.hpp.

◆ merge_subspaces()

template<typename S, typename OP>
auto triqs::hilbert_space::space_partition< S, OP >::merge_subspaces ( operator_t const & cd,
operator_t const & c,
bool store_matrix_elements = true )
inline

Run Phase II of the automatic partition algorithm.

Merges invariant subspaces produced by Phase I until a given operator \( \hat{c}^\dagger \) and its Hermitian conjugate \( \hat{c} \) generate at most one-to-one connections between the resulting subspaces \( \{ \mathcal{F}^{(k)} \} \).

The implementation builds, for every initial basis Fock state \( \lvert f \rangle \in B_{\mathcal{F}} \), the subspace-level connections induced by \( \hat{c}^\dagger \lvert f \rangle \) and \( \hat{c} \lvert f \rangle \), and then performs a breadth-first traversal of the resulting bipartite graph: starting from a pair of subspaces \( (\mathcal{F}^{(\mathrm{lower})}, \mathcal{F}^{(\mathrm{upper})}) \) such that \( \hat{c}^\dagger \mathcal{F}^{(\mathrm{lower})} \cap \mathcal{F}^{(\mathrm{upper})} \neq \{ 0 \} \), all subspaces reachable by an even-length alternating product \( (\hat{c} \hat{c}^\dagger)^n \) from \( \mathcal{F}^{(\mathrm{lower})} \) are merged into \( \mathcal{F}^{(\mathrm{lower})} \), and all subspaces reachable by \( (\hat{c}^\dagger \hat{c})^n \) from \( \mathcal{F}^{(\mathrm{upper})} \) are merged into \( \mathcal{F}^{(\mathrm{upper})} \). The procedure repeats until no \( \hat{c}^\dagger \)-connection is left untreated.

Note
The algorithm assumes that the given \( \hat{c} \) is the Hermitian conjugate of \( \hat{c}^\dagger \); the bipartite traversal will not give meaningful results otherwise. See section 4.2 of the algorithm paper referenced in the class description for the mathematical justification.
Parameters
cdOperator \( \hat{c}^\dagger \) (typically a creation operator).
cHermitian conjugate \( \hat{c} \) of \( \hat{c}^\dagger \) (typically an annihilation operator).
store_matrix_elementsIf true, the non-vanishing matrix elements of \( \hat{c}^\dagger \) and \(\hat{c} \) are collected during the traversal and returned.
Returns
Pair of maps containing the non-vanishing matrix elements \( \langle f' \lvert \hat{c}^\dagger \rvert f \rangle \) and \( \langle f' \lvert \hat{c} \rvert f \rangle \) respectively; both maps are empty if store_matrix_elements = false.

Definition at line 195 of file space_partition.hpp.

◆ n_subspaces()

template<typename S, typename OP>
idx_t triqs::hilbert_space::space_partition< S, OP >::n_subspaces ( ) const
inline

Get the number of invariant subspaces in the current partition.

Returns
Number of invariant subspaces \( \{ \mathcal{F}^{(k)} \} \) in the partition.

Definition at line 271 of file space_partition.hpp.

◆ foreach

template<typename S, typename OP>
template<typename F>
void foreach ( space_partition< S, OP > & sp,
F f )
friend

Apply a callable object to every basis Fock state in the partitioned Hilbert (Fock) space.

For each basis Fock state index \( f \in \{ 0, \dots, \dim(\mathcal{F}) - 1 \} \) the callable is invoked with two arguments: \( f \) itself, and the index \( k \) of the invariant subspace \(\mathcal{F}^{(k)} \) containing \( \lvert f \rangle \).

Template Parameters
FCallable type.
Parameters
spSpace partition to iterate over.
fCallable object.

Definition at line 284 of file space_partition.hpp.


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