flopscope.accounting.qr_cost
flopscope.accounting.qr_cost(m, n, mode='reduced')[flopscope source]
Weighted FLOP cost of QR decomposition (Householder, FMA=2).
Factorization (dgeqrf): 2*m*n*k - 2*k^3/3, k = min(m, n) (G&VL 4e §5.2). Modes "reduced"/"complete" additionally form Q explicitly (dorgqr), modeled as the same count again. Modes "r"/"raw" bill the factorization only.
Parameters
- m:int
Number of rows in the input matrix.
- n:int
Number of columns in the input matrix.
- mode:str, optional
Argument forwarded to the analytical linalg.qr cost formula. Defaults to
'reduced'.
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.