def test_EyeLike2D_bool_3(self): np_a = np.reshape(self.np_bool_a, (6, 8)) dc_a = dc.reshape(self.dc_bool_a, (6, 8)) npr = np.eye(6, 8, k=self.k) dcr = dc.eye_like(dc_a, self.k) np.testing.assert_allclose(npr.flatten(), np.array(dcr.data()).astype(np.bool), rtol=1e-3, atol=1e-3)
def test_EyeLike2D_int_2(self): np_a = np.reshape(self.np_int_a, (2, 24)) dc_a = dc.reshape(self.dc_int_a, (2, 24)) npr = np.eye(2, 24, k=self.k) dcr = dc.eye_like(dc_a, self.k) np.testing.assert_allclose(npr.flatten(), np.array(dcr.data()).astype(np.int), rtol=1e-3, atol=1e-3)
def test_EyeLike2D_double_1(self): np_a = np.reshape(self.np_double_a, (12, 4)) dc_a = dc.reshape(self.dc_double_a, (12, 4)) npr = np.eye(12, 4, k=self.k) dcr = dc.eye_like(dc_a, self.k) np.testing.assert_allclose(npr.flatten(), np.array(dcr.data()).astype(np.float64), rtol=1e-3, atol=1e-3)