dpnp.cov

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

Estimate a covariance matrix, given data and weights.

For full documentation refer to numpy.cov.

Returns:

out -- The covariance matrix of the variables.

Return type:

dpnp.ndarray

Limitations

Input array m is supported as dpnp.ndarray. Dimension of input array m is limited by m.ndim <= 2. Size and shape of input arrays are supported to be equal. Parameter y is supported only with default value None. Parameter bias is supported only with default value False. Parameter ddof is supported only with default value None. Parameter fweights is supported only with default value None. Parameter aweights is supported only with default value None. Otherwise the function will be executed sequentially on CPU. Input array data types are limited by supported DPNP Available array data types.

See also

dpnp.corrcoef

Normalized covariance matrix

Examples

>>> import dpnp as np
>>> x = np.array([[0, 2], [1, 1], [2, 0]]).T
>>> x.shape
(2, 3)
>>> [i for i in x]
[0, 1, 2, 2, 1, 0]
>>> out = np.cov(x)
>>> out.shape
(2, 2)
>>> [i for i in out]
[1.0, -1.0, -1.0, 1.0]