pub fn average<T, D>(
a: &Array<T, D>,
weights: Option<&Array<T, D>>,
axis: Option<usize>,
) -> FerrayResult<Array<T, IxDyn>>Expand description
Weighted average of array elements.
When weights is None, equivalent to mean. When Some(w), computes
sum(a * w) / sum(w) along the given axis (or over all elements when
axis=None). The weights array must have the same shape as a (the
1-D-along-axis broadcasting form supported by NumPy is intentionally
omitted here — call broadcast yourself first if you need it).
Analogous to numpy.average.
§Errors
FerrayError::InvalidValueif the array is empty.FerrayError::ShapeMismatchifweights.shape() != a.shape().FerrayError::InvalidValueif the weight sum along an axis is zero.