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

Method test_matrix_3x3

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

Source from the content-addressed store, hash-verified

1478 assert_raises(ValueError, norm, A, 0)
1479
1480 def test_matrix_3x3(self):
1481 # This test has been added because the 2x2 example
1482 # happened to have equal nuclear norm and induced 1-norm.
1483 # The 1/10 scaling factor accommodates the absolute tolerance
1484 # used in assert_almost_equal.
1485 A = (1 / 10) * \
1486 self.array([[1, 2, 3], [6, 0, 5], [3, 2, 1]], dtype=self.dt)
1487 assert_almost_equal(norm(A), (1 / 10) * 89 ** 0.5)
1488 assert_almost_equal(norm(A, 'fro'), (1 / 10) * 89 ** 0.5)
1489 assert_almost_equal(norm(A, 'nuc'), 1.3366836911774836)
1490 assert_almost_equal(norm(A, inf), 1.1)
1491 assert_almost_equal(norm(A, -inf), 0.6)
1492 assert_almost_equal(norm(A, 1), 1.0)
1493 assert_almost_equal(norm(A, -1), 0.4)
1494 assert_almost_equal(norm(A, 2), 0.88722940323461277)
1495 assert_almost_equal(norm(A, -2), 0.19456584790481812)
1496
1497 def test_bad_args(self):
1498 # Check that bad arguments raise the appropriate exceptions.

Callers

nothing calls this directly

Calls 2

assert_almost_equalFunction · 0.90
normFunction · 0.90

Tested by

no test coverage detected