예제 #1
0
 def test_fold(self):
     A = init([[1, 2], [3, 4]])
     B = triangular.init([1, sqrt(2) * 2, 4])  # ???
     np.testing.assert_almost_equal(np.array(A.fold()), np.array(B))
예제 #2
0
 def test_lower(self):
     A = init([[1, 2], [3, 4]])
     B = triangular.init([1, 2, 4])
     np.testing.assert_almost_equal(
         np.array(A.lower()), np.array(B)
     )
예제 #3
0
 def test_pack_triangular_anti(self):
     A = init([[1, 2], [3, 4]])
     B = triangular.init([0, -0.5, 0])
     np.testing.assert_almost_equal(
         np.array(A.pack(anti=True)), np.array(B)
     )
예제 #4
0
 def test_pack_triangular(self):
     A = init([[1, 2], [3, 4]])
     B = triangular.init([1, 2.5, 4])
     np.testing.assert_almost_equal(np.array(A.pack()), np.array(B))
예제 #5
0
 def test_scalar_mul_triangluar(self):
     A = triangular.init([1, 2, 3])
     np.testing.assert_allclose(np.array(2 * A), [2.0, 4.0, 6.0])
예제 #6
0
 def test_mul_triangluar(self):
     A = triangular.init([1, 2, 3])
     np.testing.assert_allclose(A * A, [[5, 8], [8, 13]])