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

Method test_vector

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

Source from the content-addressed store, hash-verified

111
112class TestDiag:
113 def test_vector(self):
114 vals = (100 * arange(5)).astype('l')
115 b = zeros((5, 5))
116 for k in range(5):
117 b[k, k] = vals[k]
118 assert_equal(diag(vals), b)
119 b = zeros((7, 7))
120 c = b.copy()
121 for k in range(5):
122 b[k, k + 2] = vals[k]
123 c[k + 2, k] = vals[k]
124 assert_equal(diag(vals, k=2), b)
125 assert_equal(diag(vals, k=-2), c)
126
127 def test_matrix(self, vals=None):
128 if vals is None:

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected