summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/oldnumeric.py2
-rw-r--r--numpy/linalg/linalg.py12
-rw-r--r--numpy/linalg/old.py6
3 files changed, 10 insertions, 10 deletions
diff --git a/numpy/core/oldnumeric.py b/numpy/core/oldnumeric.py
index 801d71295..4531a1056 100644
--- a/numpy/core/oldnumeric.py
+++ b/numpy/core/oldnumeric.py
@@ -514,7 +514,7 @@ def alen(a):
try:
return len(a)
except TypeError:
- return len(atleast_1d(a))
+ return len(array(a,ndmin=1))
def prod(a, axis=0, dtype=None):
"""Return the product of the elements along the given axis
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py
index aa807419e..571cf3979 100644
--- a/numpy/linalg/linalg.py
+++ b/numpy/linalg/linalg.py
@@ -12,6 +12,7 @@ __all__ = ['solve',
'eigvalsh', 'pinv',
'det', 'svd',
'eig', 'eigh','lstsq', 'norm',
+ 'LinAlgError'
]
from numpy.core import *
@@ -19,9 +20,11 @@ from numpy.lib import *
from old import solve_linear_equations
import lapack_lite
+# Error object
+class LinAlgError(Exception):
+ pass
+
# Helper routines
-_lapack_type = {'f': 0, 'd': 1, 'F': 2, 'D': 3}
-_lapack_letter = ['s', 'd', 'c', 'z']
_array_kind = {'i':0, 'l': 0, 'f': 0, 'd': 0, 'F': 1, 'D': 1}
_array_precision = {'i': 1, 'l': 1, 'f': 0, 'd': 1, 'F': 0, 'D': 1}
_array_type = [['f', 'd'], ['F', 'D']]
@@ -108,7 +111,7 @@ def solve(a, b):
def inv(a):
a, wrap = _makearray(a)
- return wrap(solve_linear_equations(a, identity(a.shape[0])))
+ return wrap(solve(a, identity(a.shape[0])))
# Cholesky decomposition
@@ -415,8 +418,7 @@ def det(a):
lapack_routine = lapack_lite.dgetrf
pivots = zeros((n,), 'i')
results = lapack_routine(n, n, a, n, pivots, 0)
- sign = add.reduce(not_equal(pivots,
- arrayrange(1, n+1))) % 2
+ sign = add.reduce(not_equal(pivots, arrayrange(1, n+1))) % 2
return (1.-2.*sign)*multiply.reduce(diagonal(a),axis=-1)
# Linear Least Squares
diff --git a/numpy/linalg/old.py b/numpy/linalg/old.py
index a1c3a033f..2ac1e9d48 100644
--- a/numpy/linalg/old.py
+++ b/numpy/linalg/old.py
@@ -18,12 +18,10 @@ __all__ = ['LinAlgError', 'solve_linear_equations',
from numpy.core import transpose
import linalg
-# Error object
-class LinAlgError(Exception):
- pass
-
# Linear equations
+LinAlgError = linalg.LinAlgError
+
def solve_linear_equations(a, b):
return linalg.solve(a,b)