Struct WickTheorem::NontensorWickState

Nested Relationships

This struct is a nested type of Template Class WickTheorem.

Struct Documentation

struct NontensorWickState

carries state down the stack of recursive calls

Public Functions

template<typename T>
inline auto uptri_nop(T i, T j) const
template<typename T>
inline auto uptri_op(T i, T j) const
inline NontensorWickState(const WickTheorem<S> &wt, const NormalOperatorSequence<S> &nopseq)
NontensorWickState(const NontensorWickState&) = delete
NontensorWickState(NontensorWickState&&) = delete
NontensorWickState &operator=(const NontensorWickState&) = delete
NontensorWickState &operator=(NontensorWickState&&) = delete
inline auto make_target_partner_indices() const

“applies” this->contractions to the partner index pairs from this->wick.input_partner_indices_ to produce the current target list of partner indices

Returns:

std::pair {target_partner_indices, ncycles}, where target_partner_indices is the current target list of partner indices and ncycles is the number of contraction cycles

inline void init_topological_partitions()
template<typename Cursor>
inline bool connect(const container::svector<std::bitset<max_input_size>> &target_nop_connections, const container::svector<std::bitset<max_input_size>> &avoided_nop_connections, const Cursor &op1_cursor, const Cursor &op2_cursor)

Updates connectivity if contraction satisfies target connectivity.

If the target connectivity will be violated by this contraction, keep the state unchanged and return false. Also rejects contractions between operator pairs specified via set_nop_avoided_connections().

template<typename Cursor>
inline void disconnect(const container::svector<std::bitset<max_input_size>> &target_nop_connections, const Cursor &op1_cursor, const Cursor &op2_cursor)

Updates connectivity when contraction is reversed.

Public Members

const WickTheorem<S> &wick

the WickTheorem object using this

NormalOperatorSequence<S> nopseq

current state of operator sequence

std::size_t nopseq_size

current size of nopseq

Context ctx

current context

Product sp

current prefactor

std::size_t sp_initial_size = 0

size of prefactor at the start

container::svector<std::pair<Op<S>, Op<S>>> contractions

current list of indices of contracted {qpann,qpcre} ops

int level

level in recursive wick call stack

size_t left_op_offset

where to start looking for contractions (ordinal in the current state of nopseq)

bool count_only

if true, only track the total number of summands in the result (i.e. 1 (the normal product) + the number of contractions (if normal wick result is wanted) or the number of complete constractions (if want complete contractions only)

std::atomic<size_t> count

if count_only is true, will count the total number of terms

container::svector<std::bitset<max_input_size>> nop_connections

bitmask of connections for each nop (1 = connected)

container::svector<size_t> nop_adjacency_matrix

number of connections between each nop, only lower triangle is kept

container::svector<size_t> nop_nconnections

for each NormalOperator specifies how many connections it currently has

Note

exists to avoid the need to traverse nop_adjacency_matrix

container::svector<container::set<size_t>> nop_partitions

current state of nop partitions (will only match contents of nop_to_partition before any contractions have occurred)

  • when a normal operator is connected it’s removed from the partition

  • when it is disconnected fully it’s re-added to the partition

container::svector<size_t> op_partition_cdeg_matrix

contraction degree (number of contractions) between each topologically-equivalent group of Op

container::svector<size_t> op_partition_ncontractions

for each Op

Public Static Functions

template<typename T>
static inline auto ntri(T n)
Returns:

the number of elements in a lower triangle of an n by n matrix

template<typename T>
static inline auto lowtri_idx(T i, T j)
template<typename T, typename U>
static inline auto uptri_idx(T i, T j, U n)