Repository navigation
Weights, tensors, fits, NUFFT routes and a terse namespace - #39
Merged
Merged
Conversation
Pair weights reach every lag route and point entry, with cell_measure(grid) for an area average. Moment tensors come off the transform on every separable schedule, with a joint tensor over angle and any order on point lists. One-dimensional point lists take an exact sorted route built on prefix sums of the monomials. Scattered points reach the transform engine through a soft-binned non-uniform FFT, with NonuniformFFTs and FINUFFT as providers on CPU and CUDA, and ModeBinEdges marking a result that is not hard-binned. Regularised fits invert binned structure functions to spectra and fluxes. The transverse convention is now a field of the projected operator, so every route takes its sign from one place, and each convention's first basis vector is odd under r -> -r, which unordered pairs require. Namespace: the package exports its own 24 names; everything else is reached through the submodule that owns it. "Channel" was signal-processing vocabulary for what the domain calls a field, so Channels is MultiFields throughout. Device: the transform's forward stage builds each monomial for every slab in one broadcast and transforms the slabs in one batch; the binning kernel launches each slab pair over its own lag box, which a schedule reports through uniform_lag_box. The slice-batch drivers now accept every velocity width their launchers specialize for, rather than refusing three-dimensional batches. Benchmarks: the thread-scaling harness pins its worker threads and reports the minimum of several runs. Without either, a 16-thread run landed on 8 cores as often as 16 and a single sample carried noise the size of the speedup, which read as a scaling collapse that was not there. Documentation is rebuilt against the code, with two wrong formulas in the theory page fixed and twenty-six figures regenerated.
This was referenced Nov 11, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds pair weights, moment tensors from the transform, regularised fits and a soft-binned non-uniform
FFT route for scattered points; renames
ChannelstoMultiFields; cuts the top-level exports from141 names to 24.
What this adds
cell_measure(grid)for an area average.any order on point lists.
so the cost stops scaling with the pair count.
ScatteredModesSchedule), with NonuniformFFTs andFINUFFT as providers on CPU and CUDA. The route is soft-binned and not exact at any finite mode
count; the result carries
ModeBinEdgesand it is selected only by passing the tag.SpectrumForwardModel,HelmholtzForwardModel,FluxForwardModelwithRegularizedLeastSquares,NonNegativeLeastSquaresor aSegmentedPowerLaw.E/Bsplit, and the third-order fluxcompanions with their boundary terms.
Breaking changes
owns it:
Calculationsfor the entries,StructureFunctionTypesfor the operators,HelperFunctionsfor the geometry,MultiFieldsforFields.ChannelsisMultiFields;ChannelIncrementisFieldIncrement;n_vector_channels,n_scalar_channelsandchannel_dimensionaren_vector_fields,n_scalar_fieldsandfield_dimension. "Channel" was signal-processing vocabulary for what the domain calls a field.ProjectedStructureFunctionType{NL,NT}(basis). Each convention's first basis vector is odd underr -> -r, which unordered pairs require;CoordinateGaugeTransverseBasisand the user-basisclosure wrappers are removed.
Fixes
T3andL2T1; no GPU test covered an odd transverse operator.D ∈ {2,3}.generate_assets.jlcould not run in its documented environment, so six figures were four monthsstale; the GPU asset collection read a field off a type that does not carry it.
made the numbers irreproducible: an unpinned 16-thread run landed on 8 cores as often as 16, and a
single sample carried noise the size of the speedup.
Performance
L2, A100 vs 8-thread CPUVerification
row.
checkdocs = :exportsandwarnonly = false, no warnings.Issues
Closes #38 — the transform engine: every polynomial operator at every lag as cross-correlations of
masked monomials, on uniform, stretched and lat-lon grids, on the CPU and on a device, with the
direct lag sweep kept as an independent route to check it against.
Closes #36 — the Pearson advective structure functions and their flux companions, with the
finite-range boundary terms. Two boundary terms are dimensionally inconsistent as printed in the
paper's appendix B; the consistent forms are the ones implemented, and the closed-form gates fail
without them.
Closes #25 — the KHM inversions (
KHM.epsilon_from_four_fifths,epsilon_from_four_thirds,epsilon_theta_from_yaglom) and full moment-tensor output of any rank, on point lists and off thetransform on every separable schedule, plus the joint tensor over angle.
Closes #24 — NaN and
Boolmasks on grids at every order, exact: the mask's own autocorrelationgives the pair counts and the masked monomials give the sums. Point lists carry no mask by design;
a non-finite sample makes the bins it pairs into NaN, and the caller filters with indexing.
Closes #18 —
RegularizedLeastSquaresandNonNegativeLeastSquaresonFluxForwardModelfor thecross-scale transfer from third-order functions, with posterior covariances and
tradeoff_curveforchoosing the prior. The Hankel machinery the issue asks after is in: the
J₁,J₂andJ₃fluxroutes and
isotropic_spectrum/helmholtz_spectraall go through it.Addresses #23 — the shared- and varying-position batch drivers do the point loop once and vectorise
along the trailing axis, on CPU (batch-leading
(B, D, N)buffers,Val(D)-specialised) and GPU(fused N-body launches, now for
D ∈ {2,3}), and(D, N, aux...)covers<x,y,z,t>swept over asubset by flattening the swept axes into
N. Not included: a gridded transform fused over atime axis. The gridded entries take one snapshot (
n_cells(schedule)columns), so many times meansmany calls. Leaving this open rather than claiming it.
Not touched by this PR: #37, which is a literature tracker.