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

#include <triqs/hilbert_space/fundamental_operator_set.hpp>

Detailed Description

Class representing a fundamental operator set.

A fundamental operator set is an ordered set of single particle state indices, \( A = \{ \alpha_i \}_{i=0}^{N-1} \), where the corresponding states \( \{ \lvert \alpha_i \rangle \}_{i=0}^{N-1} \) span a 1-particle Hilbert space \( \mathcal{H}_1 \) of finite dimension \( N \). By ordered, we mean that there is a strict total order imposed on the set \( A \) such that \( \alpha_i < \alpha_j \) if \( i < j \).

Each index \( \alpha_i \) can consist of an arbitrarily long sequence of integers, strings, doubles and arrays of integers. We write \( \alpha_i = (\beta^{(i)}_1, \dots, \beta^{(i)}_{k_i}) \), where each \( \beta^{(i)}_j \) is either an integer, a string, a double or an array of integers.

For example, fermionic operators are often characterized by a spin index \( \sigma \) and an orbital index \( a \) such that \( \alpha = (\sigma, a) \). Considering fermions with spins \( \sigma \in \{ \text{"up"}, \text{"down"} \} \) and 3 orbitals \( a \in \{ 0, 1, 2 \} \), the fundamental operator set is given by

\[ A = \{ (\text{"up"}, 0), (\text{"up"}, 1), (\text{"up"}, 2), (\text{"down"}, 0), (\text{"down"}, 1), (\text{"down"}, 2) \} \; . \]

Definition at line 94 of file fundamental_operator_set.hpp.

Public Types

using const_iterator = triqs::utility::dressed_iterator<_enum_iterator, _cdress>
 Constant iterator type.
using data_t = std::vector<indices_t>
 Container type to store \( A = \{ \alpha_i \}_{i=0}^{N-1} \).
using indices_t = triqs::hilbert_space::indices_t
 Index type to represent a single \( \alpha_i \).

Public Member Functions

 fundamental_operator_set ()=default
 Default constructor leaves the set of indices empty, i.e. \( A = \emptyset \).
 fundamental_operator_set (data_t v)
 Construct a fundamental operator set from a vector of indices \( \mathbf{v} = (\alpha_0, \dots, \alpha_{N-1}) \).
 fundamental_operator_set (gf_struct_t const &gf_struct)
 Construct a fundamental operator set from a triqs::gfs::gf_struct_t object.
template<typename IndexType>
 fundamental_operator_set (std::set< IndexType > const &A)
 Construct a fundamental operator set from a set of indices \( A = \{ \alpha_0, \dots, \alpha_{N-1} \} \).
 fundamental_operator_set (std::vector< int > const &v)
 Construct a fundamental operator set from a vector of integers \( \mathbf{v} = (v_1, \dots, v_k) \).
const_iterator begin () const noexcept
 Get a const iterator to the beginning of the set.
const_iterator cbegin () const noexcept
 Get a const iterator to the beginning of the set.
auto cend () const noexcept
 Get a const iterator to the end of the set.
data_t const & data () const
 Get the ordered set \( A = \{ \alpha_i \}_{i=0}^{N-1} \).
auto end () const noexcept
 Get a const iterator to the end of the set.
bool has_indices (indices_t const &alpha) const
 Check if a given \( \alpha \) is in the set.
template<typename... Bs>
void insert (Bs const &...betas)
 Insert a new index \( \alpha = (\beta_1, \dots, \beta_k) \) into the set.
void insert_from_indices_t (indices_t const &alpha)
 Insert a new index \( \alpha \) into the set.
 operator data_t () const
 Explicit conversion operator to a std::vector of indices_t.
bool operator== (fundamental_operator_set const &fops) const
 Equal-to operator compares the ordered sets of indices for equality.
auto operator[] (indices_t const &alpha) const
 Subscript operator to get the position of a given index \( \alpha \) in the set.
auto size () const
 Get the number \( N \) of single particle state indices in the set.

Friends

void h5_read_attribute (h5::object obj, std::string const &name, fundamental_operator_set &fops)
 Read a triqs::hilbert_space::fundamental_operator_set from an HDF5 attribute.
void h5_write_attribute (h5::object obj, std::string const &name, fundamental_operator_set const &fops)
 Write a triqs::hilbert_space::fundamental_operator_set to HDF5 as an attribute.

Constructor & Destructor Documentation

◆ fundamental_operator_set() [1/4]

triqs::hilbert_space::fundamental_operator_set::fundamental_operator_set ( std::vector< int > const & v)
inline

Construct a fundamental operator set from a vector of integers \( \mathbf{v} = (v_1, \dots, v_k) \).

The set will contain indices \( \alpha_i = (\beta^{(i)}_1, \beta^{(i)}_2) \) with \( \beta^{(i)}_1 \in \{ 0, \dots, k-1 \} \) and \( \beta^{(i)}_2 \in \{ 0, \dots, v_{\beta^{(i)}_1} \} \).

For example, given \( \mathbf{v} = (2, 1, 3) \), the generated fundamental operator set is

\[ A = \{ (0, 0), (0, 1), (1, 0), (2, 0), (2, 1), (2, 2) \} \; . \]

Parameters
vVector of integers \( \mathbf{v} \).

Definition at line 123 of file fundamental_operator_set.hpp.

◆ fundamental_operator_set() [2/4]

template<typename IndexType>
triqs::hilbert_space::fundamental_operator_set::fundamental_operator_set ( std::set< IndexType > const & A)
inline

Construct a fundamental operator set from a set of indices \( A = \{ \alpha_0, \dots, \alpha_{N-1} \} \).

Note
The order of the indices in the set is preserved.
Template Parameters
IndexTypeIndex type.
Parameters
ASet of indices \( A \).

Definition at line 137 of file fundamental_operator_set.hpp.

◆ fundamental_operator_set() [3/4]

triqs::hilbert_space::fundamental_operator_set::fundamental_operator_set ( data_t v)
inlineexplicit

Construct a fundamental operator set from a vector of indices \( \mathbf{v} = (\alpha_0, \dots, \alpha_{N-1}) \).

Note
The order of the indices in the vector is preserved.
Parameters
vVector of indices \( \mathbf{v} \).

Definition at line 149 of file fundamental_operator_set.hpp.

◆ fundamental_operator_set() [4/4]

triqs::hilbert_space::fundamental_operator_set::fundamental_operator_set ( gf_struct_t const & gf_struct)
inline

Construct a fundamental operator set from a triqs::gfs::gf_struct_t object.

A triqs::gfs::gf_struct_t object determines the shape of a block Green's function. It is a vector of pairs, where each pair consists of a block name \( s \) and block size \( b_s \). The size of the vector \(k \) corresponds to the number of blocks.

The set will contain indices \( \alpha_i = (\beta^{(i)}_1, \beta^{(i)}_2) \) with \( \beta^{(i)}_1 \in \{ s_1, \dots, s_k \} \) and \( \beta^{(i)}_2 \in \{ 0, \dots, b_{\beta^{(i)}_1} - 1 \} \).

For example, given the block structure \(\left( (\text{"up"}, 2), (\text{"down"}, 3) \right) \), the generated fundamental operator set is

\[ A = \{ (\text{"up"}, 0), (\text{"up"}, 1), (\text{"down"}, 0), (\text{"down"}, 1), (\text{"down"}, 2) \} \; . \]

Parameters
gf_structA triqs::gfs::gf_struct_t object representing the structure of a Green's function.

Definition at line 169 of file fundamental_operator_set.hpp.

Member Function Documentation

◆ has_indices()

bool triqs::hilbert_space::fundamental_operator_set::has_indices ( indices_t const & alpha) const
inlinenodiscard

Check if a given \( \alpha \) is in the set.

Parameters
alphaIndex \( \alpha \) to look up.
Returns
True if \( \alpha = \alpha_i \) for some \( \alpha_i \in A \), false otherwise.

Definition at line 211 of file fundamental_operator_set.hpp.

◆ insert()

template<typename... Bs>
void triqs::hilbert_space::fundamental_operator_set::insert ( Bs const &... betas)
inline

Insert a new index \( \alpha = (\beta_1, \dots, \beta_k) \) into the set.

It calls insert_from_indices_t() with the index \( \alpha \) constructed from the given \( \beta_i \).

Template Parameters
BsTypes of \( \beta_i \).
Parameters
betas\( \beta_1, \dots, \beta_k \) that form the index \( \alpha \).

Definition at line 200 of file fundamental_operator_set.hpp.

◆ insert_from_indices_t()

void triqs::hilbert_space::fundamental_operator_set::insert_from_indices_t ( indices_t const & alpha)
inline

Insert a new index \( \alpha \) into the set.

The index is inserted at end of the set such that \( \alpha_i < \alpha \) for all existing indices \(\alpha_i \) in the set.

It does nothing if the index is already present.

Parameters
alphaIndex \( \alpha \) to insert.

Definition at line 187 of file fundamental_operator_set.hpp.

◆ operator[]()

auto triqs::hilbert_space::fundamental_operator_set::operator[] ( indices_t const & alpha) const
inlinenodiscard

Subscript operator to get the position of a given index \( \alpha \) in the set.

It throws an exception if \( \alpha \notin A \).

Parameters
alphaIndex \( \alpha \) to look up.
Returns
Position of the index \( \alpha \) in the set.

Definition at line 221 of file fundamental_operator_set.hpp.

◆ h5_read_attribute

void h5_read_attribute ( h5::object obj,
std::string const & name,
fundamental_operator_set & fops )
friend

Read a triqs::hilbert_space::fundamental_operator_set from an HDF5 attribute.

Parameters
objh5::object the attribute belongs to.
nameName of the attribute.
fopsFundamental operator set to be read into.

Definition at line 126 of file fundamental_operator_set.cpp.

◆ h5_write_attribute

void h5_write_attribute ( h5::object obj,
std::string const & name,
fundamental_operator_set const & fops )
friend

Write a triqs::hilbert_space::fundamental_operator_set to HDF5 as an attribute.

Parameters
objh5::object the attribute belongs to.
nameName of the attribute.
fopsFundamental operator set to be written.

Definition at line 122 of file fundamental_operator_set.cpp.


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