summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Appelhoff <stefan.appelhoff@mailbox.org>2020-09-19 11:48:11 +0200
committerStefan Appelhoff <stefan.appelhoff@mailbox.org>2020-09-19 11:48:15 +0200
commita9b4bff3613a0081703f46523d37f81982170a8c (patch)
tree54cf50782238013653947f15727f77235d57d464
parent3b294521a7394c2195e6b2980555c6b27258bac9 (diff)
downloadnumpy-a9b4bff3613a0081703f46523d37f81982170a8c.tar.gz
DOC: clarify residuals return param
Specify that the sum of *squared* residuals are returned. Use @ operator instead of * in code example.
-rw-r--r--numpy/linalg/linalg.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py
index 92f93d671..b6d860dfa 100644
--- a/numpy/linalg/linalg.py
+++ b/numpy/linalg/linalg.py
@@ -2206,8 +2206,8 @@ def lstsq(a, b, rcond="warn"):
Least-squares solution. If `b` is two-dimensional,
the solutions are in the `K` columns of `x`.
residuals : {(1,), (K,), (0,)} ndarray
- Sums of residuals; squared Euclidean 2-norm for each column in
- ``b - a*x``.
+ Sums of squared residuals: Squared Euclidean 2-norm for each column in
+ ``b - a @ x``.
If the rank of `a` is < N or M <= N, this is an empty array.
If `b` is 1-dimensional, this is a (1,) shape array.
Otherwise the shape is (K,).
@@ -2558,7 +2558,7 @@ def norm(x, ord=None, axis=None, keepdims=False):
# special case for speedup
s = (x.conj() * x).real
return sqrt(add.reduce(s, axis=axis, keepdims=keepdims))
- # None of the str-type keywords for ord ('fro', 'nuc')
+ # None of the str-type keywords for ord ('fro', 'nuc')
# are valid for vectors
elif isinstance(ord, str):
raise ValueError(f"Invalid norm order '{ord}' for vectors")