nomos-specs/da/kzg_rs/test_fft.py

15 lines
519 B
Python
Raw Normal View History

2024-06-07 06:22:03 +00:00
from unittest import TestCase
2024-06-12 10:25:41 +00:00
from .roots import compute_roots_of_unity
from .common import BLS_MODULUS
from .fft import fft, ifft
2024-06-07 06:22:03 +00:00
class TestFFT(TestCase):
def test_fft_ifft(self):
2024-06-11 16:09:08 +00:00
for size in [16, 32, 64, 128, 256, 512, 1024, 2048, 4096]:
roots_of_unity = compute_roots_of_unity(2, size, BLS_MODULUS)
2024-06-10 12:49:40 +00:00
vals = list(x for x in range(size))
vals_fft = fft(vals, roots_of_unity, BLS_MODULUS)
self.assertEqual(vals, ifft(vals_fft, roots_of_unity, BLS_MODULUS))