Beispiel #1
0
 def testMtimes(self):
     a = Array([1, 2, 3, 4])
     b = Array([1, 2, 3, 4])
     d = a.transpose()
     c = b.matmul(d)
     expected = np.transpose([[1, 2, 3, 4], [2, 4, 6, 8], [3, 6, 9, 12], [4, 8, 12, 16]])
     np.testing.assert_array_equal(c.to_numpy(), expected)
Beispiel #2
0
 def testTranspose(self):
     a = Array([[1, 3], [2, 4]], dtype.s32)
     c = a.transpose()
     np.testing.assert_array_equal(c.to_numpy(), np.array([[1, 2], [3, 4]]))
Beispiel #3
0
 def testCtranspose(self):
     a = Array([[0 - 1j, 4 + 2j], [2 + 1j, 0 - 2j]], khiva_type=dtype.c32)
     b = a.transpose(True)
     expected = [[0 + 1j, 2 - 1j], [4 - 2j, 0 + 2j]]
     np.testing.assert_array_equal(b.to_numpy(), expected)