dpnp.linalg.svdvals

dpnp.linalg.svdvals(x, /)[source]

Returns the singular values of a matrix (or a stack of matrices) x.

When x is a stack of matrices, the function will compute the singular values for each matrix in the stack.

Calling dpnp.linalg.svdvals(x) to get singular values is the same as dpnp.linalg.svd(x, compute_uv=False, hermitian=False).

For full documentation refer to numpy.linalg.svdvals.

Parameters:

x ((..., M, N) {dpnp.ndarray, usm_ndarray}) -- Input array with x.ndim >= 2 and whose last two dimensions form matrices on which to perform singular value decomposition.

Returns:

out -- Vector(s) of singular values of length K, where K = min(M, N).

Return type:

(..., K) dpnp.ndarray

See also

dpnp.linalg.svd

Compute the singular value decomposition.

Examples

>>> import dpnp as np
>>> a = np.array([[3, 0], [0, 4]])
>>> np.linalg.svdvals(a)
array([4., 3.])

This is equivalent to calling:

>>> np.linalg.svd(a, compute_uv=False, hermitian=False)
array([4., 3.])

Stack of matrices:

>>> b = np.array([[[6, 0], [0, 8]], [[9, 0], [0, 12]]])
>>> np.linalg.svdvals(b)
array([[ 8.,  6.],
       [12.,  9.]])