Example #1
0
 def test_identity_multiplication(self):
     eye = np.eye(3)
     a = np.random.random((3, 3)) * 10
     self.assertEqual(
         np.equal(examples.mul(eye, a), examples.mul(a, eye)).all(), True)
     self.assertEqual(
         np.equal(examples.mul(eye, a), eye.dot(a)).all(), True)
Example #2
0
 def test_matrix_multiplication(self):
     a = np.array([[1., 2., 3., 4.],
                   [4., 3., 2., 1.]])
     b = np.array([[ 1., 0.],
                   [ 2., 3.],
                   [ 4., 4.],
                   [-1., 2.]])
     self.assertEqual(np.equal(examples.mul(a, b), a.dot(b)).all(), True)
Example #3
0
 def test_identity_multiplication(self):
     eye = np.eye(3)
     a = np.random.random((3, 3)) * 10
     self.assertEqual(np.equal(examples.mul(eye, a),
                               examples.mul(a, eye)).all(), True)
     self.assertEqual(np.equal(examples.mul(eye, a), eye.dot(a)).all(), True)
Example #4
0
 def test_matrix_squaring(self):
     a = np.array([[1., 2., 3.],
                   [4., 5., 6.],
                   [7., 8., 9.]])
     self.assertEqual(np.equal(examples.mul(a, a), a.dot(a)).all(), True)
Example #5
0
 def test_vector_multiplication(self):
     a = np.array([[1., 2., 3.]])
     b = a.reshape(3, 1)
     self.assertEqual(np.equal(examples.mul(a, b), a.dot(b)).all(), True)
Example #6
0
 def test_matrix_multiplication(self):
     a = np.array([[1., 2., 3., 4.], [4., 3., 2., 1.]])
     b = np.array([[1., 0.], [2., 3.], [4., 4.], [-1., 2.]])
     self.assertEqual(np.equal(examples.mul(a, b), a.dot(b)).all(), True)
Example #7
0
 def test_matrix_squaring(self):
     a = np.array([[1., 2., 3.], [4., 5., 6.], [7., 8., 9.]])
     self.assertEqual(np.equal(examples.mul(a, a), a.dot(a)).all(), True)
Example #8
0
 def test_vector_multiplication(self):
     a = np.array([[1., 2., 3.]])
     b = a.reshape(3, 1)
     self.assertEqual(np.equal(examples.mul(a, b), a.dot(b)).all(), True)
 def test_matrix_squaring(self):
     a = np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]])
     self.assertEqual(np.equal(examples.mul(a, a), a.dot(a)).all(), True)