flopscope.accounting.multi_dot_cost
flopscope.accounting.multi_dot_cost(shapes)[flopscope source]
Weighted FLOP cost of optimal matrix chain multiplication.
Parameters
- shapes:Sequence[Sequence[int]]
Operand shapes in the same order as the einsum operands.
Returns
- :int
Weighted public cost estimate, floored to match runtime accounting.
Notes
This helper multiplies the analytical FLOP count by the active weight from flopscope._weights and then applies int(...) so public estimates match budget deductions.
Uses dynamic programming for optimal parenthesization. Source: Cormen et al., Introduction to Algorithms (CLRS), §15.2.