summaryrefslogtreecommitdiff
path: root/numpy/linalg/linalg.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2008-04-27 18:19:12 +0000
committerCharles Harris <charlesr.harris@gmail.com>2008-04-27 18:19:12 +0000
commit8d915a55c5ecbca15ebaf13584b0c255d22768a1 (patch)
treed52d327f96ba75883d48ec3e11470ebb4d68435c /numpy/linalg/linalg.py
parent82909417beb52eea0568fa04f54188ada227d66e (diff)
downloadnumpy-8d915a55c5ecbca15ebaf13584b0c255d22768a1.tar.gz
Add tests for matrix return types.
Fix cond computations for matrices. lstsq is currently broken for matrices, will fix shortly.
Diffstat (limited to 'numpy/linalg/linalg.py')
-rw-r--r--numpy/linalg/linalg.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py
index d31ea527e..a557af875 100644
--- a/numpy/linalg/linalg.py
+++ b/numpy/linalg/linalg.py
@@ -27,7 +27,7 @@ from numpy.core import array, asarray, zeros, empty, transpose, \
isfinite, size
from numpy.lib import triu
from numpy.linalg import lapack_lite
-from numpy.core.defmatrix import matrix_power
+from numpy.core.defmatrix import matrix_power, matrix
fortran_int = intc
@@ -983,7 +983,7 @@ def svd(a, full_matrices=1, compute_uv=1):
else:
return wrap(s)
-def cond(x,p=None):
+def cond(x, p=None):
"""Compute the condition number of a matrix.
The condition number of x is the norm of x times the norm
@@ -1014,6 +1014,7 @@ def cond(x,p=None):
c : float
The condition number of the matrix. May be infinite.
"""
+ x = asarray(x) # in case we have a matrix
if p is None:
s = svd(x,compute_uv=False)
return s[0]/s[-1]
@@ -1146,7 +1147,7 @@ def lstsq(a, b, rcond=-1):
"""
import math
- a = asarray(a)
+ a = _makearray(a)
b, wrap = _makearray(b)
one_eq = len(b.shape) == 1
if one_eq: