flopscope.

flopscope.accounting.svdvals_cost

flopscope.accounting.svdvals_cost(m, n, k=None)[flopscope source]

Weighted FLOP cost of computing singular values (values-only SVD).

Delegates to flopscope._flops.svd_cost with with_vectors=False: 2*a*b^2 + 2*b^3, a = max(m, n), b = min(m, n). Top-k (1 <= k < min(m, n)) bills min(4*m*n*k, that cost).

Parameters

m:int

Number of rows in the input matrix.

n:int

Number of columns in the input matrix.

k:int | None, optional

Target rank or number of singular components to estimate. 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.