flopscope.

flopscope.accounting.fftn_cost

flopscope.accounting.fftn_cost(shape)[flopscope source]

Weighted FLOP cost of an N-D complex FFT.

Parameters

shape:tuple[int, ...]

Shape of the array passed to the analytical cost formula.

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.

The multi-dimensional FFT is computed as successive 1-D FFTs along each axis. The cost along axis i is 5 * (N / d_i) * d_i * ceil(log2(d_i)) = 5 * N * ceil(log2(d_i)). Summing over axes gives 5 * N * sum(ceil(log2(d_i))).