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

Method test_matrix_2x2

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

Source from the content-addressed store, hash-verified

1462 np.testing.assert_almost_equal(an, 2.7320508075688772, decimal=6)
1463
1464 def test_matrix_2x2(self):
1465 A = self.array([[1, 3], [5, 7]], dtype=self.dt)
1466 assert_almost_equal(norm(A), 84 ** 0.5)
1467 assert_almost_equal(norm(A, 'fro'), 84 ** 0.5)
1468 assert_almost_equal(norm(A, 'nuc'), 10.0)
1469 assert_almost_equal(norm(A, inf), 12.0)
1470 assert_almost_equal(norm(A, -inf), 4.0)
1471 assert_almost_equal(norm(A, 1), 10.0)
1472 assert_almost_equal(norm(A, -1), 6.0)
1473 assert_almost_equal(norm(A, 2), 9.1231056256176615)
1474 assert_almost_equal(norm(A, -2), 0.87689437438234041)
1475
1476 assert_raises(ValueError, norm, A, 'nofro')
1477 assert_raises(ValueError, norm, A, -3)
1478 assert_raises(ValueError, norm, A, 0)
1479
1480 def test_matrix_3x3(self):
1481 # 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