Template Class NormalOperator

Inheritance Relationships

Base Types

Class Documentation

template<Statistics S>
class NormalOperator : public sequant::Operator<S>, public sequant::AbstractTensor, public sequant::Labeled

NormalOperator is an Operator normal-ordered with respect to vacuum.

Note

Normal ordering means all creators are to the left of all annihilators. It is natural to express at least number-conserving normal operators (i.e. those with equal number of creators and annihilators) as tensors with creators as superscripts and annihilators as subscripts. Operator cre(p1) cre(p2) … cre(pN) ann(qN) … ann(q2) ann(q1) is represented in such notation as a^{p1 p2 … pN}_{q1 q2 … qN}, hence it is natural to specify annihilators in the order of their particle index (i.e. as q1 q2, etc.) which is reverse of the order of their appearance in Operator.

Note

The tensor notation becomes less intuitive for number non-conserving operators, e.g. cre(p1) cre(p2) ann(q2) could be represented as a^{p1 p2}_{q2 ⎵} or a^{p1 p2}_{⎵ q2}. To make it explicit that ann(q2) acts on same particle as cre(p2) the latter notation is used; similarly, cre(p1) ann(q1) ann(q2) is represented as a^{⎵ p1}_{q1 q2}.

Template Parameters:

S – specifies the particle statistics

Public Types

using base_type = Operator<S>
using vector_type = typename Operator<S>::base_type
using iterator = typename Operator<S>::iterator
using const_iterator = typename Operator<S>::const_iterator

Public Functions

inline NormalOperator(Vacuum v = get_default_context(S).vacuum())

constructs an identity operator

template<typename IndexOrOpSequence1, typename IndexOrOpSequence2, typename = std::enable_if_t<(meta::is_statically_castable_v<meta::range_value_t<IndexOrOpSequence1>, Index> || meta::is_statically_castable_v<meta::range_value_t<IndexOrOpSequence1>, Op<S>>) && (meta::is_statically_castable_v<meta::range_value_t<IndexOrOpSequence2>, Index> || meta::is_statically_castable_v<meta::range_value_t<IndexOrOpSequence2>, Op<S>>)>>
inline NormalOperator(const cre<IndexOrOpSequence1> &creators, const ann<IndexOrOpSequence2> &annihilators, Vacuum v = get_default_context(S).vacuum())
Template Parameters:
  • IndexOrOpSequence1 – type representing a sequence of objects that can be statically cast into Index or Op

  • IndexOrOpSequence2

Parameters:
  • creators

  • annihilators

  • v

inline NormalOperator(const NormalOperator &other)
NormalOperator(NormalOperator&&) = default
NormalOperator &operator=(NormalOperator&&) = default
inline NormalOperator &operator=(const NormalOperator &other)
inline Vacuum vacuum() const
Returns:

the vacuum state with respect to which the operator is normal-ordered.

inline auto creators() const
Returns:

the range of creators, in the order of increasing particle index

inline auto annihilators() const
Returns:

the range of annihilators, in the order of increasing particle index

inline auto ncreators() const
Returns:

the number of creators

inline auto nannihilators() const
Returns:

the number of annihilators

inline auto creann() const
Returns:

view of creators and annihilators as a single range

inline auto rank() const
Throws:

std::logic_error – if the operator is not particle number conserving (i.e. if ncreators() != nannihilators() )

Returns:

number of creators/annihilators

inline const auto &hug() const

See also

HugenholtzVertex

Returns:

the representation of *this as a Hugenholtz vertex

virtual std::wstring_view label() const override

See also

to_latex() for producing unique string representation

Returns:

object’s label. 2 objects that are not equal can return same label, i.e. the label does not identify the object uniquely. Thus labels can be viewed as immutable string tags that for some object types can be used for sorting and other purposes.

inline virtual std::wstring to_latex() const override
Returns:

the string representation of this in LaTeX format

inline iterator erase(const_iterator it)

overload base_type::erase

template<typename T>
inline iterator insert(const_iterator it, T &&value)

overload base_type::insert

inline virtual Expr::type_id_type type_id() const override

Computes and returns the derived type identifier

Note

this function must be overridden in the derived class

Returns:

the hash value for this Expr

inline virtual ExprPtr clone() const override

Note

- must be overridden in the derived class.

  • the default implementation throws an exception

Returns:

a clone of this object, i.e. an object that is equal to this

inline virtual void adjoint() override

adjoint of an Operator is a reversed string of the adjoints of its ops

template<template<typename, typename, typename ...Args> class Map, typename ...Args>
inline bool transform_indices(const Map<Index, Index, Args...> &index_map)

Replaces indices using the index map

Parameters:

index_map – maps Index to Index

Returns:

true if one or more indices changed

Pre:

indices are not tagged, or (if want to protect them from replacement) tagged with (int)0

Post:

indices that were replaced will be tagged with (int)0

const container::svector<std::wstring> &labels()
const container::svector<std::wstring> &labels()
virtual std::wstring_view label() const

See also

to_latex() for producing unique string representation

Returns:

object’s label. 2 objects that are not equal can return same label, i.e. the label does not identify the object uniquely. Thus labels can be viewed as immutable string tags that for some object types can be used for sorting and other purposes.

virtual std::wstring_view label() const

See also

to_latex() for producing unique string representation

Returns:

object’s label. 2 objects that are not equal can return same label, i.e. the label does not identify the object uniquely. Thus labels can be viewed as immutable string tags that for some object types can be used for sorting and other purposes.

Public Static Functions

static const container::svector<std::wstring> &labels()
Returns:

all possible values returned by label() for this operator type

Public Static Attributes

static constexpr Statistics statistics = S