summaryrefslogtreecommitdiff
path: root/numpy/linalg/tests
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/linalg/tests')
-rw-r--r--numpy/linalg/tests/test_build.py10
-rw-r--r--numpy/linalg/tests/test_linalg.py10
-rw-r--r--numpy/linalg/tests/test_regression.py17
3 files changed, 27 insertions, 10 deletions
diff --git a/numpy/linalg/tests/test_build.py b/numpy/linalg/tests/test_build.py
index 27fbd6429..0d237c81c 100644
--- a/numpy/linalg/tests/test_build.py
+++ b/numpy/linalg/tests/test_build.py
@@ -20,16 +20,16 @@ class FindDependenciesLdd(object):
except OSError:
raise RuntimeError("command %s cannot be run" % self.cmd)
- def get_dependencies(self, file):
- p = Popen(self.cmd + [file], stdout=PIPE, stderr=PIPE)
+ def get_dependencies(self, lfile):
+ p = Popen(self.cmd + [lfile], stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
if not (p.returncode == 0):
- raise RuntimeError("Failed to check dependencies for %s" % libfile)
+ raise RuntimeError("failed dependencies check for %s" % lfile)
return stdout
- def grep_dependencies(self, file, deps):
- stdout = self.get_dependencies(file)
+ def grep_dependencies(self, lfile, deps):
+ stdout = self.get_dependencies(lfile)
rdeps = dict([(dep, re.compile(dep)) for dep in deps])
founds = []
diff --git a/numpy/linalg/tests/test_linalg.py b/numpy/linalg/tests/test_linalg.py
index 0c21a4229..8edf36aa6 100644
--- a/numpy/linalg/tests/test_linalg.py
+++ b/numpy/linalg/tests/test_linalg.py
@@ -1130,13 +1130,13 @@ def test_xerbla_override():
os._exit(os.EX_CONFIG)
try:
- a = np.array([[1]])
- np.linalg.lapack_lite.dgetrf(
- 1, 1, a.astype(np.double),
+ a = np.array([[1.]])
+ np.linalg.lapack_lite.dorgqr(
+ 1, 1, 1, a,
0, # <- invalid value
- a.astype(np.intc), 0)
+ a, a, 0, 0)
except ValueError as e:
- if "DGETRF parameter number 4" in str(e):
+ if "DORGQR parameter number 5" in str(e):
# success
os._exit(os.EX_OK)
diff --git a/numpy/linalg/tests/test_regression.py b/numpy/linalg/tests/test_regression.py
index 4ff14a6a5..18d212cdc 100644
--- a/numpy/linalg/tests/test_regression.py
+++ b/numpy/linalg/tests/test_regression.py
@@ -69,5 +69,22 @@ class TestRegression(TestCase):
bp = linalg.cholesky(b)
assert_array_equal(ap, bp)
+ def test_large_svd_32bit(self):
+ # See gh-4442, 64bit would require very large/slow matrices.
+ x = np.eye(1000, 66)
+ np.linalg.svd(x)
+
+ def test_svd_no_uv(self):
+ # gh-4733
+ for shape in (3, 4), (4, 4), (4, 3):
+ for t in float, complex:
+ a = np.ones(shape, dtype=t)
+ w = linalg.svd(a, compute_uv=False)
+ c = np.count_nonzero(np.absolute(w) > 0.5)
+ assert_equal(c, 1)
+ assert_equal(np.linalg.matrix_rank(a), 1)
+ assert_array_less(1, np.linalg.norm(a, ord=2))
+
+
if __name__ == '__main__':
run_module_suite()