MCPcopy Create free account
hub / github.com/numpy/numpy / test_basic

Method test_basic

numpy/matrixlib/tests/test_defmatrix.py:124–139  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

122 assert_equal(x.var(ddof=1), mx.var(ddof=1))
123
124 def test_basic(self):
125 import numpy.linalg as linalg
126
127 A = np.array([[1., 2.],
128 [3., 4.]])
129 mA = matrix(A)
130 assert_(np.allclose(linalg.inv(A), mA.I))
131 assert_(np.all(np.array(np.transpose(A) == mA.T)))
132 assert_(np.all(np.array(np.transpose(A) == mA.H)))
133 assert_(np.all(A == mA.A))
134
135 B = A + 2j*A
136 mB = matrix(B)
137 assert_(np.allclose(linalg.inv(B), mB.I))
138 assert_(np.all(np.array(np.transpose(B) == mB.T)))
139 assert_(np.all(np.array(np.transpose(B).conj() == mB.H)))
140
141 def test_pinv(self):
142 x = matrix(np.arange(6).reshape(2, 3))

Callers

nothing calls this directly

Calls 3

matrixClass · 0.90
assert_Function · 0.90
allMethod · 0.45

Tested by

no test coverage detected