Struct InlineContext

Nested Relationships

Nested Types

Struct Documentation

struct InlineContext

The definitions of a system of equations and the state of inlining them; see binarize(std::span<const ResultExpr>, const BinarizationOptions&).

Public Functions

inline InlineContext(std::span<const ResultExpr> system, container::svector<bool> &consumed)
Parameters:
  • system – the equations

  • consumed – receives true for every equation inlined somewhere

InlineContext(InlineContext const&) = delete
InlineContext &operator=(InlineContext const&) = delete
inline std::optional<TensorMatch> match(Tensor const &leaf) const
Throws:

Exception – if leaf matches a head but not its symmetries, or spells a conjugate-symmetric head swapped

Returns:

the equation whose tensor head leaf names, if any; a leaf that spells a bra-ket symmetric head with bra and ket swapped names it too, unless another head with its label matches it as written

inline std::optional<std::size_t> match(Variable const &leaf) const
Throws:

Exception – if leaf is conjugated and names a scalar head

Returns:

the equation whose scalar head leaf names, if any

inline EvalExprNode binarize_equation(std::size_t k, BinarizationOptions const &opts, std::size_t &node_counter)
Returns:

the tree of equation k, with every definition inlined

inline EvalExprNode inline_definition(std::size_t k, Tensor const *leaf, BinarizationOptions const &opts, bool swapped = false)
Returns:

the tree of equation k as a factor in place of leaf (null for a Variable leaf): its head’s indices renamed to leaf's (the head’s bra to the leaf’s ket and vice versa if swapped) and every other index of its rhs to a fresh one; not stamped with opts.node_batch_axes

struct TensorMatch

a Tensor leaf naming the head of equation k

Public Members

std::size_t k
bool swapped

the leaf spells the head with bra and ket swapped