bundles / numpy latest / numpy / linalg / svdvals
_ArrayFunctionDispatcher
numpy.linalg:svdvals
source: build-install/usr/lib/python3.14/site-packages/numpy/linalg/_linalg.py :1860
Signature
def svdvals ( x , / ) Summary
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.
Extended Summary
This function is Array API compatible.
Calling np.svdvals(x) to get singular values is the same as np.svd(x, compute_uv=False, hermitian=False).
Parameters
x: (..., M, N) array_likeInput array having shape (..., M, N) and whose last two dimensions form matrices on which to perform singular value decomposition. Should have a floating-point data type.
Returns
out: ndarrayAn array with shape (..., K) that contains the vector(s) of singular values of length K, where K = min(M, N).
Examples
np.linalg.svdvals([[1, 2, 3, 4, 5], [1, 4, 9, 16, 25], [1, 8, 27, 64, 125]])✓
s = np.linalg.svdvals([[1, 2, 3], [2, 4, 6], [-1, 1, -1]]); s✓
np.count_nonzero(s > 1e-10) # Matrix of rank 2
✗See also
- scipy.linalg.svdvals
Compute singular values of a matrix.
Aliases
-
numpy.linalg.svdvals