cupy.cov#

cupy.cov(a, y=None, rowvar=True, bias=False, ddof=None, fweights=None, aweights=None, *, dtype=None)[source]#

Returns the covariance matrix of an array.

This function currently does not support fweights and aweights options.

Parameters:
  • a (cupy.ndarray) – Array to compute covariance matrix.

  • y (cupy.ndarray) – An additional set of variables and observations.

  • rowvar (bool) – If True, then each row represents a variable, with observations in the columns. Otherwise, the relationship is transposed.

  • bias (bool) – If False, normalization is by (N - 1), where N is the number of observations given (unbiased estimate). If True, then normalization is by N.

  • ddof (int) – If not None the default value implied by bias is overridden. Note that ddof=1 will return the unbiased estimate and ddof=0 will return the simple average.

  • fweights (cupy.ndarray, int) – 1-D array of integer frequency weights. the number of times each observation vector should be repeated. It is required that fweights >= 0. However, the function will not error when fweights < 0 for performance reasons.

  • aweights (cupy.ndarray) – 1-D array of observation vector weights. These relative weights are typically large for observations considered “important” and smaller for observations considered less “important”. If ddof=0 the array of weights can be used to assign probabilities to observation vectors. It is required that aweights >= 0. However, the function will not error when aweights < 0 for performance reasons.

  • dtype – Data type specifier. By default, the return data-type will have at least numpy.float64 precision.

Returns:

The covariance matrix of the input array.

Return type:

cupy.ndarray

See also

numpy.cov()