Expand description
Statistics through the shared reductions and matrix products. Means and norms use the ordinary parallel folds. Variance makes two passes, without an array-sized buffer of deviations. No compensated sums or reproducibility rules are imposed.
Structs§
- Axes
- Groups the selected axes into one reduction axis, and keeps the other axes’ metadata. One axis, or consecutive axes, needs no copy. Nonconsecutive axes gather through the ordinary transpose plan.
Functions§
- average
- Weighted means. The two mappings broadcast
dataandweightsinto an array ofdims. Weights may be real or complex; a zero total weight gives the ordinary floating-point quotient. - covariance
- The covariance or correlation of a row-major
variables × observationsmatrix. The centered Gram product uses the same native/Accelerate product as linear algebra. Complex covariance conjugates the second variable. - histogram
- Counts in increasing bin edges. Bins include their lower edge and exclude their upper edge, except that the last bin includes both. Values outside the edges and NaNs aren’t counted.
- histogram_
edges - Equally spaced histogram edges, from the data’s extrema where no range is given. Constant data expands by 0.5 on each side; empty data uses 0 to 1.
- mean
- Means along the middle axis of
[outer, len, inner]. Empty lanes give NaN. - norm
- The elementwise p-norm along the selected axes: 0 counts nonzero values, ±infinity selects the greatest/least magnitude, and a finite p gives
(sum |x|^p)^(1/p). A pair of axes still gives this norm, not a matrix-induced norm. For p = 2, each square is computed and summed in f64, where an f32’s square neither overflows nor underflows. - stddev
- Standard deviations, the square roots of
variance. - variance
- Two-pass variances, real for complex data, with denominator
len - ddof. Empty lanes and nonpositive denominators give NaN.