def test_fft_with_floats():
    numpy = pytest.importorskip('numpy')
    import numpy.linalg as la
    from pymbolic.algorithm import fft, ifft
    for n in ([(2 ** i) for i in range(4, 10)] + [17, 12, 948]):
        a = (numpy.random.rand(n) + (1j * numpy.random.rand(n)))
        f_a = fft(a)
        a2 = ifft(f_a)
        assert (la.norm((a - a2)) < 1e-10)
        f_a_numpy = numpy.fft.fft(a)
        assert (la.norm((f_a - f_a_numpy)) < 1e-10)
def test_fft_with_floats():
    numpy = pytest.importorskip('numpy')
    import numpy.linalg as la
    from pymbolic.algorithm import fft, ifft
    for n in ([(2 ** i) for i in range(4, 10)] + [17, 12, 948]):
        a = (numpy.random.rand(n) + (1j * numpy.random.rand(n)))
        f_a = fft(a)
        a2 = ifft(f_a)
        assert (la.norm((a - a2)) < 1e-10)
        f_a_numpy = numpy.fft.fft(a)
        assert (la.norm((f_a - f_a_numpy)) < 1e-10)