def test_astype_cbc(self):
     new_dtype = np.int8
     d = Distribution(comm=self.comm, dim_data=self.ddpr[self.comm.Get_rank()])
     a = LocalArray(d, dtype=np.int32)
     a.fill(12)
     b = a.astype(new_dtype)
     assert_localarrays_allclose(a, b, check_dtype=False)
     self.assertEqual(b.dtype, new_dtype)
     self.assertEqual(b.ndarray.dtype, new_dtype)
 def test_astype_bn(self):
     new_dtype = np.float32
     d = Distribution.from_shape((16, 16), dist=('b', 'n'),  comm=self.comm)
     a = LocalArray(d, dtype=np.int_)
     a.fill(11)
     b = a.astype(new_dtype)
     assert_localarrays_allclose(a, b, check_dtype=False)
     self.assertEqual(b.dtype, new_dtype)
     self.assertEqual(b.ndarray.dtype, new_dtype)
Exemple #3
0
 def test_astype_cbc(self):
     new_dtype = np.int8
     d = Distribution(comm=self.comm,
                      dim_data=self.ddpr[self.comm.Get_rank()])
     a = LocalArray(d, dtype=np.int32)
     a.fill(12)
     b = a.astype(new_dtype)
     assert_localarrays_allclose(a, b, check_dtype=False)
     self.assertEqual(b.dtype, new_dtype)
     self.assertEqual(b.ndarray.dtype, new_dtype)
Exemple #4
0
 def test_astype_bn(self):
     new_dtype = np.float32
     d = Distribution.from_shape(comm=self.comm,
                                 shape=(16, 16),
                                 dist=('b', 'n'))
     a = LocalArray(d, dtype=np.int_)
     a.fill(11)
     b = a.astype(new_dtype)
     assert_localarrays_allclose(a, b, check_dtype=False)
     self.assertEqual(b.dtype, new_dtype)
     self.assertEqual(b.ndarray.dtype, new_dtype)