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

Method test_matrix_2x2

numpy/linalg/tests/test_linalg.py:1559–1573  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1557 np.testing.assert_almost_equal(an, 2.7320508075688772, decimal=6)
1558
1559 def test_matrix_2x2(self):
1560 A = self.array([[1, 3], [5, 7]], dtype=self.dt)
1561 assert_almost_equal(norm(A), 84 ** 0.5)
1562 assert_almost_equal(norm(A, 'fro'), 84 ** 0.5)
1563 assert_almost_equal(norm(A, 'nuc'), 10.0)
1564 assert_almost_equal(norm(A, inf), 12.0)
1565 assert_almost_equal(norm(A, -inf), 4.0)
1566 assert_almost_equal(norm(A, 1), 10.0)
1567 assert_almost_equal(norm(A, -1), 6.0)
1568 assert_almost_equal(norm(A, 2), 9.1231056256176615)
1569 assert_almost_equal(norm(A, -2), 0.87689437438234041)
1570
1571 assert_raises(ValueError, norm, A, 'nofro')
1572 assert_raises(ValueError, norm, A, -3)
1573 assert_raises(ValueError, norm, A, 0)
1574
1575 def test_matrix_3x3(self):
1576 # This test has been added because the 2x2 example

Callers

nothing calls this directly

Calls 3

assert_almost_equalFunction · 0.90
normFunction · 0.90
assert_raisesFunction · 0.90

Tested by

no test coverage detected