Class IndexSpace

Nested Relationships

Nested Types

Class Documentation

class IndexSpace

a collection of attributes which define a space of (1-particle) states

IndexSpace has a base_label, TypeAttr or interpretable bitset in the context of other spaces. IndexSpace may also have QuantumNumberAttr which differentiate spaces with different quanta, such as spin projection quantum numbers. IndexSpace may additionally have an approximate extent which is useful in symbolic manipulation of indexed expressions, such as tensor network evaluation.

Public Types

using Type = TypeAttr
using QuantumNumbers = QuantumNumbersAttr

Public Functions

inline constexpr Attr attr() const noexcept
inline constexpr Type type() const noexcept
inline QuantumNumbers qns() const noexcept
inline IndexSpace() noexcept

Default ctor creates null space (with null label, type and quantum numbers)

inline explicit operator bool() const
template<typename S, typename = meta::EnableIfAllBasicStringConvertible<S>>
inline IndexSpace(S &&type_label, TypeAttr typeattr, QuantumNumbersAttr qnattr = QuantumNumbersAttr{0}, unsigned long approximate_size = 10)
IndexSpace(const IndexSpace &other) = default
IndexSpace(IndexSpace &&other) = default
IndexSpace &operator=(const IndexSpace &other) = default
IndexSpace &operator=(IndexSpace &&other) = default
inline const std::wstring &base_key() const
inline std::size_t approximate_size() const
Returns:

approximate size of a space

inline void approximate_size(size_t n)

Set the approximate size of a space.

Public Static Functions

static inline std::wstring_view reduce_key(std::wstring_view key)
static inline std::wstring reduce_key(std::string_view key)

Public Static Attributes

static const IndexSpace null

Friends

friend constexpr bool operator==(IndexSpace const&, IndexSpace const&) noexcept

IndexSpace are equal if they have equal IndexSpace::type(), IndexSpace::qns(), and IndexSpace::base_key().

friend constexpr bool operator!=(IndexSpace const&, IndexSpace const&) noexcept

IndexSpace are equal if they have equal IndexSpace::type(), IndexSpace::qns(), and IndexSpace::base_key().

friend constexpr bool operator<(IndexSpace const&, IndexSpace const&) noexcept

IndexSpace are ordered by their attributes (i.e. labels do not matter one bit)

struct Attr : public sequant::TypeAttr, public sequant::QuantumNumbersAttr

Attr describes all attributes of a space (occupancy + quantum numbers)

Public Functions

inline Attr(TypeAttr type, QuantumNumbersAttr qns) noexcept
inline Attr(int32_t type, int32_t qns) noexcept
Attr() = default

default ctor creates a null Attr

Post:

static_cast<bool>(*this) == false

Attr(const Attr&) = default
Attr(Attr&&) = default
Attr &operator=(const Attr&) = default
Attr &operator=(Attr&&) = default
inline constexpr const TypeAttr &type() const
inline constexpr TypeAttr &type()
inline constexpr const QuantumNumbersAttr &qns() const
inline constexpr QuantumNumbersAttr &qns()
inline explicit constexpr operator int64_t() const
inline explicit operator bool() const
Returns:

true if either type() or qns() is non-null

inline Attr unIon(Attr other) const

union of Attr = union of TypeAttr and union of QuantumNumbersAttr

Returns:

union of *this and other, i.e. *this AND other

inline Attr intersection(Attr other) const

intersection of Attr = intersection of TypeAttr and intersection of QuantumNumbersAttr

Returns:

intersection of *this AND other

inline bool includes(Attr other) const
Returns:

true if other is included in this object

inline constexpr bool operator==(Attr other) const
inline constexpr bool operator!=(Attr other) const
inline constexpr bool operator<(Attr other) const

Attr objects are ordered by quantum numbers, then by type.

Public Static Attributes

static const Attr null

Friends

inline friend Attr operator|(Attr a, Attr b)

See also

Attr::unIon

Returns:

union of a and b

inline friend Attr operator&(Attr a, Attr b)

Returns:

intersection of a and b

struct bad_key : public std::invalid_argument

exception type thrown when ancountered unknown/invalid IndexSpace::base_key() or Index::label()

Public Functions

inline bad_key()
template<typename S, typename = meta::EnableIfAllBasicStringConvertible<S>>
inline bad_key(S &&key)
struct KeyCompare

Public Types

using is_transparent = void

Public Functions

inline bool operator()(const IndexSpace &a, const IndexSpace &b) const
inline bool operator()(const std::wstring &a, const IndexSpace &b) const
inline bool operator()(const std::wstring_view &a, const IndexSpace &b) const
inline bool operator()(const IndexSpace &a, const std::wstring &b) const
inline bool operator()(const IndexSpace &a, const std::wstring_view &b) const
inline bool operator()(const std::wstring &a, const std::wstring &b) const
inline bool operator()(const std::wstring &a, const std::wstring_view &b) const
inline bool operator()(const std::wstring_view &a, const std::wstring &b) const