Function sequant::subset_target_indices

Function Documentation

auto sequant::subset_target_indices(meta::range_of<Index, 2> auto const &rng, meta::range_of<Index> auto const &tixs, container::vector<char> const *connected = nullptr)

Determines the open indices for all subsets of a given range of index groups.

result[mask] is the set of atoms (see carried_atoms) that the subset of rng selected by mask keeps open (see open_atoms). The external indices are tixs plus the slot indices that occur once in rng, which are external even if undeclared; an index carried only as a protoindex cannot be inferred that way and must be in tixs to stay open where nothing else carries it. A singleton subset keeps all of its slots.

Parameters:
  • rng – A range of ranges of Index: the slots of each tensor. The $i$-th bit of a mask being set means the $i$-th group is in the subset.

  • tixs – A range of Index representing the global target indices (e.g., indices of the result tensor).

  • connected – Optional pruning mask: when non-null, only result[i] with (*connected)[i] set are computed, the rest are left empty.

Returns:

A vector of sets, where result[mask] contains the set of open Index objects for the subset defined by mask.