Skip to content

beamax.coefficients

Coefficient selection without materialising the full MSWPT frame.

beamax.coefficients

Memory-bounded exact top-k selection for MSGB's MSWPT analysis.

streamed_top_n_coefficients(data: jax.Array, wpt: MSWPT, *, top_n: int, input_type: str = 'spatial', positive_half: bool = False, scale: Scalar = 1.0, boxes_per_chunk: int = 8) -> tuple[jax.Array, jax.Array]

Select exact top-n scaled MSWPT coefficients without materializing them.

Parameters:

Name Type Description Default
data (Array, shape(*N))

Spatial data, or an already centred Fourier array when input_type="fourier".

required
wpt MSWPT

Transform whose filters, coefficient layout, and canonical dual are used for the analysis.

required
top_n int

Requested number of retained coefficients. It is clamped to the selected frame capacity, matching the configured top-n threshold.

required
input_type ('spatial', 'fourier')

Domain of data.

"spatial"
positive_half bool

Visit the first half of every level's coefficient segment rather than the complete signed frame.

False
scale scalar

Scalar applied before ranking and returning coefficient values.

1.0
boxes_per_chunk int

Static number of local Fourier boxes analysed together.

8

Returns:

Type Description
indices, values : tuple[jax.Array, jax.Array]

Global flat coefficient indices and scaled complex values. Rows are ordered by ascending (abs(value), index). At the top-n cutoff, equal magnitudes retain the lower global flat index.

Notes

Selection state is \(\mathcal{O}(\mathtt{top\_n})\) beyond the Fourier array and one box chunk.