Beispiel #1
0
    def check_r1c(self):
        """complex case, rank 1"""
        a   = randn(self.n) + 1.0j * randn(self.n)

        atest   = autocorr_fft(a)
        aref    = numpy.sum(a * numpy.conj(a))
        assert_array_almost_equal(atest[self.n - 1], aref, decimal = md)
        assert atest.dtype == a.dtype
Beispiel #2
0
    def check_r1r(self):
        """real case, rank 1"""
        a   = randn(self.n)

        aref    = correlate(a, a, mode = 'full')
        atest   = autocorr_fft(a)
        assert_array_almost_equal(atest, aref, decimal = md)
        assert atest.dtype == a.dtype
Beispiel #3
0
    def check_r2r(self):
        """real case, rank 2"""

        # axis 0
        a       = randn(self.n, self.d)
        axis    = 0

        c       = [correlate(a[:, i], a[:, i], mode = 'full') for i in range(self.d)]
        aref    = array(c).T

        atest   = autocorr_fft(a, axis = axis)
        assert_array_almost_equal(atest, aref, decimal = md)

        # axis 1
        a       = randn(self.n, self.d)
        axis    = 1

        c       = [correlate(a[i], a[i], mode = 'full') for i in range(self.n)]
        aref    = array(c)

        atest   = autocorr_fft(a, axis = axis)
        assert_array_almost_equal(atest, aref, decimal = md)