flopscope.accounting.matrix_norm_cost
flopscope.accounting.matrix_norm_cost(shape, ord=None)[flopscope source]
Weighted FLOP cost of matrix norm.
Parameters
- shape:tuple
Shape of the array passed to the analytical cost formula.
- ord:object, optional
Argument forwarded to the analytical linalg.matrix_norm cost formula. Defaults to
None.
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.
Elementwise norms (Frobenius, L1, Linf):
numel(weight=1 baked in).SVD-based norms (2-norm, nuclear):
4 * m * n * min(m, n)(weight=4 baked in, consistent with linalg.svd weight=4).