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

Method test_vector

numpy/lib/tests/test_twodim_base.py:131–143  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

129
130class TestDiag:
131 def test_vector(self):
132 vals = (100 * arange(5)).astype('l')
133 b = zeros((5, 5))
134 for k in range(5):
135 b[k, k] = vals[k]
136 assert_equal(diag(vals), b)
137 b = zeros((7, 7))
138 c = b.copy()
139 for k in range(5):
140 b[k, k + 2] = vals[k]
141 c[k + 2, k] = vals[k]
142 assert_equal(diag(vals, k=2), b)
143 assert_equal(diag(vals, k=-2), c)
144
145 def test_matrix(self, vals=None):
146 if vals is None:

Callers

nothing calls this directly

Calls 5

zerosFunction · 0.90
assert_equalFunction · 0.90
diagFunction · 0.90
astypeMethod · 0.80
copyMethod · 0.45

Tested by

no test coverage detected