Template Function sequant::opt::detail::inner_aware_volume

Function Documentation

template<typename Tot, typename Ixex, typename InnerPow>
double sequant::opt::detail::inner_aware_volume(Tot const &tot_idxs, Ixex const &ixex, InnerPow const &inner_pow)

Composite-aware extent product of a tot_indices split.

Multiplies the extents of the outer indices (via ixex) by the extents of the inner (CSV/PNO tensor-of-tensor) composites. Shared by all cost counters (flops_counter, memsize_counter, footprint_counter) so every objective sizes CSV/PNO composites identically.

Note

When inner_pow is empty, composites fall back to ixex (i.e. k=1), reproducing a single grid-averaged extent per composite, which under-counts multi-composite tensors: for heavy-tailed domains the mean of d^k far exceeds the k-th power of the mean of d.

Parameters:
  • tot_idxs – a tot_indices split (outer plus inner composites).

  • ixex – invocable mapping an Index to its extent (sizes outer and, when inner_pow is empty, inner too).

  • inner_pow – optional invocable (composite, k) -> double giving the size of a composite that shares its proto-index set with k composites in the same tensor (the k-th power mean of the per-pair domain). When non-empty, composites are grouped by proto-index set and each member of a k-group is sized by inner_pow(composite, k); the outer nocc^N times the group product then equals the true block-sparse volume Sum_pairs d^k.

Returns:

the extent product (element count).