def test_add(self):
     self.matrix = MatrixCuda.zero(4, 3)
     other = MatrixCuda.zero(4, 3)
     other2 = MatrixCuda.zero(4, 4)
     new = self.matrix + other
     with self.assertRaises(ValueError):
         _ = self.matrix + other2
     np.testing.assert_equal(self.matrix.value, new.value)
 def test_multiply(self):
     self.matrix = MatrixCuda.identity(3)
     other = MatrixCuda([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
     self.assertEqual(self.matrix * other, other)
     self.assertEqual(MatrixCuda.zero(3, 3) * self.matrix,
                      MatrixCuda.zero(3, 3))
     self.matrix = MatrixCuda([[1, 1, 1], [2, 2, 2]])
     self.assertEqual((self.matrix * self.matrix.T).size(), (2, 2))
     self.assertEqual((self.matrix.T * self.matrix).size(), (3, 3))
     self.matrix = MatrixCuda([[-1, 0], [0, 1]])
     self.assertEqual(self.matrix * self.matrix, MatrixCuda.identity(2))
 def test_zero(self):
     self.matrix = MatrixCuda.zero(4, 3)
     zero_array = [[0 for _ in range(3)] for _ in range(4)]
     np.testing.assert_equal(self.matrix.value, zero_array)
     self.assertRaises(ValueError, self.matrix.zero, *(-1, 3))
     #self.assertRaises(ValueError, self.matrix.zero, *(2, 0))
     self.assertRaises(ValueError, self.matrix.zero, *(-1, -1))