summaryrefslogtreecommitdiff
path: root/numpy/linalg/linalg.py
diff options
context:
space:
mode:
authorDiego Wang <wltok@live.com>2022-02-24 17:37:27 -0500
committerGitHub <noreply@github.com>2022-02-24 17:37:27 -0500
commit40747ae50620631941e43dbbd5baaccab669922f (patch)
tree5eafa4dd3d64c87139f1785d2b45c483bec25114 /numpy/linalg/linalg.py
parenta33a10a5f494057b9ddcb9efe650306fccf8eba3 (diff)
downloadnumpy-40747ae50620631941e43dbbd5baaccab669922f.tar.gz
clarify svd documentation
`u @ np.diag(s) @ vh` can only reproduce the original matrix when `full_matrices` is `False`, otherwise dimension does not match.
Diffstat (limited to 'numpy/linalg/linalg.py')
-rw-r--r--numpy/linalg/linalg.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py
index 6b0294659..f0954b996 100644
--- a/numpy/linalg/linalg.py
+++ b/numpy/linalg/linalg.py
@@ -1478,8 +1478,9 @@ def svd(a, full_matrices=True, compute_uv=True, hermitian=False):
"""
Singular Value Decomposition.
- When `a` is a 2D array, it is factorized as ``u @ np.diag(s) @ vh
- = (u * s) @ vh``, where `u` and `vh` are 2D unitary arrays and `s` is a 1D
+ When `a` is a 2D array, and when `full_matrices` is `False`,
+ it is factorized as ``u @ np.diag(s) @ vh = (u * s) @ vh``,
+ where `u` and `vh` are 2D unitary arrays and `s` is a 1D
array of `a`'s singular values. When `a` is higher-dimensional, SVD is
applied in stacked mode as explained below.