Example #1
0
 def test_poly1d_numpy_poly1d_variable(self, xp, dtype):
     array = testing.shaped_arange((5, ), numpy, dtype)
     a = numpy.poly1d(array, variable='z')
     with cupyx.allow_synchronize(False):
         out = xp.poly1d(a, variable=self.variable)
     assert out.variable == (self.variable or 'z')
     return out
Example #2
0
 def test_poly1d_zero_size(self, xp, dtype):
     a = testing.shaped_arange((0, ), xp, dtype)
     with cupyx.allow_synchronize(False):
         out = xp.poly1d(a, variable=self.variable)
     assert out.variable == (self.variable or 'x')
     return out
Example #3
0
 def test_poly1d_list(self, xp):
     with cupyx.allow_synchronize(False):
         out = xp.poly1d([1, 2, 3, 4], variable=self.variable)
     assert out.variable == (self.variable or 'x')
     return out
Example #4
0
 def test_poly1d_setitem_leading_zeros(self, xp, dtype):
     a = xp.array([0, 0, 0, 2, 3, 0], dtype)
     b = xp.poly1d(a)
     with cupyx.allow_synchronize(False):
         b[1] = 10
     return b
Example #5
0
 def test_poly1d_numpy_array(self, xp, dtype):
     a = numpy.arange(5, dtype=dtype)
     with cupyx.allow_synchronize(False):
         out = xp.poly1d(a, variable=self.variable)
     assert out.variable == (self.variable or 'x')
     return out
Example #6
0
 def test_poly1d_setitem(self, xp, dtype):
     a = testing.shaped_arange((10, ), xp, dtype)
     b = xp.poly1d(a)
     with cupyx.allow_synchronize(False):
         b[100] = 20
     return b
Example #7
0
 def test_poly1d_getitem4(self, xp, dtype):
     a = xp.array([0, 0, 1, 2, 3, 0], dtype)
     with cupyx.allow_synchronize(False):
         return xp.poly1d(a)[2]
Example #8
0
 def test_poly1d_getitem3(self, xp, dtype):
     a = testing.shaped_arange((10, ), xp, dtype)
     with cupyx.allow_synchronize(False):
         return xp.poly1d(a)[100]
Example #9
0
 def test_disallowed(self):
     a = cupy.array([2, 3])
     with cupyx.allow_synchronize(False):
         with pytest.raises(cupyx.DeviceSynchronized):
             a.get()
Example #10
0
 def test_nested_allowed(self):
     a = cupy.array([2, 3])
     with cupyx.allow_synchronize(False):
         with cupyx.allow_synchronize(True):
             a.get()