bundles / scipy 1.17.1 / scipy / linalg / _decomp_svd / svdvals
function
scipy.linalg._decomp_svd:svdvals
Signature
def svdvals ( a , overwrite_a = False , check_finite = True ) Summary
Compute singular values of a matrix.
Extended Summary
The documentation is written assuming array arguments are of specified "core" shapes. However, array argument(s) of this function may have additional "batch" dimensions prepended to the core shape. In this case, the array is treated as a batch of lower-dimensional slices; see linalg_batch for details. Note that calls with zero-size batches are unsupported and will raise a ValueError.
Parameters
a: (M, N) array_likeMatrix to decompose.
overwrite_a: bool, optionalWhether to overwrite
a; may improve performance. Default is False.check_finite: bool, optionalWhether to check that the input matrix contains only finite numbers. Disabling may give a performance gain, but may result in problems (crashes, non-termination) if the inputs do contain infinities or NaNs.
Returns
s: (min(M, N),) ndarrayThe singular values, sorted in decreasing order.
Raises
: LinAlgErrorIf SVD computation does not converge.
Examples
import numpy as np from scipy.linalg import svdvals m = np.array([[1.0, 0.0], [2.0, 3.0], [1.0, 1.0], [0.0, 2.0], [1.0, 0.0]])✓
svdvals(m)
✗t = np.linspace(0, np.pi, 2000) u = np.array([np.cos(t), np.sin(t)])✓
np.linalg.norm(m.dot(u), axis=0).max()
✗v = np.array([0.1, 0.3, 0.9, 0.3]) p = np.outer(v, v)✓
svdvals(p)
✗from scipy.stats import ortho_group orth = ortho_group.rvs(4)✓
svdvals(orth)
✗See also
- diagsvd
Construct the Sigma matrix, given the vector s.
- svd
Compute the full singular value decomposition of a matrix.
Aliases
-
scipy.linalg.svdvals