MCPcopy Index your code
hub / github.com/numpy/numpy / test_matrix

Method test_matrix

numpy/lib/tests/test_twodim_base.py:145–158  ·  view source on GitHub ↗
(self, vals=None)

Source from the content-addressed store, hash-verified

143 assert_equal(diag(vals, k=-2), c)
144
145 def test_matrix(self, vals=None):
146 if vals is None:
147 vals = (100 * get_mat(5) + 1).astype('l')
148 b = zeros((5,))
149 for k in range(5):
150 b[k] = vals[k, k]
151 assert_equal(diag(vals), b)
152 b = b * 0
153 for k in range(3):
154 b[k] = vals[k, k + 2]
155 assert_equal(diag(vals, 2), b[:3])
156 for k in range(3):
157 b[k] = vals[k + 2, k]
158 assert_equal(diag(vals, -2), b[:3])
159
160 def test_fortran_order(self):
161 vals = array((100 * get_mat(5) + 1), order='F', dtype='l')

Callers 1

test_fortran_orderMethod · 0.95

Calls 5

zerosFunction · 0.90
assert_equalFunction · 0.90
diagFunction · 0.90
astypeMethod · 0.80
get_matFunction · 0.70

Tested by

no test coverage detected