Class IndexBasisRegistry

Nested Relationships

Nested Types

Class Documentation

class IndexBasisRegistry

set of known IndexSpace objects and named basis instances

Each IndexSpace object has hardwired base key (label) that gives indexed expressions appropriate semantics; e.g., spaces referred to by indices in \( t_{p_1}^{i_1} \) are defined if IndexSpace objects with base keys \( p \) and \( i \) are registered. Since index spaces have set-theoretic semantics, the user must provide complete set of unions/intersects of the base spaces to cover all possible IndexSpace objects that can be generated in their program.

Registry contains 2 parts: a table of IndexBasis objects keyed by label (IndexBasisRegistry::bases(); a registered IndexSpace is the entry under its base_key() with a null basis instance, see IndexBasisRegistry::spaces(); a named basis instance is an entry under its own label, printed and parsed by that label), and the specification of various spaces (vacuum, reference, complete, etc.). Registries can be constructed from the same table but have different specifications of vacuum, reference, etc.; this is useful for providing different contexts for fermions and bosons, for example.

Spaces that can be occupied by physical particles need to be introspected for their structure, occupancy, etc. The registry provides the API needed for dealing with such states.

adding IndexSpace objects to the registry

inline IndexBasisRegistry &add(const IndexSpace &IS)

add an IndexSpace to this registry.

Parameters:

IS – an IndexSpace

Throws:

Exception – if IS.base_key() is not a valid base key (see io::serialization::v1::is_base_key()), or if it or IS.attr() matches an already registered IndexSpace

Returns:

reference to this

template<basic_string_convertible S, typename ...OptionalArgs>
inline IndexBasisRegistry &add(S &&type_label, IndexSpace::Type type, OptionalArgs&&... args)

add an IndexSpace to this registry.

Parameters:
  • type_label – a label that will denote the space type, must be convertible to a std::string

  • type – an IndexSpace::Type

  • args – optional arguments consisting of a mix of zero or more of the following:

    • IndexSpace::QuantumNumbers

    • dimension of the space (an integer)

    • any of { is_vacuum_occupied , is_reference_occupied , is_complete , is_hole , is_particle }

Throws:

Exception – if type_label or type matches an already registered IndexSpace

Returns:

reference to this

template<basic_string_convertible S, typename ...Args>
inline IndexBasisRegistry &add(S &&label, const IndexBasis &basis, Args&&... args)

registers a basis instance of a registered space under its own label

Parameters:
  • label – the label of the basis instance; must be a valid base key (see io::serialization::v1::is_base_key()): letters, ⁺, ⁻, combining diacritics, arrows and primes, so no digits or _, which an index label reserves for the ordinal

  • basis – an IndexBasis with a basis instance whose space is registered; the entry is named label whatever basis is named

  • args – optional arguments consisting of a mix of zero or one of each of the following, each defaulting to what basis carries (for a basis built from a space and an instance: the dimension of the space, IndexBasisMetric::Unit and the field of the space’s own basis):

    • extent of the basis (an integer)

    • IndexBasisMetric

    • Field

Throws:

Exception – if label is not a valid label or is already registered, if basis has no basis instance, if its space is not registered, or if basis is already named

Returns:

reference to this

template<basic_string_convertible S, index_space_or_label IndexSpaceOrLabel, typename ...OptionalArgs>
inline IndexBasisRegistry &add_unIon(S &&type_label, std::initializer_list<IndexSpaceOrLabel> components, OptionalArgs&&... args)

add a union of IndexSpace objects to this registry.

Parameters:
  • type_label – a label that will denote the space type, must be convertible to a std::string

  • components – sequence of IndexSpace objects or labels (known to this) whose union will be known by type_label

  • args – optional arguments consisting of a mix of zero or more of { is_vacuum_occupied , is_reference_occupied , is_complete , is_hole , is_particle }

Returns:

reference to this

template<basic_string_convertible S, index_space_or_label IndexSpaceOrLabel, typename ...OptionalArgs>
inline IndexBasisRegistry &add_union(S &&type_label, std::initializer_list<IndexSpaceOrLabel> components, OptionalArgs&&... args)

alias to add_unIon

template<basic_string_convertible S, index_space_or_label IndexSpaceOrLabel, typename ...OptionalArgs>
inline IndexBasisRegistry &add_intersection(S &&type_label, std::initializer_list<IndexSpaceOrLabel> components, OptionalArgs&&... args)

add a union of IndexSpace objects to this registry.

Parameters:
  • type_label – a label that will denote the space type, must be convertible to a std::string

  • components – sequence of IndexSpace objects or labels (known to this) whose intersection will be known by type_label

  • args – optional arguments consisting of a mix of zero or more of { is_vacuum_occupied , is_reference_occupied , is_complete , is_hole , is_particle }

Returns:

reference to this

physical particle space structure introspection

void physical_particle_attribute_mask(bitset_t m)

sets the mask of QN attributes of IndexSpaces that can be occupied by physical particles.

Some states do not correspond to physical particles, but may be present in the registry. Such spaces are not considered when e.g. determining the base spaces.

Parameters:

m – the mask of QN attributes of IndexSpaces that can be occupied by physical particles.

template<convertible_to_bitset T>
inline void physical_particle_attribute_mask(T m)

sets the mask of QN attributes of IndexSpaces that can be occupied by physical particles.

Some states do not correspond to physical particles, but may be present in the registry. Such spaces are not considered when e.g. determining the base spaces.

Parameters:

m – the mask of QN attributes of IndexSpaces that can be occupied by physical particles.

bitset_t physical_particle_attribute_mask() const

accesses the mask of QN attributes of IndexSpaces that can be occupied by physical particles.

Some states do not correspond to physical particles, but may be present in the registry. Such spaces are not considered when e.g. determining the base spaces.

Returns:

the mask of QN attributes of IndexSpaces that can be occupied by physical particles.

IndexSpace::QuantumNumbers physical_particle_attributes(IndexSpace::QuantumNumbers qn) const
Returns:

the bits of qn used to specify states of physical particles.

IndexSpace::QuantumNumbers other_attributes(IndexSpace::QuantumNumbers qn) const
Returns:

the bits of qn not used to specify states of physical particles.

inline const std::vector<IndexSpace::Type> &base_space_types() const

returns the list of basis IndexSpace::Type objects

A base IndexSpace::Type object has 1 bit in its bitstring.

Returns:

(memoized) set of base IndexSpace::Type objects, sorted in increasing order

inline const std::vector<IndexSpace> &base_spaces() const

returns the list of base IndexSpace objects

A base IndexSpace object has 1 bit in its type() bitstring.

Returns:

(memoized) set of base IndexSpace objects, sorted in the order of increasing type()

inline bool is_base(const IndexSpace &IS) const

checks if an IndexSpace is in the basis

See also

base_spaces

Parameters:

IS – IndexSpace

Returns:

true if IS is in the basis

template<basic_string_convertible S>
inline bool is_base(S &&space_key) const

equivalent to is_base(retrieve_space(space_key))

See also

base_spaces

Parameters:

space_key – label of a registered space, or of a named basis instance, which stands for its space

Returns:

true if the space registered with space_key is in the basis

static inline bool is_base(const IndexSpace::Type &t)

checks if an IndexSpace::Type is in the basis

See also

space_type_basis

Parameters:

t – IndexSpace::Type

Returns:

true if t is in the basis

specifies which spaces have nonzero occupancy in the vacuum wave

function

Note

needed for applying Wick theorem with Fermi vacuum

inline IndexBasisRegistry &vacuum_occupied_space(IndexSpace::Type t)
Parameters:

t – an IndexSpace::Type specifying which base spaces have nonzero occupancy in the vacuum wave function by default (i.e. for any quantum number choice); to specify occupied space per specific QN set use the other overload

Returns:

reference to this

inline IndexBasisRegistry &vacuum_occupied_space(container::map<IndexSpace::QuantumNumbers, IndexSpace::Type> qn2type)
Parameters:

qn2type – for each quantum number specifies which base spaces have nonzero occupancy in the reference wave function

Returns:

reference to this

inline IndexBasisRegistry &vacuum_occupied_space(const IndexSpace &s)

equivalent to vacuum_occupied_space(s.type())

Note

QuantumNumbers attribute of s ignored

Parameters:

s – an IndexSpace

Returns:

reference to this

template<basic_string_convertible S>
inline IndexBasisRegistry &vacuum_occupied_space(S &&l)

equivalent to vacuum_occupied_space(retrieve_space(l).type())

Parameters:

l – label of a known IndexSpace

Returns:

reference to this

inline const IndexSpace::Type &vacuum_occupied_space(bool nulltype_ok = false) const
Throws:

Exception – if nulltype_ok is false and vacuum_occupied_space had not been specified

Returns:

the space occupied in vacuum state for any set of quantum numbers

inline const IndexSpace &vacuum_occupied_space(IndexSpace::QuantumNumbers qn) const
Parameters:

qn – the quantum numbers of the space

Returns:

the space occupied in vacuum state for the given set of quantum numbers

assign which spaces have nonzero occupancy in the reference wave

function (i.e., the wave function uses to compute reference expectation value)

Note

needed for computing expectation values when the vacuum state does not match the wave function of interest.

inline IndexBasisRegistry &reference_occupied_space(IndexSpace::Type t)
Parameters:

t – an IndexSpace::Type specifying which base spaces have nonzero occupancy in the reference wave function by default (i.e., for any choice of quantum numbers); to specify occupied space per specific QN set use the other overload

Returns:

reference to this

inline IndexBasisRegistry &reference_occupied_space(container::map<IndexSpace::QuantumNumbers, IndexSpace::Type> qn2type)
Parameters:

qn2type – for each quantum number specifies which base spaces have nonzero occupancy in the reference wave function

Returns:

reference to this

inline IndexBasisRegistry &reference_occupied_space(const IndexSpace &s)

equivalent to reference_occupied_space(s.type())

Note

QuantumNumbers attribute of s ignored

Parameters:

s – an IndexSpace

Returns:

reference to this

template<basic_string_convertible S>
inline IndexBasisRegistry &reference_occupied_space(S &&l)

equivalent to reference_occupied_space(retrieve_space(l).type())

Parameters:

l – label of a known IndexSpace

Returns:

reference to this

inline const IndexSpace::Type &reference_occupied_space(bool nulltype_ok = false) const
Throws:

Exception – if nulltype_ok is false and reference_occupied_space had not been specified

Returns:

the space occupied in reference state for any set of quantum numbers

inline const IndexSpace &reference_occupied_space(IndexSpace::QuantumNumbers qn) const
Parameters:

qn – the quantum numbers of the space

Returns:

the space occupied in vacuum state for the given set of quantum numbers

specifies which spaces comprise the entirety of Hilbert space

Note

needed for creating general operators in mbpt/op

inline IndexBasisRegistry &complete_space(IndexSpace::Type s)
Parameters:

s – an IndexSpace::Type specifying the complete Hilbert space; to specify occupied space per specific QN set use the other overload

inline IndexBasisRegistry &complete_space(container::map<IndexSpace::QuantumNumbers, IndexSpace::Type> qn2type)
Parameters:

qn2type – for each quantum number specifies which base spaces have nonzero occupancy in the reference wave function

inline IndexBasisRegistry &complete_space(const IndexSpace &s)

equivalent to complete_space(s.type())

Note

QuantumNumbers attribute of s ignored

Parameters:

s – an IndexSpace

Returns:

reference to this

template<basic_string_convertible S>
inline IndexBasisRegistry &complete_space(S &&l)

equivalent to complete_space(retrieve_space(l).type())

Parameters:

l – label of a known IndexSpace

Returns:

reference to this

inline const IndexSpace::Type &complete_space(bool nulltype_ok = false) const
Throws:

Exception – if nulltype_ok is false and complete_space had not been specified

Returns:

the complete Hilbert space for any set of quantum numbers

inline const IndexSpace &complete_space(IndexSpace::QuantumNumbers qn) const
Parameters:

qn – the quantum numbers of the space

Returns:

the complete Hilbert space for the given set of quantum numbers

specifies in which space holes can be created successfully from the

reference wave function

Note

convenience for making operators

inline IndexBasisRegistry &hole_space(IndexSpace::Type t)
Parameters:

t – an IndexSpace::Type specifying where holes can be created; to specify hole space per specific QN set use the other overload

inline IndexBasisRegistry &hole_space(container::map<IndexSpace::QuantumNumbers, IndexSpace::Type> qn2type)
Parameters:

qn2type – for each quantum number specifies the space in which holes can be created

inline IndexBasisRegistry &hole_space(const IndexSpace &s)

equivalent to hole_space(s.type())

Note

QuantumNumbers attribute of s ignored

Parameters:

s – an IndexSpace

Returns:

reference to this

template<basic_string_convertible S>
inline IndexBasisRegistry &hole_space(S &&l)

equivalent to hole_space(retrieve_space(l).type())

Parameters:

l – label of a known IndexSpace

Returns:

reference to this

inline const IndexSpace::Type &hole_space(bool nulltype_ok = false) const
Throws:

Exception – if nulltype_ok is false and hole_space had not been specified

Returns:

default space in which holes can be created

inline const IndexSpace &hole_space(IndexSpace::QuantumNumbers qn) const
Parameters:

qn – the quantum numbers of the space

Returns:

the space in which holes can be created for the given set of quantum numbers

specifies in which space particles can be created successfully from

the reference wave function

Note

convenience for making operators

inline IndexBasisRegistry &particle_space(IndexSpace::Type t)
Parameters:

t – an IndexSpace::Type specifying where particles can be created; to specify particle space per specific QN set use the other overload

inline IndexBasisRegistry &particle_space(container::map<IndexSpace::QuantumNumbers, IndexSpace::Type> qn2type)
Parameters:

qn2type – for each quantum number specifies the space in which particles can be created

inline IndexBasisRegistry &particle_space(const IndexSpace &s)

equivalent to particle_space(s.type())

Note

QuantumNumbers attribute of s ignored

Parameters:

s – an IndexSpace

Returns:

reference to this

template<basic_string_convertible S>
inline IndexBasisRegistry &particle_space(S &&l)

equivalent to particle_space(retrieve_space(l).type())

Parameters:

l – label of a known IndexSpace

Returns:

reference to this

inline const IndexSpace::Type &particle_space(bool nulltype_ok = false) const
Throws:

Exception – if nulltype_ok is false and particle_space had not been specified

Returns:

default space in which particles can be created

inline const IndexSpace &particle_space(IndexSpace::QuantumNumbers qn) const
Parameters:

qn – the quantum numbers of the space

Returns:

the space in which particles can be created for the given set of quantum numbers

Public Types

using table_type = container::map<std::wstring, IndexBasis, std::less<>>

label -> basis: a space is the entry under its base_key() with a null instance, a named basis instance any other entry

Public Functions

inline IndexBasisRegistry()

default constructor creates a registry containing only IndexSpace::null

Note

null space is registered so we don’t have to handle it as a corner case in retrieve_space() and other methods

inline explicit IndexBasisRegistry(table_type bases)

constructs an IndexBasisRegistry from an existing table (e.g. the bases() of another registry), spaces and named basis instances alike

Note

the table is taken as given, it is not validated against the invariants that add() enforces, except that each label is a valid base key (the null space’s empty key aside) and each named basis instance carries the label it is registered under. The table does not record which entries follow which (see follow()), so none does here: a former follower keeps the values it mirrored as its own

Throws:

Exception – if a label is not a valid base key (see io::serialization::v1::is_base_key())

inline IndexBasisRegistry(const IndexBasisRegistry &other)

copy constructor

inline IndexBasisRegistry(IndexBasisRegistry &&other)

move constructor

inline IndexBasisRegistry &operator=(const IndexBasisRegistry &other)

copy assignment operator

inline IndexBasisRegistry &operator=(IndexBasisRegistry &&other)

move assignment operator

inline SpacesView spaces() const
Returns:

view of the registered spaces (the entries with a null basis instance)

inline SpacesView::iterator begin() const
inline SpacesView::iterator end() const
inline const table_type &bases() const
Returns:

the table of all entries, spaces and named basis instances

template<basic_string_convertible S>
inline const IndexBasis *retrieve_ptr(S &&label) const

retrieve a pointer to the IndexBasis registered under a label

Parameters:

label – a label of a space or of a named basis instance, or a label of an Index (see Index::label() )

Returns:

pointer to the IndexBasis registered under that key, or nullptr if not found

template<basic_string_convertible S>
inline const IndexBasis &retrieve(S &&label) const

retrieve the IndexBasis registered under a label

Parameters:

label – a label of a space or of a named basis instance, or a label of an Index (see Index::label() )

Throws:

IndexBasis::bad_key – if no entry is registered under that key

Returns:

the IndexBasis registered under that key

inline std::optional<std::wstring_view> basis_label(const IndexBasis &b) const
Returns:

the label under which the space and instance of b are registered (see same_instance()), or std::nullopt if b has no basis instance or they are not named

inline IndexBasis resolve(const IndexBasis &b) const
Returns:

the named entry of the space and instance of b (see same_instance()), which carries the entry’s name, extent, metric and field, if they are registered under a name; otherwise b unchanged

template<basic_string_convertible S>
inline IndexBasisRegistry &extent(S &&label, std::size_t n)

sets the extent of the entry registered under a label: the dimension of a space (the extent of its own basis, and of its named basis instances registered without an extent of their own), or the extent of a named basis instance

Parameters:
  • label – a label of a space or of a named basis instance

  • n – the extent

Throws:

IndexBasis::bad_key – if no entry is registered under label

Returns:

reference to this

template<basic_string_convertible S>
inline IndexBasisRegistry &approximate_size(S &&label, std::size_t n)

Deprecated:

use extent(label, n)

template<basic_string_convertible S>
inline IndexBasisRegistry &field(S &&label, Field f)

sets the Field of the entry registered under a label: of a space’s own basis (and of its named basis instances registered without a field of their own), or of a named basis instance

Parameters:
  • label – a label of a space or of a named basis instance

  • f – the Field

Throws:

IndexBasis::bad_key – if no entry is registered under label

Returns:

reference to this

template<basic_string_convertible S>
inline IndexBasisRegistry &metric(S &&label, IndexBasisMetric m)

sets the metric of the named basis instance registered under a label

Parameters:
  • label – a label of a named basis instance

  • m – the metric

Throws:
  • IndexBasis::bad_key – if no entry is registered under label

  • Exception – if label is that of a space: the own basis of a space is orthonormal

Returns:

reference to this

template<basic_string_convertible S1, basic_string_convertible S2>
inline IndexBasisRegistry &follow(S1 &&label, S2 &&source)

makes the named basis instance registered under label follow the one registered under source: its extent, metric and field are those of source, now and whenever they change (e.g. the PAO bases follow the AO basis they are projected from), and cannot be set through its own label

Parameters:
  • label – the label of the follower

  • source – the label of the entry to follow

Throws:
  • IndexBasis::bad_key – if no entry is registered under either label

  • Exception – if either entry is a space, if the two are one, if source follows an entry itself or if label is followed by one (an entry follows directly, not through another)

Returns:

reference to this

template<basic_string_convertible S>
inline std::optional<std::wstring> follows(S &&label) const
Returns:

a copy of the label of the entry the named basis instance registered under label follows (see follow()), std::nullopt if it follows none

template<basic_string_convertible S>
inline const IndexSpace *retrieve_space_ptr(S &&label) const

retrieve a pointer to IndexSpace from the registry by the label

Note

a space’s metadata is written with extent(label, n) and field(label, f), which also reach its named basis instances

Parameters:

label – a base_key of an IndexSpace, or a label of an Index (see Index::label() )

Returns:

pointer to IndexSpace associated with that key, or nullptr if not found or if the key names a basis instance

template<basic_string_convertible S>
inline const IndexSpace &retrieve_space(S &&label) const

retrieve an IndexSpace from the registry by the label

Parameters:

label – a base_key of an IndexSpace, or a label of an Index (see Index::label() )

Throws:
Returns:

IndexSpace associated with that key

inline const IndexSpace *retrieve_space_ptr(const IndexSpace::Type &type, const IndexSpace::QuantumNumbers &qns) const

retrieve a pointer to IndexSpace from the registry by its type and quantum numbers

Parameters:
Returns:

pointer to the IndexSpace associated with that key, or nullptr if not found

inline const IndexSpace &retrieve_space(const IndexSpace::Type &type, const IndexSpace::QuantumNumbers &qns) const

retrieve an IndexSpace from the registry by its type and quantum numbers

Parameters:
Throws:

Exception – if matching space is not found

Returns:

IndexSpace associated with that key.

inline const IndexSpace *retrieve_space_ptr(const IndexSpace::Attr &space_attr) const

retrieve pointer to the IndexSpace from the registry by the IndexSpace::Attr

Parameters:

space_attr – an IndexSpace::Attr

Returns:

pointer to the IndexSpace associated with that key, or nullptr if not found

inline const IndexSpace &retrieve_space(const IndexSpace::Attr &space_attr) const

retrieve an IndexSpace from the registry by the IndexSpace::Attr

Parameters:

space_attr – an IndexSpace::Attr

Throws:

Exception – if matching space is not found

Returns:

IndexSpace associated with that key.

template<basic_string_convertible S>
inline bool contains(S &&label) const

queries presence of a registered IndexSpace or named basis instance

Parameters:

label – a base_key of an IndexSpace, a label of a named basis instance, or a label of an Index (see Index::label() )

Returns:

true, if an entry with key label is registered

inline bool contains(const IndexBasis &b) const

queries presence of a registered basis

Parameters:

b – an IndexBasis object

Returns:

true, if b has a basis instance and is named, or has none and its space is registered

inline bool contains(const IndexSpace &space) const

queries presence of a registered IndexSpace

Parameters:

space – an IndexSpace object

Returns:

true, if an IndexSpace with key {type,qns} is registered

inline bool contains(const IndexSpace::Type &type, const IndexSpace::QuantumNumbers &qns) const

queries presence of a registered IndexSpace

Parameters:
Returns:

true, if an IndexSpace with key {type,qns} is registered

inline bool contains(const IndexSpace::Attr &space_attr) const

queries presence of a registered IndexSpace

Parameters:

space_attr – an IndexSpace::Attr object

Returns:

true, if an IndexSpace with key space_attr is registered

inline IndexBasisRegistry &remove(const IndexSpace &IS)

removes an IndexSpace associated with IS.base_key() from this

Parameters:

IS – an IndexSpace

Throws:

Exception – if basis instances of the space are named

Returns:

reference to this

template<basic_string_convertible S>
inline IndexBasisRegistry &remove(S &&label)

removes the named basis instance registered under label, else equivalent to remove(this->retrieve_space(label))

Parameters:

label – label of a space or of a named basis instance

Returns:

reference to this

inline IndexBasisRegistry &replace(const IndexSpace &IS)

replaces an IndexSpace registered in the registry under IS.base_key() with IS

Parameters:

IS – an IndexSpace

Throws:

Exception – if the replaced space has named basis instances

Returns:

reference to this

inline IndexBasisRegistry &clear()

clear the contents of *this

Returns:

reference to this

inline bool valid_intersection(const IndexSpace &space1, const IndexSpace &space2) const

queries if the intersection space is nonnull and registered

Parameters:
  • space1 –

  • space2 –

Returns:

true if space1.intersection(space2) is nonnull and registered

template<basic_string_convertible S1, basic_string_convertible S2>
inline bool valid_intersection(S1 &&space1_key, S2 &&space2_key) const

queries if the intersection space is nonnull and registered

Parameters:
  • space1_key – label of a registered space, or of a named basis instance, which stands for its space

  • space2_key – label of a registered space, or of a named basis instance, which stands for its space

Returns:

true if valid_intersection(retrieve_space(space1_key),retrieve_space(space2_key)) is nonnull and registered

inline const IndexSpace &intersection(const IndexSpace &space1, const IndexSpace &space2) const

return the resulting space corresponding to a bitwise intersection between two spaces.

Note

can return nullspace

Note

throw invalid_argument if the nonnull intersection is not registered

Parameters:
Returns:

the intersection of space1 and space2

template<basic_string_convertible S1, basic_string_convertible S2>
inline const IndexSpace &intersection(S1 &&space1_key, S2 &&space2_key) const

Note

can return nullspace

Note

throw invalid_argument if the nonnull intersection is not registered

Parameters:
  • space1_key – label of a registered space, or of a named basis instance, which stands for its space

  • space2_key – label of a registered space, or of a named basis instance, which stands for its space

Returns:

the intersection of space1 and space2

inline bool valid_unIon(const IndexSpace &space1, const IndexSpace &space2) const

is a union between spaces is registered

Parameters:
  • space1 –

  • space2 –

Returns:

true if space is registered

template<basic_string_convertible S1, basic_string_convertible S2>
inline bool valid_unIon(S1 &&space1_key, S2 &&space2_key) const

is a union between spaces is registered

Parameters:
  • space1_key – label of a registered space, or of a named basis instance, which stands for its space

  • space2_key – label of a registered space, or of a named basis instance, which stands for its space

Returns:

true if valid_unIon(retrieve_space(space1_key),retrieve_space(space2_key)) is registered

template<index_space_or_label T1, index_space_or_label T2>
inline bool valid_union(T1 &&t1, T2 &&t2) const

alias for valid_unIon

inline const IndexSpace &unIon(const IndexSpace &space1, const IndexSpace &space2) const

Note

can only return registered spaces

Note

never returns nullspace

Parameters:
  • space1 –

  • space2 –

Returns:

the union of two spaces.

template<basic_string_convertible S1, basic_string_convertible S2>
inline const IndexSpace &unIon(S1 &&space1_key, S2 &&space2_key) const

Note

can only return registered spaces

Note

never returns nullspace

Parameters:
  • space1_key – label of a registered space, or of a named basis instance, which stands for its space

  • space2_key – label of a registered space, or of a named basis instance, which stands for its space

Returns:

the union of two spaces.

inline bool is_pure_occupied(const IndexSpace &IS) const

an IndexSpace is occupied with respect to the fermi vacuum or a subset of that space

Note

only makes sense to ask this if in a SingleProduct vacuum context.

template<basic_string_convertible S>
inline bool is_pure_occupied(S &&space_key) const

equivalent to is_pure_occupied(retrieve_space(space_key))

See also

base_spaces

Parameters:

space_key – label of a registered space, or of a named basis instance, which stands for its space

Returns:

is_pure_occupied(retrieve_space(space_key))

inline bool is_pure_unoccupied(const IndexSpace &IS) const

all states are unoccupied in the fermi vacuum

Note

again, this only makes sense to ask if in a SingleProduct vacuum context.

template<basic_string_convertible S>
inline bool is_pure_unoccupied(S &&space_key) const

equivalent to is_pure_unoccupied(retrieve_space(space_key))

See also

base_spaces

Parameters:

space_key – label of a registered space, or of a named basis instance, which stands for its space

Returns:

is_pure_unoccupied(retrieve_space(space_key))

inline bool contains_occupied(const IndexSpace &IS) const

some states are fermi vacuum occupied

template<basic_string_convertible S>
inline bool contains_occupied(S &&space_key) const

equivalent to contains_occupied(retrieve_space(space_key))

See also

base_spaces

Parameters:

space_key – label of a registered space, or of a named basis instance, which stands for its space

Returns:

contains_occupied(retrieve_space(space_key))

inline bool contains_unoccupied(const IndexSpace &IS) const

some states are fermi vacuum unoccupied

template<basic_string_convertible S>
inline bool contains_unoccupied(S &&space_key) const

equivalent to contains_occupied(retrieve_space(space_key))

See also

base_spaces

Parameters:

space_key – label of a registered space, or of a named basis instance, which stands for its space

Returns:

contains_occupied(retrieve_space(space_key))

inline const IndexSpace &vacuum_unoccupied_space(IndexSpace::QuantumNumbers qn) const
Returns:

the space that is unoccupied in the vacuum state

inline const IndexSpace &active_space(IndexSpace::QuantumNumbers qn) const
Returns:

the space that is reference-occupied but vacuum-unoccupied: the partially occupied space of a Vacuum::MultiProduct reference (null if there is none)

struct not_a_space : public sequant::IndexBasis::bad_key

exception type thrown when a label names a basis instance where a space is required

class SpacesView

the space entries of a registry, as IndexSpace objects, in label order; valid as long as the registry is neither modified nor destroyed

Public Functions

inline explicit SpacesView(const table_type &table)
inline iterator begin() const
inline iterator end() const
class iterator

Public Types

using iterator_category = std::forward_iterator_tag
using value_type = IndexSpace
using difference_type = std::ptrdiff_t
using pointer = const IndexSpace*
using reference = const IndexSpace&

Public Functions

iterator() = default
inline iterator(table_type::const_iterator it, table_type::const_iterator end)
inline reference operator*() const
inline pointer operator->() const
inline iterator &operator++()
inline iterator operator++(int)

Friends

friend bool operator==(const iterator&, const iterator&) = default