Пример #1
0
    def test_ediff1d_int(self, array, data_type):
        a = numpy.array(array, dtype=data_type)
        ia = inp.array(a)

        result = inp.ediff1d(ia)
        expected = numpy.ediff1d(a)
        numpy.testing.assert_array_equal(expected, result)
Пример #2
0
    def test_ediff1d_float(self):
        a = numpy.array([1., 2.5, 6., 7., 3.])
        ia = inp.array(a)

        result = inp.ediff1d(ia)
        expected = numpy.ediff1d(a)
        numpy.testing.assert_array_equal(expected, result)
Пример #3
0
    def test_ediff1d_int(self, array, data_type):
        np_a = numpy.array(array, dtype=data_type)
        dpnp_a = dpnp.array(array, dtype=data_type)

        result = dpnp.ediff1d(dpnp_a)
        expected = numpy.ediff1d(np_a)
        numpy.testing.assert_array_equal(expected, result)
Пример #4
0
    def test_ediff1d_int(self):
        a = numpy.array([1, 2, 4, 7, 0])
        ia = inp.array(a)

        result = inp.ediff1d(ia)
        expected = numpy.ediff1d(a)
        numpy.testing.assert_array_equal(expected, result)
Пример #5
0
    def test_ediff1d_args(self):
        a = numpy.array([1, 2, 4, 7, 0])

        to_begin = numpy.array([-20, -30])
        to_end = numpy.array([20, 15])

        result = inp.ediff1d(a, to_end=to_end, to_begin=to_begin)
        expected = numpy.ediff1d(a, to_end=to_end, to_begin=to_begin)
        numpy.testing.assert_array_equal(expected, result)