Exemple #1
0
 def test_copy_from(self):
     v = self.v.copy()
     S = self.S.copy(True)
     X = SizedArrayPtr().alloc(S.size)
     npt.assert_array_equal(v, S.to_numpy())
     X.copy_from(S)
     npt.assert_array_equal(X.to_numpy(), S.to_numpy())
     del S
     npt.assert_array_equal(v, X.to_numpy())
Exemple #2
0
 def test_transpose(self):
     s = SizedArrayPtr(self.v.copy(), "transpose s")
     s.transpose()
     ref = self.v
     tst = s.to_numpy()
     npt.assert_array_equal(ref, tst)
Exemple #3
0
 def test_SizedArray2_roundtrip(self):
     v2 = np.random.random((10, 5))
     s = SizedArrayPtr(v2, "Round Trip")
     ref = v2
     tst = s.to_numpy()
     npt.assert_array_equal(ref, tst)
Exemple #4
0
 def setUp(self):
     self.scalar = 23.214
     self.v = np.ones(8)
     self.v2 = self.v + 2
     self.S = SizedArrayPtr(self.v.copy())
     self.S2 = SizedArrayPtr(self.v2.copy())
Exemple #5
0
 def test_roundtrip(self):
     s = SizedArrayPtr(self.v.copy(), "Round Trip")
     ref = self.v
     tst = s.to_numpy()
     npt.assert_array_equal(ref, tst)