Permalink
Browse files

cleanup & typos in tests

  • Loading branch information...
1 parent dd25b44 commit 2124056e54689b7670116efe18a6ad03ecb1fd36 @jakevdp committed Aug 18, 2012
Showing with 11 additions and 11 deletions.
  1. +1 −1 scipy/linalg/basic.py
  2. +10 −10 scipy/linalg/tests/test_basic.py
@@ -632,7 +632,7 @@ def pinvh(a, cond=None, rcond=None, lower=True):
>>> from numpy import *
>>> a = random.randn(9, 6)
>>> a = np.dot(a, a.T)
- >>> B = pinv_symmetric(a)
+ >>> B = pinvh(a)
>>> allclose(a, dot(a, dot(B, a)))
True
>>> allclose(B, dot(B, dot(a, B)))
@@ -535,34 +535,34 @@ def test_random_complex_overdet(self):
class TestPinv(TestCase):
def test_simple_real(self):
- a = array([[1,2,3], [4,5,6.], [7,8,10]])
+ a = array([[1, 2, 3], [4, 5, 6], [7, 8, 10]], dtype=float)
a_pinv = pinv(a)
assert_array_almost_equal(dot(a,a_pinv), np.eye(3))
a_pinv = pinv2(a)
assert_array_almost_equal(dot(a,a_pinv), np.eye(3))
def test_simple_complex(self):
- a = (array([[1, 2, 3], [4, 5, 6], [7, 8, 10]])
- + 1j * array([[10, 8, 7], [6, 5, 4], [3, 2, 1]]))
+ a = (array([[1, 2, 3], [4, 5, 6], [7, 8, 10]], dtype=float)
+ + 1j * array([[10, 8, 7], [6, 5, 4], [3, 2, 1]], dtype=float))
a_pinv = pinv(a)
assert_array_almost_equal(dot(a, a_pinv), np.eye(3))
a_pinv = pinv2(a)
assert_array_almost_equal(dot(a, a_pinv), np.eye(3))
def test_simple_singular(self):
- a = array([[1,2,3],[4,5,6.],[7,8,9]])
+ a = array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=float)
a_pinv = pinv(a)
a_pinv2 = pinv2(a)
assert_array_almost_equal(a_pinv,a_pinv2)
def test_simple_cols(self):
- a = array([[1,2,3],[4,5,6.]])
+ a = array([[1, 2, 3], [4, 5, 6]], dtype=float)
a_pinv = pinv(a)
a_pinv2 = pinv2(a)
assert_array_almost_equal(a_pinv,a_pinv2)
def test_simple_rows(self):
- a = array([[1,2],[3,4],[5,6]])
+ a = array([[1, 2], [3, 4], [5, 6]], dtype=float)
a_pinv = pinv(a)
a_pinv2 = pinv2(a)
assert_array_almost_equal(a_pinv,a_pinv2)
@@ -571,13 +571,13 @@ def test_simple_rows(self):
class TestPinvSymmetric(TestCase):
def test_simple_real(self):
- a = array([[1,2,3], [4,5,6.], [7,8,10]])
+ a = array([[1, 2, 3], [4, 5, 6], [7, 8, 10]], dtype=float)
a = np.dot(a, a.T)
a_pinv = pinvh(a)
assert_array_almost_equal(np.dot(a, a_pinv), np.eye(3))
def test_nonpositive(self):
- a = array([[1,2,3], [4,5,6.], [7,8,9]])
+ a = array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=float)
a = np.dot(a, a.T)
u, s, vt = np.linalg.svd(a)
s[0] *= -1
@@ -587,8 +587,8 @@ def test_nonpositive(self):
assert_array_almost_equal(a_pinv, a_pinvh)
def test_simple_complex(self):
- a = (array([[1, 2, 3], [4, 5, 6], [7, 8, 10]])
- + 1j * array([[10, 8, 7], [6, 5, 4], [3, 2, 1]]))
+ a = (array([[1, 2, 3], [4, 5, 6], [7, 8, 10]], dtype=float)
+ + 1j * array([[10, 8, 7], [6, 5, 4], [3, 2, 1]], dtype=float))
a = np.dot(a, a.conj().T)
a_pinv = pinvh(a)
assert_array_almost_equal(np.dot(a, a_pinv), np.eye(3))

0 comments on commit 2124056

Please sign in to comment.