def dst_2d_ref(x, **kwargs):
    """Calculate reference values for testing dst2."""
    x = np.array(x, copy=True)
    for row in range(x.shape[0]):
        x[row, :] = dst(x[row, :], **kwargs)
    for col in range(x.shape[1]):
        x[:, col] = dst(x[:, col], **kwargs)
    return x
Example #2
0
def dst_2d_ref(x, **kwargs):
    """ used as a reference in testing dst2. """
    x = np.array(x, copy=True)
    for row in range(x.shape[0]):
        x[row, :] = dst(x[row, :], **kwargs)
    for col in range(x.shape[1]):
        x[:, col] = dst(x[:, col], **kwargs)
    return x
def dst_2d_ref(x, **kwargs):
    """Calculate reference values for testing dst2."""
    x = np.array(x, copy=True)
    for row in range(x.shape[0]):
        x[row, :] = dst(x[row, :], **kwargs)
    for col in range(x.shape[1]):
        x[:, col] = dst(x[:, col], **kwargs)
    return x
Example #4
0
def dst_2d_ref(x, **kwargs):
    """ used as a reference in testing dst2. """
    x = np.array(x, copy=True)
    for row in range(x.shape[0]):
        x[row, :] = dst(x[row, :], **kwargs)
    for col in range(x.shape[1]):
        x[:, col] = dst(x[:, col], **kwargs)
    return x
 def test_definition_ortho(self):
     # Test orthornomal mode.
     for i in range(len(X)):
         x = np.array(X[i], dtype=self.rdt)
         dt = np.result_type(np.float32, self.rdt)
         y = dst(x, norm='ortho', type=4)
         y2 = naive_dst4(x, norm='ortho')
         assert_equal(y.dtype, dt)
         assert_array_almost_equal(y, y2, decimal=self.dec)
 def test_definition_ortho(self):
     # Test orthornomal mode.
     for i in range(len(X)):
         x = np.array(X[i], dtype=self.rdt)
         dt = np.result_type(np.float32, self.rdt)
         y = dst(x, norm='ortho', type=4)
         y2 = naive_dst4(x, norm='ortho')
         assert_equal(y.dtype, dt)
         assert_array_almost_equal(y, y2, decimal=self.dec)
Example #7
0
 def test_definition_ortho(self):
     # Test orthornomal mode.
     dt = np.result_type(np.float32, self.rdt)
     for xr in X:
         x = np.array(xr, dtype=self.rdt)
         y = dst(x, norm='ortho', type=1)
         y2 = naive_dst1(x, norm='ortho')
         assert_equal(y.dtype, dt)
         assert_array_almost_equal(y / np.max(y), y2 / np.max(y), decimal=self.dec)
 def test_definition(self):
     for i in FFTWDATA_SIZES:
         xr, yr, dt = fftw_dst_ref(self.type, i, self.rdt)
         y = dst(xr, type=self.type)
         assert_equal(y.dtype, dt)
         # XXX: we divide by np.max(y) because the tests fail otherwise. We
         # should really use something like assert_array_approx_equal. The
         # difference is due to fftw using a better algorithm w.r.t error
         # propagation compared to the ones from fftpack.
         assert_array_almost_equal(y / np.max(y), yr / np.max(y), decimal=self.dec, err_msg="Size %d failed" % i)
Example #9
0
 def test_definition(self):
     for i in FFTWDATA_SIZES:
         xr, yr, dt = fftw_dst_ref(self.type, i, self.rdt)
         y = dst(xr, type=self.type)
         assert_equal(y.dtype, dt)
         # XXX: we divide by np.max(y) because the tests fail otherwise. We
         # should really use something like assert_array_approx_equal. The
         # difference is due to fftw using a better algorithm w.r.t error
         # propagation compared to the ones from fftpack.
         assert_array_almost_equal(y / np.max(y), yr / np.max(y), decimal=self.dec,
                 err_msg="Size %d failed" % i)
Example #10
0
 def test_dst_complex(self):
     y = dst(np.arange(5) * 1j)
     x = 1j * dst(np.arange(5))
     assert_array_almost_equal(x, y)
Example #11
0
 def test_dst_complex64(self):
     y = dst(np.arange(5, dtype=np.complex64) * 1j)
     x = 1j * dst(np.arange(5))
     assert_array_almost_equal(x, y)
 def test_dst_complex(self):
     y = dst(np.arange(5) * 1j)
     x = 1j * dst(np.arange(5))
     assert_array_almost_equal(x, y)
 def test_dst_complex64(self):
     y = dst(np.arange(5, dtype=np.complex64) * 1j)
     x = 1j * dst(np.arange(5))
     assert_array_almost_equal(x, y)