Skip to content

stats #

vtl.stats

Descriptive statistics and reductions over tensor elements. The API includes sum/product, mean and means, median/mode, population and sample variance and standard deviation, extrema and indices, covariance, quantiles, skewness, kurtosis, and lag-one autocorrelation. Axis helpers are also available for selected reductions.

ptp returns the peak-to-peak range (maximum minus minimum) for integer and floating-point tensors. ptp_along_axis reduces one axis, while ptp_along_axes reduces several axes with optional keepdims. Negative axes are supported; duplicate axes, empty reduced dimensions, and empty global inputs return errors. An empty axes list returns zeros elementwise. Results preserve the input element type, including integer overflow behavior. Multi-axis reductions fuse minimum and maximum in one pass; contiguous trailing f32 and f64 reductions use portable SIMD blocks.

prod follows the multiplicative identity convention: an empty input reduces to 1, while an empty sum reduces to 0.

sum_along_axis and product_along_axis return tensors for a selected axis. Pass true for keepdims to retain that axis with length one; negative axes are accepted. Empty reduction axes return the corresponding identity for every output slice.

Use sum_as[T, U], product_as[T, U], and the _along_axis_as or _along_axes_as variants to choose accumulator/output type U explicitly. For example, summing an f32 tensor into f64 reduces rounding error during accumulation. These APIs currently cover sum and product; other reductions keep their documented output types.

For floating-point inputs, sum_accurate uses Neumaier compensation to retain small contributions that a faster reduction may round away. It returns the input floating-point type; use sum_as to select a wider output type. Other input types keep the regular sum behavior.

average_axis keeps its reduced axis with length one. Use average_along_axis(..., keepdims) to choose whether to keep or remove it; weights may match the input or be a vector matching the selected axis. average_along_axes reduces several axes with explicit keepdims and requires weights with the same shape as the input.

trapezoid, trapezoid_axis, and trapezoid_x_axis integrate numeric tensors with the composite trapezoidal rule and return f64 tensors with the reduced axis removed. Explicit sample coordinates remain in their given order.

gradient_axis estimates the numerical derivative along one axis using uniform sample spacing. It preserves the input shape, accepts negative axes, uses centered differences for interior points, and uses first-order one-sided differences at the boundaries. gradient_axis_with_coordinates accepts strictly monotonic non-uniform sample coordinates and uses first-order boundary differences. gradient_axis_with_coordinates_edge_order selects first- or second-order boundary differences explicitly. All gradient functions preserve the input shape and support negative axes. See the gradient example.

NaN-aware reductions nansum, nanprod, nanmin, and nanmax ignore NaN values and promote results to f64. Their _axis variants reduce one axis and remove it; _axis_keepdims variants retain it with length one. Empty or all-NaN sums and products use identities 0 and 1. Empty or all-NaN minima and maxima return NaN.

histogram(data, bins) infers a finite range from any numeric tensor and returns a Histogram with counts and bin_edges. Empty input uses [0, 1]; constant input expands by 0.5 at each end. histogram_range(data, bins, minimum, maximum) uses explicit finite increasing bounds, ignores values outside them, and includes the final right edge, matching NumPy's convention. histogram_auto(data, rule) chooses a bin count using Sturges, Doane, square-root, Rice, Scott, Freedman-Diaconis, Stone, or the NumPy-style automatic maximum of Sturges and Freedman-Diaconis. Stone minimizes the cross-validated integrated squared error over candidate counts up to max(100, floor(sqrt(n))). Degenerate estimates fall back to Sturges. For constant input, the Stone rule returns one bin over the expanded range.

histogram2d(x, y, bins_x, bins_y) counts paired one-dimensional samples in a grid indexed as [x_bin, y_bin], matching NumPy's histogram2d orientation. Use histogram2d_edges for explicit edges on each axis. The density variants normalize the in-range samples so density times bin area sums to one; histogram2d_weighted and histogram2d_weighted_edges also support numeric weights and weighted density.

histogramdd(sample, bins) accepts a [samples, dimensions] tensor and a bin count per dimension. histogramdd_edges accepts explicit increasing edge vectors for each dimension. Weighted variants return weighted counts or, with density: true, normalize by the total in-range weight and full N-dimensional bin volumes. Points outside any axis range are excluded. All variants include the right edge of each axis's final bin, and results use row-major bin order. See the N-dimensional histogram example.

bincount(input, minlength) counts non-negative integer labels in a vector; bincount_weighted(input, weights, minlength) sums numeric weights for each label. Both return vectors sized to at least minlength.

import vtl
import vtl.stats

values := vtl.from_1d[f64]([1.0, 2.0, 3.0, 4.0])!
average := stats.mean[f64](values)
spread := stats.sample_stddev[f64](values)
row_total := stats.sum_along_axis[f64](values, -1, true)!

The legacy quantile helper expects sorted input. The *_with_method APIs sort a copy and support all thirteen NumPy estimators through QuantileMethod, including global, multi-quantile, axis, percentile, and NaN-ignoring forms, including multi-axis reductions. Axis quantiles accept keepdims; multi-quantile results prepend the quantile dimension. See stats.v and quantile_methods.v and quantile_multi_axes.v for edge-case behavior and the reductions tutorial.

Weighted quantiles and percentiles use NumPy's inverted_cdf estimator. Global weights match the input shape; one-axis forms accept full-shape weights or a vector for the reduced axis. Multi-axis forms accept full-shape weights or a compact tensor whose dimensions follow the supplied axes order. The nanquantile_weighted* and nanpercentile_weighted* variants omit NaN values and their corresponding weights. Multi-axis weighted multi-quantile and multi-percentile APIs also provide *_axes_keepdims forms to retain each reduced axis after the leading quantile dimension.

median accepts unsorted tensors, uses linear interpolation, and returns f64 for every input type. An empty tensor returns NaN.

nanmedian ignores NaN values and returns NaN for empty or all-NaN inputs. nanmedian_axis keeps the reduced dimension; nanmedian_axis_squeeze removes it.

mean_along_axes, variance_along_axes, and std_along_axes reduce multiple axes in one pass, with matching NaN-ignoring nan*_along_axes variants. All accept keepdims; variance and standard deviation accept ddof.

percentile_axis and nanpercentile_axis accept percentiles on the 0..100 scale. Their _squeeze variants remove the reduced axis; the base variants keep it with length one. percentiles_linear and percentiles_axis accept multiple requested values and prepend the percentile dimension to their results; nanpercentiles_* counterparts ignore NaNs.

fn absdev #

@[inline]
fn absdev[T](t &vtl.Tensor[T]) T

absdev exposes this operation as part of the public API.

fn absdev_mean #

fn absdev_mean[T](t &vtl.Tensor[T], provided_mean T) T

Measure of Dispersion / Spread Mean Absolute Deviation of the given input array Based on https://en.wikipedia.org/wiki/Average_absolute_deviation

fn average #

fn average[T, W](values &vtl.Tensor[T], weights &vtl.Tensor[W]) !f64

average returns the weighted mean of tensors with identical shapes.

fn average_along_axes #

fn average_along_axes[T, W](values &vtl.Tensor[T], weights &vtl.Tensor[W], axes []int, keepdims bool) !&vtl.Tensor[f64]

average_along_axes computes weighted means over multiple axes. Weights must have the same shape as values. Reduced dimensions follow keepdims.

fn average_along_axis #

fn average_along_axis[T, W](values &vtl.Tensor[T], weights &vtl.Tensor[W], axis int, keepdims bool) !&vtl.Tensor[f64]

average_along_axis computes weighted means along one axis. It preserves the reduced axis when keepdims is true and removes it otherwise.

fn average_axis #

fn average_axis[T, W](values &vtl.Tensor[T], weights &vtl.Tensor[W], axis int) !&vtl.Tensor[f64]

average_axis computes weighted means per slice and retains the reduced axis with length one. Weights may match the input shape or be a vector matching the selected axis length.

fn bincount #

fn bincount[T](input &vtl.Tensor[T], minlength int) !&vtl.Tensor[int]

bincount counts occurrences of each non-negative integer in a vector. The output length is max(input)+1 or minlength, whichever is larger.

fn bincount_weighted #

fn bincount_weighted[T, W](input &vtl.Tensor[T], weights &vtl.Tensor[W], minlength int) !&vtl.Tensor[f64]

bincount_weighted sums one weight per non-negative integer input value. It follows NumPy's weighted bincount shape and minlength rules.

fn complex_mean_along_axes #

fn complex_mean_along_axes(t &vtl.Tensor[complex.Complex], axes []int, keepdims bool) !&vtl.Tensor[complex.Complex]

complex_mean_along_axes computes the arithmetic mean over several axes.

fn complex_mean_along_axis #

fn complex_mean_along_axis(t &vtl.Tensor[complex.Complex], axis int, keepdims bool) !&vtl.Tensor[complex.Complex]

complex_mean_along_axis computes the arithmetic mean along one axis. The output remains complex128 and follows the requested keepdims shape.

fn complex_std_along_axes #

fn complex_std_along_axes(t &vtl.Tensor[complex.Complex], axes []int, ddof int, keepdims bool) !&vtl.Tensor[f64]

complex_std_along_axes computes the square root of complex variance over axes.

fn complex_std_along_axis #

fn complex_std_along_axis(t &vtl.Tensor[complex.Complex], axis int, ddof int, keepdims bool) !&vtl.Tensor[f64]

complex_std_along_axis computes the square root of complex variance.

fn complex_variance_along_axes #

fn complex_variance_along_axes(t &vtl.Tensor[complex.Complex], axes []int, ddof int, keepdims bool) !&vtl.Tensor[f64]

complex_variance_along_axes computes real E(|z-mean(z)|^2) over several axes.

fn complex_variance_along_axis #

fn complex_variance_along_axis(t &vtl.Tensor[complex.Complex], axis int, ddof int, keepdims bool) !&vtl.Tensor[f64]

complex_variance_along_axis computes the real variance E(|z-mean(z)|^2). ddof is subtracted from the observation count; insufficient samples produce NaN.

fn covariance #

@[inline]
fn covariance[T](a &vtl.Tensor[T], b &vtl.Tensor[T]) T

covariance exposes this operation as part of the public API.

fn covariance_mean #

fn covariance_mean[T](a &vtl.Tensor[T], b &vtl.Tensor[T], mean1 T, mean2 T) T

Compute the covariance of a dataset using the recurrence relation

fn freq #

fn freq[T](t &vtl.Tensor[T], val T) int

Measure of Occurrence Frequency of a given number Based on https://www.mathsisfun.com/data/frequency-distribution.html

fn geometric_mean #

fn geometric_mean[T](t &vtl.Tensor[T]) T

Measure of Central Tendency Geometric Mean of the given input array Based on https://www.mathsisfun.com/numbers/geometric-mean.html

fn gradient_axis #

fn gradient_axis[T](t &vtl.Tensor[T], spacing f64, axis int) !&vtl.Tensor[f64]

gradient_axis computes the numerical gradient along one tensor axis using uniform sample spacing. Interior points use centered differences and the two boundaries use first-order one-sided differences. The output keeps the input shape and uses f64 elements.

fn gradient_axis_with_coordinates #

fn gradient_axis_with_coordinates[T](t &vtl.Tensor[T], coordinates []f64, axis int) !&vtl.Tensor[f64]

gradient_axis_with_coordinates computes a numerical gradient along one tensor axis using the supplied sample coordinates and first-order boundary differences. Coordinates may be non-uniform, but must be strictly monotonic.

fn gradient_axis_with_coordinates_edge_order #

fn gradient_axis_with_coordinates_edge_order[T](t &vtl.Tensor[T], coordinates []f64, axis int, edge_order int) !&vtl.Tensor[f64]

gradient_axis_with_coordinates_edge_order computes a numerical gradient along one tensor axis using the supplied sample coordinates. edge_order selects first- or second-order one-sided differences at the boundaries.

fn harmonic_mean #

fn harmonic_mean[T](t &vtl.Tensor[T]) T

Measure of Central Tendency Harmonic Mean of the given input array Based on https://www.mathsisfun.com/numbers/harmonic-mean.html

fn histogram #

fn histogram[T](data &vtl.Tensor[T], bins int) !Histogram

histogram computes a NumPy-style histogram with evenly spaced bins. The range is inferred from finite data; empty input uses [0, 1], and a constant input expands its range by 0.5 on each side.

fn histogram2d #

fn histogram2d[X, Y](x &vtl.Tensor[X], y &vtl.Tensor[Y], bins_x int, bins_y int) !Histogram2D

histogram2d computes a NumPy-style two-dimensional histogram. Inputs are flattened in logical order. Empty inputs use [0, 1] on both axes; constant inputs expand by 0.5 on either side.

fn histogram2d_density #

fn histogram2d_density[X, Y](x &vtl.Tensor[X], y &vtl.Tensor[Y], bins_x int, bins_y int) !WeightedHistogram2D

histogram2d_density returns a probability density whose integral over the returned bin areas is one. Samples outside the inferred range are excluded.

fn histogram2d_density_edges #

fn histogram2d_density_edges[X, Y](x &vtl.Tensor[X], y &vtl.Tensor[Y], x_edges []f64, y_edges []f64) !WeightedHistogram2D

histogram2d_density_edges computes a density over explicit bin edges.

fn histogram2d_edges #

fn histogram2d_edges[X, Y](x &vtl.Tensor[X], y &vtl.Tensor[Y], x_edges []f64, y_edges []f64) !Histogram2D

histogram2d_edges counts paired values using strictly increasing bin edges. Values outside either edge range are ignored; the last bin includes its right edge. The returned count tensor has shape [x_bins, y_bins].

fn histogram2d_weighted #

fn histogram2d_weighted[X, Y, W](x &vtl.Tensor[X], y &vtl.Tensor[Y], weights &vtl.Tensor[W], bins_x int, bins_y int, density bool) !WeightedHistogram2D

histogram2d_weighted computes weighted counts or a probability density using uniformly spaced bins inferred from the paired input values.

fn histogram2d_weighted_edges #

fn histogram2d_weighted_edges[X, Y, W](x &vtl.Tensor[X], y &vtl.Tensor[Y], weights &vtl.Tensor[W], x_edges []f64, y_edges []f64, density bool) !WeightedHistogram2D

histogram2d_weighted_edges accumulates one numeric weight per paired value. With density enabled, the sum of density times each bin's area is one.

fn histogram_auto #

fn histogram_auto[T](data &vtl.Tensor[T], rule HistogramBinRule) !Histogram

histogram_auto chooses an evenly spaced bin count from the data. The automatic rule uses the larger of Sturges and Freedman-Diaconis estimates, falling back to Sturges when the interquartile range is zero.

fn histogram_edges #

fn histogram_edges[T](data &vtl.Tensor[T], edges []f64) !Histogram

histogram_edges computes unweighted counts using explicit, strictly increasing bin edges. The final bin includes its right edge.

fn histogram_range #

fn histogram_range[T](data &vtl.Tensor[T], bins int, minimum f64, maximum f64) !Histogram

histogram_range computes evenly spaced bins over [minimum, maximum]. Values outside the range are ignored; the final bin includes its right edge.

fn histogram_weighted_edges #

fn histogram_weighted_edges[T, W](data &vtl.Tensor[T], weights &vtl.Tensor[W], edges []f64, density bool) !WeightedHistogram

histogram_weighted_edges accumulates one numeric weight per input value using explicit bin edges. With density enabled, the weighted result is normalized so the sum of density times bin width is one.

fn histogramdd #

fn histogramdd[T](sample &vtl.Tensor[T], bins []int) !HistogramDD

histogramdd computes a NumPy-style N-dimensional histogram with one uniformly spaced bin count per sample dimension. Empty dimensions use [0, 1] as their inferred range; constant dimensions expand by 0.5 on either side.

fn histogramdd_density #

fn histogramdd_density[T](sample &vtl.Tensor[T], bins []int) !WeightedHistogramDD

histogramdd_density computes the probability density for inferred uniform bins. Density integrates to one across all included samples.

fn histogramdd_density_edges #

fn histogramdd_density_edges[T](sample &vtl.Tensor[T], edges [][]f64) !WeightedHistogramDD

histogramdd_density_edges computes a probability density using explicit edges. Points outside the edge ranges are excluded from normalization.

fn histogramdd_edges #

fn histogramdd_edges[T](sample &vtl.Tensor[T], edges [][]f64) !HistogramDD

histogramdd_edges counts sample rows using one strictly increasing edge vector per dimension. Points outside any edge range or containing NaN are ignored; each dimension's final bin includes its right edge.

fn histogramdd_weighted #

fn histogramdd_weighted[T, W](sample &vtl.Tensor[T], weights &vtl.Tensor[W], bins []int, density bool) !WeightedHistogramDD

histogramdd_weighted computes weighted counts or density with inferred uniform edges. Density integrates to one over the N-dimensional bin volumes.

fn histogramdd_weighted_edges #

fn histogramdd_weighted_edges[T, W](sample &vtl.Tensor[T], weights &vtl.Tensor[W], edges [][]f64, density bool) !WeightedHistogramDD

histogramdd_weighted_edges accumulates one finite weight per sample row. When density is true, each count is divided by total weight and bin volume.

fn kurtosis #

@[inline]
fn kurtosis[T](t &vtl.Tensor[T]) T

kurtosis exposes this operation as part of the public API.

fn kurtosis_mean_stddev #

fn kurtosis_mean_stddev[T](t &vtl.Tensor[T], mean T, sd T) T

Takes a dataset and finds the kurtosis using the fourth moment the deviations, normalized by the sd

fn lag1_autocorrelation #

@[inline]
fn lag1_autocorrelation[T](t &vtl.Tensor[T]) T

lag1_autocorrelation exposes this operation as part of the public API.

fn lag1_autocorrelation_mean #

fn lag1_autocorrelation_mean[T](t &vtl.Tensor[T], provided_mean T) T

Compute the lag-1 autocorrelation of a dataset using the recurrence relation

fn max #

fn max[T](t &vtl.Tensor[T]) T

Maximum of the given input array

fn max_index #

fn max_index[T](t &vtl.Tensor[T]) int

Maximum of the given input array

fn mean #

fn mean[T](t &vtl.Tensor[T]) T

Measure of Central Tendency Mean of the given input array Based on https://www.mathsisfun.com/data/central-measures.html

fn mean_along_axes #

fn mean_along_axes[T](t &vtl.Tensor[T], axes []int, keepdims bool) !&vtl.Tensor[f64]

mean_along_axes computes a mean over several axes. With keepdims, each reduced axis remains in the output with length one. An empty axes list returns elementwise means, matching NumPy's axis=() behavior.

fn mean_along_axes_as #

fn mean_along_axes_as[T, U](t &vtl.Tensor[T], axes []int, keepdims bool) !&vtl.Tensor[U]

mean_along_axes_as computes the mean over several axes using U for accumulation and output. An empty axes list converts each value to U.

fn mean_along_axis #

fn mean_along_axis[T](t &vtl.Tensor[T], axis int, keepdims bool) !&vtl.Tensor[f64]

mean_along_axis computes means along axis and optionally removes that axis.

fn mean_along_axis_as #

fn mean_along_axis_as[T, U](t &vtl.Tensor[T], axis int, keepdims bool) !&vtl.Tensor[U]

mean_along_axis_as computes the mean along one axis using U for accumulation and output. The reduced axis is retained when keepdims is true.

fn mean_as #

fn mean_as[T, U](t &vtl.Tensor[T]) U

mean_as computes the mean using U for accumulation and the returned value. Empty floating-point inputs return NaN; empty integer inputs return zero.

fn mean_axis #

fn mean_axis[T](t &vtl.Tensor[T], axis int) !&vtl.Tensor[f64]

mean_axis computes the arithmetic mean along axis and retains that axis with length one. NaNs propagate to the corresponding output slice.

fn median #

fn median[T](t &vtl.Tensor[T]) f64

median returns the linearly interpolated median of the tensor values. Input values can be in any order; integer tensors return an f64 so even-sized inputs can have fractional medians. Empty inputs return NaN.

fn median_axes #

fn median_axes[T](t &vtl.Tensor[T], axes []int, keepdims bool) !&vtl.Tensor[f64]

median_axes computes medians over multiple axes with optional retained reduced dimensions. The estimator matches NumPy's default linear method.

fn median_axis #

fn median_axis[T](t &vtl.Tensor[T], axis int) !&vtl.Tensor[f64]

median_axis returns the linearly interpolated median per axis slice and retains the reduced axis with length one.

fn median_axis_keepdims #

fn median_axis_keepdims[T](t &vtl.Tensor[T], axis int, keepdims bool) !&vtl.Tensor[f64]

median_axis_keepdims controls whether the reduced axis remains at length one.

fn median_axis_squeeze #

fn median_axis_squeeze[T](t &vtl.Tensor[T], axis int) !&vtl.Tensor[f64]

median_axis_squeeze removes the reduced axis from the median result.

fn min #

fn min[T](t &vtl.Tensor[T]) T

Minimum of the given input array

fn min_index #

fn min_index[T](t &vtl.Tensor[T]) int

Minimum of the given input array

fn minmax #

fn minmax[T](t &vtl.Tensor[T]) (T, T)

Minimum and maximum of the given input array

fn minmax_index #

fn minmax_index[T](t &vtl.Tensor[T]) (int, int)

Minimum and maximum of the given input array

fn mode #

fn mode[T](t &vtl.Tensor[T]) T

Measure of Central Tendency Mode of the given input array Based on https://www.mathsisfun.com/data/central-measures.html

fn nanmax #

fn nanmax[T](t &vtl.Tensor[T]) f64

nanmax returns the maximum non-NaN element, or NaN if none exists.

fn nanmax_axes #

fn nanmax_axes[T](t &vtl.Tensor[T], axes []int, keepdims bool) !&vtl.Tensor[f64]

nanmax_axes reduces multiple axes to their maximum, ignoring NaN values. Slices containing no non-NaN values produce NaN.

fn nanmax_axis #

fn nanmax_axis[T](t &vtl.Tensor[T], axis int) !&vtl.Tensor[f64]

nanmax_axis reduces one axis and removes it from the result shape. Slices containing no non-NaN values produce NaN.

fn nanmax_axis_keepdims #

fn nanmax_axis_keepdims[T](t &vtl.Tensor[T], axis int) !&vtl.Tensor[f64]

nanmax_axis_keepdims reduces one axis and keeps it with length one.

fn nanmean #

fn nanmean[T](t &vtl.Tensor[T]) f64

nanmean computes the arithmetic mean while ignoring NaN values. It returns NaN when the tensor contains no non-NaN values.

fn nanmean_along_axes #

fn nanmean_along_axes[T](t &vtl.Tensor[T], axes []int, keepdims bool) !&vtl.Tensor[f64]

nanmean_along_axes computes means over several axes while ignoring NaNs.

fn nanmean_along_axes_as #

fn nanmean_along_axes_as[T, U](t &vtl.Tensor[T], axes []int, keepdims bool) !&vtl.Tensor[U]

nanmean_along_axes_as computes a NaN-ignoring mean over several axes using U.

fn nanmean_along_axis #

fn nanmean_along_axis[T](t &vtl.Tensor[T], axis int, keepdims bool) !&vtl.Tensor[f64]

nanmean_along_axis computes NaN-ignoring means and optionally removes axis.

fn nanmean_along_axis_as #

fn nanmean_along_axis_as[T, U](t &vtl.Tensor[T], axis int, keepdims bool) !&vtl.Tensor[U]

nanmean_along_axis_as computes a NaN-ignoring mean along one axis using U.

fn nanmean_as #

fn nanmean_as[T, U](t &vtl.Tensor[T]) U

nanmean_as computes a mean while ignoring NaNs, using U for accumulation and output. An empty or all-NaN tensor returns NaN for floating-point U.

fn nanmean_axis #

fn nanmean_axis[T](t &vtl.Tensor[T], axis int) !&vtl.Tensor[f64]

nanmean_axis computes means along axis and retains the reduced dimension as length one. NaN-only slices produce NaN.

fn nanmedian #

fn nanmedian[T](t &vtl.Tensor[T]) f64

nanmedian returns the median of non-NaN values as f64. Empty and all-NaN inputs return NaN.

fn nanmedian_axes #

fn nanmedian_axes[T](t &vtl.Tensor[T], axes []int, keepdims bool) !&vtl.Tensor[f64]

nanmedian_axes computes NaN-ignoring medians over multiple axes with optional retained reduced dimensions.

fn nanmedian_axis #

fn nanmedian_axis[T](t &vtl.Tensor[T], axis int) !&vtl.Tensor[f64]

nanmedian_axis computes the NaN-ignoring median per axis slice and retains the reduced axis with length one.

fn nanmedian_axis_keepdims #

fn nanmedian_axis_keepdims[T](t &vtl.Tensor[T], axis int, keepdims bool) !&vtl.Tensor[f64]

nanmedian_axis_keepdims controls whether the reduced axis remains at length one.

fn nanmedian_axis_squeeze #

fn nanmedian_axis_squeeze[T](t &vtl.Tensor[T], axis int) !&vtl.Tensor[f64]

nanmedian_axis_squeeze computes the NaN-ignoring median per axis slice and removes the reduced axis from the result shape.

fn nanmin #

fn nanmin[T](t &vtl.Tensor[T]) f64

nanmin returns the minimum non-NaN element, or NaN if none exists.

fn nanmin_axes #

fn nanmin_axes[T](t &vtl.Tensor[T], axes []int, keepdims bool) !&vtl.Tensor[f64]

nanmin_axes reduces multiple axes to their minimum, ignoring NaN values. Slices containing no non-NaN values produce NaN.

fn nanmin_axis #

fn nanmin_axis[T](t &vtl.Tensor[T], axis int) !&vtl.Tensor[f64]

nanmin_axis reduces one axis and removes it from the result shape. Slices containing no non-NaN values produce NaN.

fn nanmin_axis_keepdims #

fn nanmin_axis_keepdims[T](t &vtl.Tensor[T], axis int) !&vtl.Tensor[f64]

nanmin_axis_keepdims reduces one axis and keeps it with length one.

fn nanpercentile_axes #

fn nanpercentile_axes[T](t &vtl.Tensor[T], percentile f64, axes []int, keepdims bool) !&vtl.Tensor[f64]

nanpercentile_axes is the NaN-aware 0..100 percentile form.

fn nanpercentile_axes_with_method #

fn nanpercentile_axes_with_method[T](t &vtl.Tensor[T], percentile f64, axes []int, method QuantileMethod, keepdims bool) !&vtl.Tensor[f64]

nanpercentile_axes_with_method is the NaN-aware multi-axis percentile form.

fn nanpercentile_axis #

fn nanpercentile_axis[T](t &vtl.Tensor[T], percentile f64, axis int) !&vtl.Tensor[f64]

nanpercentile_axis computes a NaN-ignoring percentile per axis slice and retains the reduced axis with length one.

fn nanpercentile_axis_squeeze #

fn nanpercentile_axis_squeeze[T](t &vtl.Tensor[T], percentile f64, axis int) !&vtl.Tensor[f64]

nanpercentile_axis_squeeze removes the reduced axis from the NaN-ignoring percentile result.

fn nanpercentile_axis_with_method #

fn nanpercentile_axis_with_method[T](t &vtl.Tensor[T], percentile f64, axis int, method QuantileMethod, keepdims bool) !&vtl.Tensor[f64]

nanpercentile_axis_with_method computes NaN-ignoring percentiles per slice.

fn nanpercentile_linear #

fn nanpercentile_linear[T](t &vtl.Tensor[T], percentile f64) !f64

nanpercentile_linear computes a NaN-ignoring linearly interpolated percentile on the 0..100 scale.

fn nanpercentile_weighted #

fn nanpercentile_weighted[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], percentile f64) !f64

nanpercentile_weighted is the NaN-aware 0..100-scale weighted quantile.

fn nanpercentile_weighted_axes #

fn nanpercentile_weighted_axes[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], percentile f64, axes []int, keepdims bool) !&vtl.Tensor[f64]

nanpercentile_weighted_axes is the NaN-aware 0..100-scale multi-axis form.

fn nanpercentile_weighted_axis #

fn nanpercentile_weighted_axis[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], percentile f64, axis int, keepdims bool) !&vtl.Tensor[f64]

nanpercentile_weighted_axis computes NaN-aware weighted percentiles per slice.

fn nanpercentile_with_method #

fn nanpercentile_with_method[T](t &vtl.Tensor[T], percentile f64, method QuantileMethod) !f64

nanpercentile_with_method is the 0..100-scale NaN-ignoring quantile.

fn nanpercentiles_axes #

fn nanpercentiles_axes[T](t &vtl.Tensor[T], percentiles []f64, axes []int) !&vtl.Tensor[f64]

nanpercentiles_axes computes multiple NaN-aware 0..100 percentiles.

fn nanpercentiles_axes_keepdims #

fn nanpercentiles_axes_keepdims[T](t &vtl.Tensor[T], percentiles []f64, axes []int, keepdims bool) !&vtl.Tensor[f64]

nanpercentiles_axes_keepdims retains reduced dimensions as length one.

fn nanpercentiles_axes_with_method #

fn nanpercentiles_axes_with_method[T](t &vtl.Tensor[T], percentiles []f64, axes []int, method QuantileMethod) !&vtl.Tensor[f64]

nanpercentiles_axes_with_method computes multiple NaN-aware multi-axis percentiles.

fn nanpercentiles_axes_with_method_keepdims #

fn nanpercentiles_axes_with_method_keepdims[T](t &vtl.Tensor[T], percentiles []f64, axes []int, method QuantileMethod, keepdims bool) !&vtl.Tensor[f64]

nanpercentiles_axes_with_method_keepdims is the NaN-aware retained-shape form.

fn nanpercentiles_axis #

fn nanpercentiles_axis[T](t &vtl.Tensor[T], percentiles []f64, axis int) !&vtl.Tensor[f64]

nanpercentiles_axis computes several NaN-ignoring percentiles per axis slice. The percentile dimension is prepended to the output shape.

fn nanpercentiles_axis_keepdims #

fn nanpercentiles_axis_keepdims[T](t &vtl.Tensor[T], percentiles []f64, axis int, keepdims bool) !&vtl.Tensor[f64]

nanpercentiles_axis_keepdims computes NaN-aware linear percentiles with retained dimensions.

fn nanpercentiles_axis_with_method #

fn nanpercentiles_axis_with_method[T](t &vtl.Tensor[T], percentiles []f64, axis int, method QuantileMethod) !&vtl.Tensor[f64]

nanpercentiles_axis_with_method computes several NaN-ignoring percentiles per axis slice.

fn nanpercentiles_axis_with_method_keepdims #

fn nanpercentiles_axis_with_method_keepdims[T](t &vtl.Tensor[T], percentiles []f64, axis int, method QuantileMethod, keepdims bool) !&vtl.Tensor[f64]

nanpercentiles_axis_with_method_keepdims retains the reduced axis as length one.

fn nanpercentiles_linear #

fn nanpercentiles_linear[T](t &vtl.Tensor[T], percentiles []f64) !&vtl.Tensor[f64]

nanpercentiles_linear computes several NaN-ignoring percentiles on the 0..100 scale and returns them in input order.

fn nanpercentiles_weighted #

fn nanpercentiles_weighted[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], percentiles []f64) !&vtl.Tensor[f64]

nanpercentiles_weighted computes several NaN-aware weighted percentiles.

fn nanpercentiles_weighted_axes #

fn nanpercentiles_weighted_axes[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], percentiles []f64, axes []int) !&vtl.Tensor[f64]

nanpercentiles_weighted_axes computes NaN-aware multi-axis percentiles.

fn nanpercentiles_weighted_axes_keepdims #

fn nanpercentiles_weighted_axes_keepdims[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], percentiles []f64, axes []int, keepdims bool) !&vtl.Tensor[f64]

nanpercentiles_weighted_axes_keepdims computes NaN-aware weighted percentiles and optionally retains reduced axes after the leading dimension.

fn nanpercentiles_weighted_axis #

fn nanpercentiles_weighted_axis[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], percentiles []f64, axis int) !&vtl.Tensor[f64]

nanpercentiles_weighted_axis computes NaN-aware weighted percentiles per slice.

fn nanpercentiles_weighted_axis_keepdims #

fn nanpercentiles_weighted_axis_keepdims[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], percentiles []f64, axis int, keepdims bool) !&vtl.Tensor[f64]

nanpercentiles_weighted_axis_keepdims computes NaN-aware weighted percentiles while optionally retaining the reduced axis.

fn nanpercentiles_with_method #

fn nanpercentiles_with_method[T](t &vtl.Tensor[T], percentiles []f64, method QuantileMethod) !&vtl.Tensor[f64]

nanpercentiles_with_method computes several NaN-ignoring 0..100-scale percentiles.

fn nanprod #

fn nanprod[T](t &vtl.Tensor[T]) f64

nanprod multiplies all non-NaN elements and returns 1 for empty or all-NaN input.

fn nanprod_as #

fn nanprod_as[T, U](t &vtl.Tensor[T]) U

nanprod_as multiplies non-NaN values using an explicitly selected accumulator type. Empty and all-NaN inputs return the multiplicative identity.

fn nanprod_axes #

fn nanprod_axes[T](t &vtl.Tensor[T], axes []int, keepdims bool) !&vtl.Tensor[f64]

nanprod_axes reduces multiple axes, ignoring NaN values, and selects whether reduced dimensions remain in the output.

fn nanprod_axes_as #

fn nanprod_axes_as[T, U](t &vtl.Tensor[T], axes []int, keepdims bool) !&vtl.Tensor[U]

nanprod_axes_as reduces several axes using an explicit accumulator type.

fn nanprod_axis #

fn nanprod_axis[T](t &vtl.Tensor[T], axis int) !&vtl.Tensor[f64]

nanprod_axis reduces one axis and removes it from the result shape.

fn nanprod_axis_as #

fn nanprod_axis_as[T, U](t &vtl.Tensor[T], axis int, keepdims bool) !&vtl.Tensor[U]

nanprod_axis_as reduces one axis using the requested accumulator type.

fn nanprod_axis_keepdims #

fn nanprod_axis_keepdims[T](t &vtl.Tensor[T], axis int) !&vtl.Tensor[f64]

nanprod_axis_keepdims reduces one axis and keeps it with length one.

fn nanquantile_axes #

fn nanquantile_axes[T](t &vtl.Tensor[T], q f64, axes []int, keepdims bool) !&vtl.Tensor[f64]

nanquantile_axes reduces multiple axes while ignoring NaNs, using linear estimation.

fn nanquantile_axes_with_method #

fn nanquantile_axes_with_method[T](t &vtl.Tensor[T], q f64, axes []int, method QuantileMethod, keepdims bool) !&vtl.Tensor[f64]

nanquantile_axes_with_method reduces multiple axes while ignoring NaNs.

fn nanquantile_axis #

fn nanquantile_axis[T](t &vtl.Tensor[T], q f64, axis int) !&vtl.Tensor[f64]

nanquantile_axis computes one linearly interpolated quantile per axis slice, ignoring NaN values and retaining the reduced axis with length one. Slices containing only NaNs produce NaN.

fn nanquantile_axis_squeeze #

fn nanquantile_axis_squeeze[T](t &vtl.Tensor[T], q f64, axis int) !&vtl.Tensor[f64]

nanquantile_axis_squeeze ignores NaNs and removes the reduced axis from the result shape. Slices containing only NaNs produce NaN.

fn nanquantile_axis_with_method #

fn nanquantile_axis_with_method[T](t &vtl.Tensor[T], q f64, axis int, method QuantileMethod, keepdims bool) !&vtl.Tensor[f64]

nanquantile_axis_with_method reduces one axis while ignoring NaNs.

fn nanquantile_linear #

fn nanquantile_linear[T](t &vtl.Tensor[T], q f64) !f64

nanquantile_linear computes a linearly interpolated quantile while ignoring NaN values. It returns NaN when the tensor has no non-NaN values.

fn nanquantile_weighted #

fn nanquantile_weighted[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], q f64) !f64

nanquantile_weighted computes a flattened weighted inverted-CDF quantile, ignoring values that are NaN and their corresponding weights.

fn nanquantile_weighted_axes #

fn nanquantile_weighted_axes[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], q f64, axes []int, keepdims bool) !&vtl.Tensor[f64]

nanquantile_weighted_axes reduces multiple axes while ignoring NaNs and the weights paired with them.

fn nanquantile_weighted_axis #

fn nanquantile_weighted_axis[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], q f64, axis int, keepdims bool) !&vtl.Tensor[f64]

nanquantile_weighted_axis reduces one axis while ignoring NaNs and their corresponding weights.

fn nanquantile_with_method #

fn nanquantile_with_method[T](t &vtl.Tensor[T], q f64, method QuantileMethod) !f64

nanquantile_with_method computes a flattened quantile while ignoring NaNs. It returns NaN if the input has no non-NaN values.

fn nanquantiles_axes #

fn nanquantiles_axes[T](t &vtl.Tensor[T], quantiles []f64, axes []int) !&vtl.Tensor[f64]

nanquantiles_axes computes several NaN-aware linear quantiles per slice.

fn nanquantiles_axes_keepdims #

fn nanquantiles_axes_keepdims[T](t &vtl.Tensor[T], quantiles []f64, axes []int, keepdims bool) !&vtl.Tensor[f64]

nanquantiles_axes_keepdims retains reduced dimensions as length one.

fn nanquantiles_axes_with_method #

fn nanquantiles_axes_with_method[T](t &vtl.Tensor[T], quantiles []f64, axes []int, method QuantileMethod) !&vtl.Tensor[f64]

nanquantiles_axes_with_method computes multiple NaN-aware estimator values per reduced multi-axis slice.

fn nanquantiles_axes_with_method_keepdims #

fn nanquantiles_axes_with_method_keepdims[T](t &vtl.Tensor[T], quantiles []f64, axes []int, method QuantileMethod, keepdims bool) !&vtl.Tensor[f64]

nanquantiles_axes_with_method_keepdims retains reduced dimensions as length one.

fn nanquantiles_axis #

fn nanquantiles_axis[T](t &vtl.Tensor[T], quantiles []f64, axis int) !&vtl.Tensor[f64]

nanquantiles_axis computes several quantiles per axis slice while ignoring NaN values. Slices containing only NaNs produce NaN for each quantile.

fn nanquantiles_axis_keepdims #

fn nanquantiles_axis_keepdims[T](t &vtl.Tensor[T], quantiles []f64, axis int, keepdims bool) !&vtl.Tensor[f64]

nanquantiles_axis_keepdims computes NaN-aware linear quantiles with retained dimensions.

fn nanquantiles_axis_with_method #

fn nanquantiles_axis_with_method[T](t &vtl.Tensor[T], quantiles []f64, axis int, method QuantileMethod) !&vtl.Tensor[f64]

nanquantiles_axis_with_method computes several NaN-ignoring quantiles per axis slice, with the quantile dimension prepended to the output shape.

fn nanquantiles_axis_with_method_keepdims #

fn nanquantiles_axis_with_method_keepdims[T](t &vtl.Tensor[T], quantiles []f64, axis int, method QuantileMethod, keepdims bool) !&vtl.Tensor[f64]

nanquantiles_axis_with_method_keepdims retains the reduced axis as length one.

fn nanquantiles_linear #

fn nanquantiles_linear[T](t &vtl.Tensor[T], quantiles []f64) !&vtl.Tensor[f64]

nanquantiles_linear computes several quantiles while ignoring NaN values. If every input value is NaN, every result is NaN.

fn nanquantiles_weighted #

fn nanquantiles_weighted[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], quantiles []f64) !&vtl.Tensor[f64]

nanquantiles_weighted computes multiple flattened weighted quantiles from one sorted sample while ignoring NaNs and their corresponding weights.

fn nanquantiles_weighted_axes #

fn nanquantiles_weighted_axes[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], quantiles []f64, axes []int) !&vtl.Tensor[f64]

nanquantiles_weighted_axes computes multiple NaN-aware weighted quantiles per multi-axis slice.

fn nanquantiles_weighted_axes_keepdims #

fn nanquantiles_weighted_axes_keepdims[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], quantiles []f64, axes []int, keepdims bool) !&vtl.Tensor[f64]

nanquantiles_weighted_axes_keepdims retains all reduced axes as size-one dimensions after the prepended quantile dimension and ignores NaN values.

fn nanquantiles_weighted_axis #

fn nanquantiles_weighted_axis[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], quantiles []f64, axis int) !&vtl.Tensor[f64]

nanquantiles_weighted_axis computes multiple weighted quantiles per axis slice while ignoring NaNs and their corresponding weights.

fn nanquantiles_weighted_axis_keepdims #

fn nanquantiles_weighted_axis_keepdims[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], quantiles []f64, axis int, keepdims bool) !&vtl.Tensor[f64]

nanquantiles_weighted_axis_keepdims preserves the reduced axis as a length-one dimension and ignores NaNs and their corresponding weights.

fn nanquantiles_with_method #

fn nanquantiles_with_method[T](t &vtl.Tensor[T], quantiles []f64, method QuantileMethod) !&vtl.Tensor[f64]

nanquantiles_with_method computes several flattened quantiles while ignoring NaNs. If all values are NaN, every result is NaN.

fn nanstd #

fn nanstd[T](t &vtl.Tensor[T], ddof int) !f64

nanstd computes standard deviation while ignoring NaN values.

fn nanstd_along_axes #

fn nanstd_along_axes[T](t &vtl.Tensor[T], axes []int, ddof int, keepdims bool) !&vtl.Tensor[f64]

nanstd_along_axes computes NaN-ignoring standard deviation over several axes.

fn nanstd_along_axes_as #

fn nanstd_along_axes_as[T, U](t &vtl.Tensor[T], axes []int, ddof int, keepdims bool) !&vtl.Tensor[U]

nanstd_along_axes_as computes NaN-ignoring standard deviation over several axes.

fn nanstd_along_axis #

fn nanstd_along_axis[T](t &vtl.Tensor[T], axis int, ddof int, keepdims bool) !&vtl.Tensor[f64]

nanstd_along_axis computes NaN-ignoring std and optionally removes axis.

fn nanstd_along_axis_as #

fn nanstd_along_axis_as[T, U](t &vtl.Tensor[T], axis int, ddof int, keepdims bool) !&vtl.Tensor[U]

nanstd_along_axis_as computes NaN-ignoring standard deviation along one axis.

fn nanstd_as #

fn nanstd_as[T, U](t &vtl.Tensor[T], ddof int) !U

nanstd_as computes standard deviation while ignoring NaNs and using U for accumulation and output.

fn nanstd_axis #

fn nanstd_axis[T](t &vtl.Tensor[T], axis int, ddof int) !&vtl.Tensor[f64]

nanstd_axis computes standard deviation along axis and retains the reduced dimension as length one.

fn nansum #

fn nansum[T](t &vtl.Tensor[T]) f64

nansum adds all non-NaN elements and returns 0 for empty or all-NaN input.

fn nansum_as #

fn nansum_as[T, U](t &vtl.Tensor[T]) U

nansum_as adds non-NaN values using an explicitly selected accumulator type. Empty and all-NaN inputs return the additive identity.

fn nansum_axes #

fn nansum_axes[T](t &vtl.Tensor[T], axes []int, keepdims bool) !&vtl.Tensor[f64]

nansum_axes reduces multiple axes, ignoring NaN values, and selects whether reduced dimensions remain in the output.

fn nansum_axes_as #

fn nansum_axes_as[T, U](t &vtl.Tensor[T], axes []int, keepdims bool) !&vtl.Tensor[U]

nansum_axes_as reduces several axes using an explicit accumulator type.

fn nansum_axis #

fn nansum_axis[T](t &vtl.Tensor[T], axis int) !&vtl.Tensor[f64]

nansum_axis reduces one axis and removes it from the result shape.

fn nansum_axis_as #

fn nansum_axis_as[T, U](t &vtl.Tensor[T], axis int, keepdims bool) !&vtl.Tensor[U]

nansum_axis_as reduces one axis using the requested accumulator type.

fn nansum_axis_keepdims #

fn nansum_axis_keepdims[T](t &vtl.Tensor[T], axis int) !&vtl.Tensor[f64]

nansum_axis_keepdims reduces one axis and keeps it with length one.

fn nanvar #

fn nanvar[T](t &vtl.Tensor[T], ddof int) !f64

nanvar computes population or sample variance while ignoring NaN values. ddof is subtracted from the number of non-NaN values; insufficient values produce NaN, matching NumPy's nanvar result.

fn nanvar_along_axes #

fn nanvar_along_axes[T](t &vtl.Tensor[T], axes []int, ddof int, keepdims bool) !&vtl.Tensor[f64]

nanvar_along_axes computes NaN-ignoring variance over several axes.

fn nanvar_along_axis #

fn nanvar_along_axis[T](t &vtl.Tensor[T], axis int, ddof int, keepdims bool) !&vtl.Tensor[f64]

nanvar_along_axis computes NaN-ignoring variance and optionally removes axis.

fn nanvar_axis #

fn nanvar_axis[T](t &vtl.Tensor[T], axis int, ddof int) !&vtl.Tensor[f64]

nanvar_axis computes variance along axis and retains the reduced dimension as length one. NaN-only or under-sampled slices produce NaN.

fn nanvariance_along_axes_as #

fn nanvariance_along_axes_as[T, U](t &vtl.Tensor[T], axes []int, ddof int, keepdims bool) !&vtl.Tensor[U]

nanvariance_along_axes_as computes NaN-ignoring variance over several axes.

fn nanvariance_along_axis_as #

fn nanvariance_along_axis_as[T, U](t &vtl.Tensor[T], axis int, ddof int, keepdims bool) !&vtl.Tensor[U]

nanvariance_along_axis_as computes NaN-ignoring variance along one axis.

fn nanvariance_as #

fn nanvariance_as[T, U](t &vtl.Tensor[T], ddof int) !U

nanvariance_as computes variance while ignoring NaNs and using U for accumulation and output. Insufficient non-NaN observations return NaN for floating-point U, matching the NaN-aware axis reductions.

fn percentile_axes #

fn percentile_axes[T](t &vtl.Tensor[T], percentile f64, axes []int, keepdims bool) !&vtl.Tensor[f64]

percentile_axes reduces multiple axes using a 0..100 percentile and linear estimation.

fn percentile_axes_with_method #

fn percentile_axes_with_method[T](t &vtl.Tensor[T], percentile f64, axes []int, method QuantileMethod, keepdims bool) !&vtl.Tensor[f64]

percentile_axes_with_method is the 0..100-scale multi-axis quantile form.

fn percentile_axis #

fn percentile_axis[T](t &vtl.Tensor[T], percentile f64, axis int) !&vtl.Tensor[f64]

percentile_axis computes one linearly interpolated percentile per axis slice and retains the reduced axis with length one.

fn percentile_axis_squeeze #

fn percentile_axis_squeeze[T](t &vtl.Tensor[T], percentile f64, axis int) !&vtl.Tensor[f64]

percentile_axis_squeeze removes the reduced axis from the percentile result.

fn percentile_axis_with_method #

fn percentile_axis_with_method[T](t &vtl.Tensor[T], percentile f64, axis int, method QuantileMethod, keepdims bool) !&vtl.Tensor[f64]

percentile_axis_with_method computes one percentile per axis slice.

fn percentile_linear #

fn percentile_linear[T](t &vtl.Tensor[T], percentile f64) !f64

percentile_linear computes NumPy's default linearly interpolated percentile. The percentile is expressed on the 0..100 scale.

fn percentile_weighted #

fn percentile_weighted[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], percentile f64) !f64

percentile_weighted is the 0..100-scale form of quantile_weighted.

fn percentile_weighted_axes #

fn percentile_weighted_axes[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], percentile f64, axes []int, keepdims bool) !&vtl.Tensor[f64]

percentile_weighted_axes is the 0..100-scale multi-axis weighted quantile.

fn percentile_weighted_axis #

fn percentile_weighted_axis[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], percentile f64, axis int, keepdims bool) !&vtl.Tensor[f64]

percentile_weighted_axis computes one weighted percentile per axis slice.

fn percentile_with_method #

fn percentile_with_method[T](t &vtl.Tensor[T], percentile f64, method QuantileMethod) !f64

percentile_with_method is the 0..100-scale form of quantile_with_method.

fn percentiles_axes #

fn percentiles_axes[T](t &vtl.Tensor[T], percentiles []f64, axes []int) !&vtl.Tensor[f64]

percentiles_axes computes multiple 0..100 percentiles using linear estimation.

fn percentiles_axes_keepdims #

fn percentiles_axes_keepdims[T](t &vtl.Tensor[T], percentiles []f64, axes []int, keepdims bool) !&vtl.Tensor[f64]

percentiles_axes_keepdims retains reduced dimensions as length one.

fn percentiles_axes_with_method #

fn percentiles_axes_with_method[T](t &vtl.Tensor[T], percentiles []f64, axes []int, method QuantileMethod) !&vtl.Tensor[f64]

percentiles_axes_with_method computes multiple multi-axis percentiles.

fn percentiles_axes_with_method_keepdims #

fn percentiles_axes_with_method_keepdims[T](t &vtl.Tensor[T], percentiles []f64, axes []int, method QuantileMethod, keepdims bool) !&vtl.Tensor[f64]

percentiles_axes_with_method_keepdims retains reduced dimensions as length one.

fn percentiles_axis #

fn percentiles_axis[T](t &vtl.Tensor[T], percentiles []f64, axis int) !&vtl.Tensor[f64]

percentiles_axis computes several percentiles per axis slice. The percentile dimension is prepended to the output shape.

fn percentiles_axis_keepdims #

fn percentiles_axis_keepdims[T](t &vtl.Tensor[T], percentiles []f64, axis int, keepdims bool) !&vtl.Tensor[f64]

percentiles_axis_keepdims computes linear percentiles with retained dimensions.

fn percentiles_axis_with_method #

fn percentiles_axis_with_method[T](t &vtl.Tensor[T], percentiles []f64, axis int, method QuantileMethod) !&vtl.Tensor[f64]

percentiles_axis_with_method computes several percentiles per axis slice.

fn percentiles_axis_with_method_keepdims #

fn percentiles_axis_with_method_keepdims[T](t &vtl.Tensor[T], percentiles []f64, axis int, method QuantileMethod, keepdims bool) !&vtl.Tensor[f64]

percentiles_axis_with_method_keepdims retains the reduced axis as length one.

fn percentiles_linear #

fn percentiles_linear[T](t &vtl.Tensor[T], percentiles []f64) !&vtl.Tensor[f64]

percentiles_linear computes several linearly interpolated percentiles on the 0..100 scale and returns them in input order.

fn percentiles_weighted #

fn percentiles_weighted[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], percentiles []f64) !&vtl.Tensor[f64]

percentiles_weighted computes several weighted 0..100-scale percentiles.

fn percentiles_weighted_axes #

fn percentiles_weighted_axes[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], percentiles []f64, axes []int) !&vtl.Tensor[f64]

percentiles_weighted_axes computes multi-axis percentiles on the 0..100 scale.

fn percentiles_weighted_axes_keepdims #

fn percentiles_weighted_axes_keepdims[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], percentiles []f64, axes []int, keepdims bool) !&vtl.Tensor[f64]

percentiles_weighted_axes_keepdims computes weighted percentiles and optionally retains reduced axes after the leading percentile dimension.

fn percentiles_weighted_axis #

fn percentiles_weighted_axis[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], percentiles []f64, axis int) !&vtl.Tensor[f64]

percentiles_weighted_axis computes several weighted percentiles per slice.

fn percentiles_weighted_axis_keepdims #

fn percentiles_weighted_axis_keepdims[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], percentiles []f64, axis int, keepdims bool) !&vtl.Tensor[f64]

percentiles_weighted_axis_keepdims computes weighted percentiles while optionally retaining the reduced axis as a length-one dimension.

fn percentiles_with_method #

fn percentiles_with_method[T](t &vtl.Tensor[T], percentiles []f64, method QuantileMethod) !&vtl.Tensor[f64]

percentiles_with_method computes several 0..100-scale percentiles.

fn population_stddev #

@[inline]
fn population_stddev[T](t &vtl.Tensor[T]) T

population_stddev exposes this operation as part of the public API.

fn population_stddev_mean #

@[inline]
fn population_stddev_mean[T](t &vtl.Tensor[T], mean T) T

population_stddev_mean exposes this operation as part of the public API.

fn population_variance #

@[inline]
fn population_variance[T](t &vtl.Tensor[T]) T

population_variance exposes this operation as part of the public API.

fn population_variance_mean #

fn population_variance_mean[T](t &vtl.Tensor[T], provided_mean T) T

Measure of Dispersion / Spread Population Variance of the given input array Based on https://www.mathsisfun.com/data/standard-deviation.html

fn prod #

@[direct_array_access]
fn prod[T](t &vtl.Tensor[T]) T

prod returns the product of all elements of the given tensor

fn prod_axis #

fn prod_axis[T](t &vtl.Tensor[T], data AxisData) T

prod_axis_dims returns the product of a given Tensor along a provided axis with the reduced dimension intact

fn prod_axis_with_dims #

fn prod_axis_with_dims[T](t &vtl.Tensor[T], data AxisData) T

prod_axis_dims returns the product of a Tensor along a provided axis with the reduced dimension intact

fn product_along_axes #

fn product_along_axes[T](t &vtl.Tensor[T], axes []int, keepdims bool) !&vtl.Tensor[T]

product_along_axes multiplies values along one or more axes. Negative axes are accepted. An empty axes list returns a copy without reducing dimensions.

fn product_along_axes_as #

fn product_along_axes_as[T, U](t &vtl.Tensor[T], axes []int, keepdims bool) !&vtl.Tensor[U]

product_along_axes_as reduces several axes using the requested accumulator type.

fn product_along_axis #

fn product_along_axis[T](t &vtl.Tensor[T], axis int, keepdims bool) !&vtl.Tensor[T]

product_along_axis multiplies values along one axis. When keepdims is true, the reduced axis remains in the result with length one.

fn product_along_axis_as #

fn product_along_axis_as[T, U](t &vtl.Tensor[T], axis int, keepdims bool) !&vtl.Tensor[U]

product_along_axis_as reduces one axis using the requested accumulator type.

fn product_as #

fn product_as[T, U](t &vtl.Tensor[T]) U

product_as reduces all values into an explicitly selected accumulator type.

fn ptp #

@[direct_array_access]
fn ptp[T](t &vtl.Tensor[T]) !T

ptp returns the range (maximum minus minimum) of all tensor values. Empty inputs and unordered element types return an error.

fn ptp_along_axes #

fn ptp_along_axes[T](t &vtl.Tensor[T], axes []int, keepdims bool) !&vtl.Tensor[T]

ptp_along_axes returns maximum minus minimum over several axes. Negative axes are valid, duplicate axes and empty reduced dimensions return errors. An empty axes list returns zeros with the same shape as the input.

fn ptp_along_axis #

fn ptp_along_axis[T](t &vtl.Tensor[T], axis int, keepdims bool) !&vtl.Tensor[T]

ptp_along_axis returns maximum minus minimum along one axis. Set keepdims to true to retain the reduced axis with length one. Negative axes are valid.

fn quantile #

fn quantile[T](sorted_t &vtl.Tensor[T], f T) T

quantile exposes this operation as part of the public API.

fn quantile_axes #

fn quantile_axes[T](t &vtl.Tensor[T], q f64, axes []int, keepdims bool) !&vtl.Tensor[f64]

quantile_axes reduces multiple axes using NumPy's default linear estimator.

fn quantile_axes_with_method #

fn quantile_axes_with_method[T](t &vtl.Tensor[T], q f64, axes []int, method QuantileMethod, keepdims bool) !&vtl.Tensor[f64]

quantile_axes_with_method reduces multiple axes using a NumPy-compatible estimator. keepdims retains each reduced dimension with length one.

fn quantile_axis #

fn quantile_axis[T](t &vtl.Tensor[T], q f64, axis int) !&vtl.Tensor[f64]

quantile_axis computes linearly interpolated quantiles along axis and keeps the reduced axis with length one. NaN values propagate within their slice.

fn quantile_axis_squeeze #

fn quantile_axis_squeeze[T](t &vtl.Tensor[T], q f64, axis int) !&vtl.Tensor[f64]

quantile_axis_squeeze computes one quantile per axis slice and removes the reduced axis from the result shape, matching NumPy's default quantile shape.

fn quantile_axis_with_method #

fn quantile_axis_with_method[T](t &vtl.Tensor[T], q f64, axis int, method QuantileMethod, keepdims bool) !&vtl.Tensor[f64]

quantile_axis_with_method reduces one axis and chooses whether to retain it as a length-one dimension.

fn quantile_linear #

fn quantile_linear[T](t &vtl.Tensor[T], q f64) !f64

quantile_linear computes NumPy's default linearly interpolated quantile. It sorts a copy of the tensor values and returns an f64, regardless of the input element type. NaN input values propagate as NaN.

fn quantile_weighted #

fn quantile_weighted[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], q f64) !f64

quantile_weighted computes NumPy's weighted inverted-CDF quantile. Values and weights must have identical shapes; weights must be finite, non-negative, and have a positive total.

fn quantile_weighted_axes #

fn quantile_weighted_axes[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], q f64, axes []int, keepdims bool) !&vtl.Tensor[f64]

quantile_weighted_axes reduces multiple axes with same-shape weights or a compact weight tensor whose dimensions follow the supplied axes order.

fn quantile_weighted_axis #

fn quantile_weighted_axis[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], q f64, axis int, keepdims bool) !&vtl.Tensor[f64]

quantile_weighted_axis reduces one axis using same-shape weights or a one-dimensional weight vector matching that axis.

fn quantile_with_method #

fn quantile_with_method[T](t &vtl.Tensor[T], q f64, method QuantileMethod) !f64

quantile_with_method computes a flattened quantile using the selected estimator. It sorts a copy and returns f64, including for integer inputs.

fn quantiles_axes #

fn quantiles_axes[T](t &vtl.Tensor[T], quantiles []f64, axes []int) !&vtl.Tensor[f64]

quantiles_axes computes several linear quantiles per multi-axis slice.

fn quantiles_axes_keepdims #

fn quantiles_axes_keepdims[T](t &vtl.Tensor[T], quantiles []f64, axes []int, keepdims bool) !&vtl.Tensor[f64]

quantiles_axes_keepdims retains reduced dimensions as length one.

fn quantiles_axes_with_method #

fn quantiles_axes_with_method[T](t &vtl.Tensor[T], quantiles []f64, axes []int, method QuantileMethod) !&vtl.Tensor[f64]

quantiles_axes_with_method computes multiple estimator values after one sort per reduced multi-axis slice. The quantile dimension is prepended.

fn quantiles_axes_with_method_keepdims #

fn quantiles_axes_with_method_keepdims[T](t &vtl.Tensor[T], quantiles []f64, axes []int, method QuantileMethod, keepdims bool) !&vtl.Tensor[f64]

quantiles_axes_with_method_keepdims retains reduced dimensions as length one.

fn quantiles_axis #

fn quantiles_axis[T](t &vtl.Tensor[T], quantiles []f64, axis int) !&vtl.Tensor[f64]

quantiles_axis computes several linearly interpolated quantiles for each axis slice. The quantile dimension is prepended to the output shape, matching NumPy's quantile(..., axis=axis) layout. Each slice is sorted only once. NaN values propagate to every requested quantile in their slice.

fn quantiles_axis_keepdims #

fn quantiles_axis_keepdims[T](t &vtl.Tensor[T], quantiles []f64, axis int, keepdims bool) !&vtl.Tensor[f64]

quantiles_axis_keepdims computes linear quantiles and retains the reduced axis.

fn quantiles_axis_with_method #

fn quantiles_axis_with_method[T](t &vtl.Tensor[T], quantiles []f64, axis int, method QuantileMethod) !&vtl.Tensor[f64]

quantiles_axis_with_method computes several quantiles per axis slice. The quantile dimension is prepended to the output shape, as in NumPy.

fn quantiles_axis_with_method_keepdims #

fn quantiles_axis_with_method_keepdims[T](t &vtl.Tensor[T], quantiles []f64, axis int, method QuantileMethod, keepdims bool) !&vtl.Tensor[f64]

quantiles_axis_with_method_keepdims retains the reduced axis as length one.

fn quantiles_linear #

fn quantiles_linear[T](t &vtl.Tensor[T], quantiles []f64) !&vtl.Tensor[f64]

quantiles_linear computes several NumPy-style quantiles from one sorted copy of the flattened tensor values.

fn quantiles_weighted #

fn quantiles_weighted[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], quantiles []f64) !&vtl.Tensor[f64]

quantiles_weighted computes several weighted inverted-CDF quantiles after sorting the weighted sample once.

fn quantiles_weighted_axes #

fn quantiles_weighted_axes[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], quantiles []f64, axes []int) !&vtl.Tensor[f64]

quantiles_weighted_axes computes several weighted quantiles per multi-axis slice. The quantile dimension is prepended to the output shape.

fn quantiles_weighted_axes_keepdims #

fn quantiles_weighted_axes_keepdims[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], quantiles []f64, axes []int, keepdims bool) !&vtl.Tensor[f64]

quantiles_weighted_axes_keepdims optionally retains all reduced axes as size-one dimensions after the prepended quantile dimension.

fn quantiles_weighted_axis #

fn quantiles_weighted_axis[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], quantiles []f64, axis int) !&vtl.Tensor[f64]

quantiles_weighted_axis computes several weighted quantiles per axis slice. The quantile dimension is prepended, matching NumPy's multi-quantile shape.

fn quantiles_weighted_axis_keepdims #

fn quantiles_weighted_axis_keepdims[T](values &vtl.Tensor[T], weights &vtl.Tensor[f64], quantiles []f64, axis int, keepdims bool) !&vtl.Tensor[f64]

quantiles_weighted_axis_keepdims optionally retains the reduced axis as a length-one dimension after the prepended quantile dimension.

fn quantiles_with_method #

fn quantiles_with_method[T](t &vtl.Tensor[T], quantiles []f64, method QuantileMethod) !&vtl.Tensor[f64]

quantiles_with_method computes several flattened quantiles from one sorted copy of the input values.

fn range #

fn range[T](t &vtl.Tensor[T]) T

Measure of Dispersion / Spread Range ( Maximum - Minimum ) of the given input array Based on https://www.mathsisfun.com/data/range.html

fn rms #

fn rms[T](t &vtl.Tensor[T]) T

Root Mean Square of the given input array Based on https://en.wikipedia.org/wiki/Root_mean_square

fn sample_stddev #

@[inline]
fn sample_stddev[T](t &vtl.Tensor[T]) T

sample_stddev exposes this operation as part of the public API.

fn sample_stddev_mean #

@[inline]
fn sample_stddev_mean[T](t &vtl.Tensor[T], mean T) T

sample_stddev_mean exposes this operation as part of the public API.

fn sample_variance #

@[inline]
fn sample_variance[T](t &vtl.Tensor[T]) T

sample_variance exposes this operation as part of the public API.

fn sample_variance_mean #

fn sample_variance_mean[T](t &vtl.Tensor[T], provided_mean T) T

Measure of Dispersion / Spread Sample Variance of the given input array Based on https://www.mathsisfun.com/data/standard-deviation.html

fn skew #

@[inline]
fn skew[T](t &vtl.Tensor[T]) T

skew exposes this operation as part of the public API.

fn skew_mean_stddev #

fn skew_mean_stddev[T](t &vtl.Tensor[T], mean T, sd T) T

skew_mean_stddev exposes this operation as part of the public API.

fn std #

fn std[T](t &vtl.Tensor[T], data VarianceData) !f64

std calculates the standard deviation using Welford's stable algorithm.

fn std_along_axes #

fn std_along_axes[T](t &vtl.Tensor[T], axes []int, ddof int, keepdims bool) !&vtl.Tensor[f64]

std_along_axes computes standard deviation over several axes.

fn std_along_axes_as #

fn std_along_axes_as[T, U](t &vtl.Tensor[T], axes []int, ddof int, keepdims bool) !&vtl.Tensor[U]

std_along_axes_as computes standard deviation over several axes using U.

fn std_along_axis #

fn std_along_axis[T](t &vtl.Tensor[T], axis int, ddof int, keepdims bool) !&vtl.Tensor[f64]

std_along_axis computes standard deviation and optionally removes its axis.

fn std_along_axis_as #

fn std_along_axis_as[T, U](t &vtl.Tensor[T], axis int, ddof int, keepdims bool) !&vtl.Tensor[U]

std_along_axis_as computes standard deviation along one axis using U.

fn std_as #

fn std_as[T, U](t &vtl.Tensor[T], ddof int) !U

std_as computes standard deviation using U for accumulation and output.

fn std_axis #

fn std_axis[T](t &vtl.Tensor[T], axis int, ddof int) !&vtl.Tensor[f64]

std_axis computes standard deviation along axis and retains the reduced dimension with length one.

fn sum #

@[direct_array_access]
fn sum[T](t &vtl.Tensor[T]) T

sum returns the sum of all elements of the given tensor

fn sum_accurate #

fn sum_accurate[T](t &vtl.Tensor[T]) T

sum_accurate sums floating-point tensors with Neumaier compensation. This preserves small contributions that can be lost by the faster sum reduction. For non-floating types it delegates to sum without changing their semantics.

fn sum_along_axes #

fn sum_along_axes[T](t &vtl.Tensor[T], axes []int, keepdims bool) !&vtl.Tensor[T]

sum_along_axes reduces one or more axes and returns a tensor. Negative axes are accepted. An empty axes list returns a copy without reducing dimensions. When keepdims is true, each reduced dimension remains with length one.

fn sum_along_axes_as #

fn sum_along_axes_as[T, U](t &vtl.Tensor[T], axes []int, keepdims bool) !&vtl.Tensor[U]

sum_along_axes_as reduces several axes using the requested accumulator type.

fn sum_along_axis #

fn sum_along_axis[T](t &vtl.Tensor[T], axis int, keepdims bool) !&vtl.Tensor[T]

sum_along_axis reduces one axis and returns a tensor. When keepdims is true, the reduced axis remains in the result with length one.

fn sum_along_axis_as #

fn sum_along_axis_as[T, U](t &vtl.Tensor[T], axis int, keepdims bool) !&vtl.Tensor[U]

sum_along_axis_as reduces one axis using the requested accumulator type.

fn sum_as #

fn sum_as[T, U](t &vtl.Tensor[T]) U

sum_as reduces all values into an explicitly selected accumulator type.

fn sum_axis #

fn sum_axis[T](t &vtl.Tensor[T], data AxisData) T

sum_axis returns the sum of a given Tensor along a provided axis

fn sum_axis_with_dims #

fn sum_axis_with_dims[T](t &vtl.Tensor[T], data AxisData) T

sum_axis_dims returns the sum of a given Tensor along a provided axis with the reduced dimension intact

fn trapezoid #

fn trapezoid[T](t &vtl.Tensor[T], dx f64) !&vtl.Tensor[f64]

trapezoid integrates a one-dimensional or N-dimensional tensor along its last axis with uniform sample spacing dx. The reduced result is f64.

fn trapezoid_axis #

fn trapezoid_axis[T](t &vtl.Tensor[T], dx f64, axis int) !&vtl.Tensor[f64]

trapezoid_axis integrates along axis using uniform sample spacing dx. The reduced axis is removed from the result shape.

fn trapezoid_x_axis #

fn trapezoid_x_axis[T, X](t &vtl.Tensor[T], x &vtl.Tensor[X], axis int) !&vtl.Tensor[f64]

trapezoid_x_axis integrates along axis using the provided one-dimensional sample coordinates. Coordinates are consumed in their original order; they are not sorted.

fn tss #

@[inline]
fn tss[T](t &vtl.Tensor[T]) T

tss exposes this operation as part of the public API.

fn tss_mean #

fn tss_mean[T](t &vtl.Tensor[T], provided_mean T) T

Sum of squares about the mean

fn variance #

fn variance[T](t &vtl.Tensor[T], data VarianceData) !f64

variance calculates the variance using Welford's stable online algorithm. It returns f64 even for integer tensors to preserve fractional results. ddof is subtracted from the number of observations in the denominator; the default (0) computes population variance.

fn variance_along_axes #

fn variance_along_axes[T](t &vtl.Tensor[T], axes []int, ddof int, keepdims bool) !&vtl.Tensor[f64]

variance_along_axes computes population or sample variance over several axes. ddof is subtracted from the number of observations per output value.

fn variance_along_axes_as #

fn variance_along_axes_as[T, U](t &vtl.Tensor[T], axes []int, ddof int, keepdims bool) !&vtl.Tensor[U]

variance_along_axes_as reduces several axes using U for accumulation/output.

fn variance_along_axis #

fn variance_along_axis[T](t &vtl.Tensor[T], axis int, ddof int, keepdims bool) !&vtl.Tensor[f64]

variance_along_axis computes variance along axis and optionally removes it.

fn variance_along_axis_as #

fn variance_along_axis_as[T, U](t &vtl.Tensor[T], axis int, ddof int, keepdims bool) !&vtl.Tensor[U]

variance_along_axis_as reduces one axis using U for accumulation and output.

fn variance_as #

fn variance_as[T, U](t &vtl.Tensor[T], ddof int) !U

variance_as computes population or sample variance using U for accumulation and output. ddof is subtracted from the observation count.

fn variance_axis #

fn variance_axis[T](t &vtl.Tensor[T], axis int, ddof int) !&vtl.Tensor[f64]

variance_axis computes population or sample variance along axis. The reduced axis is retained with length one and NaNs propagate per slice.

type QuantileMethod #

type QuantileMethod = vtl.QuantileMethod

QuantileMethod selects one of NumPy's thirteen supported sample-quantile estimators.

enum HistogramBinRule #

enum HistogramBinRule {
	automatic
	doane
	freedman_diaconis
	rice
	scott
	square_root
	stone
	sturges
}

HistogramBinRule selects a standard data-driven bin-width heuristic.

struct AxisData #

struct AxisData {
pub:
	axis int
}

AxisData defines a public data structure for this module.

struct Histogram #

struct Histogram {
pub:
	counts    &vtl.Tensor[int]
	bin_edges &vtl.Tensor[f64]
}

Histogram contains bin counts and the corresponding bin edges.

struct Histogram2D #

struct Histogram2D {
pub:
	counts  &vtl.Tensor[int]
	x_edges &vtl.Tensor[f64]
	y_edges &vtl.Tensor[f64]
}

Histogram2D contains a two-dimensional count grid and its bin edges. counts is indexed as [x_bin, y_bin], matching NumPy histogram2d.

struct HistogramDD #

struct HistogramDD {
pub:
	counts &vtl.Tensor[int]
	edges  [][]f64
}

HistogramDD contains counts for N-dimensional sample points and one edge vector per sample dimension. Counts use row-major bin order.

struct VarianceData #

struct VarianceData {
pub:
	ddof int
}

VarianceData configures the degrees of freedom used by variance and std.

struct WeightedHistogram #

struct WeightedHistogram {
pub:
	counts    &vtl.Tensor[f64]
	bin_edges &vtl.Tensor[f64]
}

WeightedHistogram contains weighted counts or probability densities and the corresponding bin edges.

struct WeightedHistogram2D #

struct WeightedHistogram2D {
pub:
	counts  &vtl.Tensor[f64]
	x_edges &vtl.Tensor[f64]
	y_edges &vtl.Tensor[f64]
}

WeightedHistogram2D contains weighted counts or probability densities.

struct WeightedHistogramDD #

struct WeightedHistogramDD {
pub:
	counts &vtl.Tensor[f64]
	edges  [][]f64
}

WeightedHistogramDD contains weighted counts or probability densities.