Statistics

Order statistics

cupy.amin(a, axis=None, out=None, keepdims=False, dtype=None)[source]

Returns the minimum of an array or the minimum along an axis.

Note

When at least one element is NaN, the corresponding min value will be NaN.

Parameters:
  • a (cupy.ndarray) – Array to take the minimum.
  • axis (int) – Along which axis to take the minimum. The flattened array is used by default.
  • out (cupy.ndarray) – Output array.
  • keepdims (bool) – If True, the axis is remained as an axis of size one.
  • dtype – Data type specifier.
Returns:

The minimum of a, along the axis if specified.

Return type:

cupy.ndarray

See also

numpy.amin()

cupy.amax(a, axis=None, out=None, keepdims=False, dtype=None)[source]

Returns the maximum of an array or the maximum along an axis.

Note

When at least one element is NaN, the corresponding min value will be NaN.

Parameters:
  • a (cupy.ndarray) – Array to take the maximum.
  • axis (int) – Along which axis to take the maximum. The flattened array is used by default.
  • out (cupy.ndarray) – Output array.
  • keepdims (bool) – If True, the axis is remained as an axis of size one.
  • dtype – Data type specifier.
Returns:

The maximum of a, along the axis if specified.

Return type:

cupy.ndarray

See also

numpy.amax()

cupy.nanmin(a, axis=None, out=None, keepdims=False)[source]

Returns the minimum of an array along an axis ignoring NaN.

When there is a slice whose elements are all NaN, a RuntimeWarning is raised and NaN is returned.

Parameters:
  • a (cupy.ndarray) – Array to take the minimum.
  • axis (int) – Along which axis to take the minimum. The flattened array is used by default.
  • out (cupy.ndarray) – Output array.
  • keepdims (bool) – If True, the axis is remained as an axis of size one.
Returns:

The minimum of a, along the axis if specified.

Return type:

cupy.ndarray

See also

numpy.nanmin()

cupy.nanmax(a, axis=None, out=None, keepdims=False)[source]

Returns the maximum of an array along an axis ignoring NaN.

When there is a slice whose elements are all NaN, a RuntimeWarning is raised and NaN is returned.

Parameters:
  • a (cupy.ndarray) – Array to take the maximum.
  • axis (int) – Along which axis to take the maximum. The flattened array is used by default.
  • out (cupy.ndarray) – Output array.
  • keepdims (bool) – If True, the axis is remained as an axis of size one.
Returns:

The maximum of a, along the axis if specified.

Return type:

cupy.ndarray

See also

numpy.nanmax()

Means and variances

cupy.mean(a, axis=None, dtype=None, out=None, keepdims=False)[source]

Returns the arithmetic mean along an axis.

Parameters:
  • a (cupy.ndarray) – Array to compute mean.
  • axis (int) – Along which axis to compute mean. The flattened array is used by default.
  • dtype – Data type specifier.
  • out (cupy.ndarray) – Output array.
  • keepdims (bool) – If True, the axis is remained as an axis of size one.
Returns:

The mean of the input array along the axis.

Return type:

cupy.ndarray

See also

numpy.mean()

cupy.var(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False)[source]

Returns the variance along an axis.

Parameters:
  • a (cupy.ndarray) – Array to compute variance.
  • axis (int) – Along which axis to compute variance. The flattened array is used by default.
  • dtype – Data type specifier.
  • out (cupy.ndarray) – Output array.
  • keepdims (bool) – If True, the axis is remained as an axis of size one.
Returns:

The variance of the input array along the axis.

Return type:

cupy.ndarray

See also

numpy.var()

cupy.std(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False)[source]

Returns the standard deviation along an axis.

Parameters:
  • a (cupy.ndarray) – Array to compute standard deviation.
  • axis (int) – Along which axis to compute standard deviation. The flattened array is used by default.
  • dtype – Data type specifier.
  • out (cupy.ndarray) – Output array.
  • keepdims (bool) – If True, the axis is remained as an axis of size one.
Returns:

The standard deviation of the input array along the axis.

Return type:

cupy.ndarray

See also

numpy.std()

Histograms

cupy.bincount(x, weights=None, minlength=None)[source]

Count number of occurrences of each value in array of non-negative ints.

Parameters:
  • x (cupy.ndarray) – Input array.
  • weights (cupy.ndarray) – Weights array which has the same shape as x.
  • minlength (int) – A minimum number of bins for the output array.
Returns:

The result of binning the input array. The length of output is equal to max(cupy.max(x) + 1, minlength).

Return type:

cupy.ndarray

See also

numpy.bincount()