Function sequant::contracted_indices

Function Documentation

inline Index::index_vector sequant::contracted_indices(meta::eval_node auto const &node)

The indices contracted at a binary evaluation node.

These are the indices present in both children’s (canonical) result indices but absent from the node’s own result indices — i.e. the indices summed over by this node’s product. Empty for leaves, for sums, and for products with no contracted index (e.g. a pure outer/Hadamard product).

Each such index K is a valid axis to evaluate the subtree rooted at node in batches: the node computes R = sum_K f(K), so R = sum_{blocks b} sum_{K in b} f(K) — evaluating per-block and summing bounds the peak memory of K-carrying intermediates in the subtree. A custom evaluator (see CacheManager::custom_evaluator_type) can use this to implement batched evaluation.