Template Function sequant::left_to_right_binarization_indices

Function Documentation

template<typename T, typename Set = std::set<T>>
auto sequant::left_to_right_binarization_indices(meta::range_of<Set> auto const &rng, Set const &uncontract)

Calculates index sets for a left-to-right contraction sequence.

This function simulates a left-to-right contraction of a sequence of tensors. It determines which indices in the input tensors are relevant (participate in contraction or are external) and computes the index sets of the intermediate results.

Note

  • The ‘uncontract’ indices are only necessary to mark those indices that appear in more than one set from ‘rng’.

  • Indices that appear exactly once in the sets from ‘rng’ are always uncontracted (or external). The term ‘uncontract’ implies some indices tend to ‘contract-out’ because they repeat, but we force them to survive.

  • Passing non-repeating indices in ‘uncontract’ does not change the behavior of the algorithm. Neither will passing indices that do not appear in any of the sets from ‘rng’.

Template Parameters:
  • T – The type of the index.

  • Set – The type of the set container.

Parameters:
  • rng – A range of index sets representing the input tensors.

  • uncontract – The set of indices that should remain in the final result (external indices).

Returns:

LTRUncontractedIndices<T, Set> containing the filtered children indices and intermediate indices.