1
0
mirror of synced 2025-02-09 06:16:13 +00:00
Daniel Sanchez 9adfbdddc6
Da: fk20 implementation (#663)
* Implement fft_g1

* Fix ifft_g1
Added fft/ifft g1 test

* Parallelize i/fft

* Add i/fft benches

* Fix parallel feature tagging

* Fix bench

* Fix parallelization

* Implement fk20

* Add compute roots of unity method

* Fix ranges

* Remove innecesary collect in fft_g1

* Use domaın and ark fft

* Remove custom fft

* Add fk20 benches

* Clippy happy

* Use threadcount for parallelization

---------

Co-authored-by: mgonen <mehmet@status.im>
2024-06-21 12:43:17 +02:00

24 lines
824 B
Rust

use ark_bls12_381::{Fr, G1Affine, G1Projective};
use ark_ec::AffineRepr;
use ark_ff::BigInt;
use ark_poly::{EvaluationDomain, GeneralEvaluationDomain};
use divan::counter::ItemsCount;
use divan::{black_box, Bencher};
fn main() {
divan::main()
}
#[divan::bench(args = [16, 32, 64, 128, 256, 512, 1024, 2048, 4096])]
fn compute_ark_fft_for_size(bencher: Bencher, size: usize) {
bencher
.with_inputs(|| {
let domain = GeneralEvaluationDomain::<Fr>::new(size).unwrap();
let buff: Vec<G1Projective> = (0..size)
.map(|i| G1Affine::identity().mul_bigint(BigInt::<4>::from(i as u64)))
.collect();
(buff, domain)
})
.input_counter(move |_| ItemsCount::new(size))
.bench_refs(|(buff, domain)| black_box(domain.fft(buff)));
}