summaryrefslogtreecommitdiff
path: root/numpy/linalg/linalg.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-08-29 10:28:11 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-08-29 10:28:11 +0000
commit775a47de7e2f4b039592d614e7ac3fda464975a8 (patch)
tree6ec0d74f0505ba0e60f3ee01af70b4669ec38475 /numpy/linalg/linalg.py
parentce7a968a7b5cdb328ca1ea222211ad9cd8e506ad (diff)
downloadnumpy-775a47de7e2f4b039592d614e7ac3fda464975a8.tar.gz
Add axis arguments to various functions so as not to rely on the defaults.
Diffstat (limited to 'numpy/linalg/linalg.py')
-rw-r--r--numpy/linalg/linalg.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py
index 8dec67318..e0b3268a6 100644
--- a/numpy/linalg/linalg.py
+++ b/numpy/linalg/linalg.py
@@ -661,11 +661,11 @@ Singular values less than s[0]*rcond are treated as zero.
if one_eq:
x = array(ravel(bstar)[:n], dtype=result_t, copy=True)
if results['rank']==n and m>n:
- resids = array([sum((ravel(bstar)[n:])**2)], dtype=result_t)
+ resids = array([sum((ravel(bstar)[n:])**2,axis=0)], dtype=result_t)
else:
x = array(transpose(bstar)[:n,:], dtype=result_t, copy=True)
if results['rank']==n and m>n:
- resids = sum((transpose(bstar)[n:,:])**2).astype(result_t)
+ resids = sum((transpose(bstar)[n:,:])**2,axis=0).astype(result_t)
st = s[:min(n,m)].copy().astype(_realType(result_t))
return wrap(x), resids, results['rank'], st
@@ -687,7 +687,7 @@ def norm(x, ord=None):
For vectors ord can be any real number including Inf or -Inf.
ord = Inf, computes the maximum of the magnitudes
ord = -Inf, computes minimum of the magnitudes
- ord is finite, computes sum(abs(x)**ord)**(1.0/ord)
+ ord is finite, computes sum(abs(x)**ord,axis=0)**(1.0/ord)
For matrices ord can only be one of the following values:
ord = 2 computes the largest singular value
@@ -696,7 +696,7 @@ def norm(x, ord=None):
ord = -1 computes the smallest column sum of absolute values
ord = Inf computes the largest row sum of absolute values
ord = -Inf computes the smallest row sum of absolute values
- ord = 'fro' computes the frobenius norm sqrt(sum(diag(X.H * X)))
+ ord = 'fro' computes the frobenius norm sqrt(sum(diag(X.H * X),axis=0))
For values ord < 0, the result is, strictly speaking, not a
mathematical 'norm', but it may still be useful for numerical purposes.