mirror of
https://github.com/pseXperiments/icicle.git
synced 2026-01-09 15:37:58 -05:00
937 B
937 B
Icicle example: Number-Theoretical Transform (NTT)
Key-Takeaway
Icicle provides CUDA C++ template function NTT for Number Theoretical Transform, also known as Discrete Fourier Transform.
Concise Usage Explanation
- Include the curve api
- Init NTT domain
- Call ntt api
#include "icicle/api/bn254.h"
...
auto ntt_init_domain_cfg = default_ntt_init_domain_config();
...
bn254_ntt_init_domain(&basic_root, ntt_init_domain_cfg);
NTTConfig<scalar_t> config = default_ntt_config<scalar_t>();
...
bn254_ntt(input.get(), ntt_size, NTTDir::kForward, config, output.get())
Running the example
# for CPU
./run.sh -d CPU
# for CUDA
./run.sh -d CUDA -b /path/to/cuda/backend/install/dir
What's in the example
- Define the size of the example
- Initialize input
- Run Radix2 NTT
- Run MixedRadix NTT
- Validate the data output