use crate::FieldExt; use ecfft::{find_coset_offset, prepare_domain, prepare_matrices, GoodCurve, Matrix2x2}; #[derive(Clone, Debug)] pub struct ECFFTConfig { pub domain: Vec>, pub matrices: Vec>>, pub inverse_matrices: Vec>>, } pub fn gen_config_form_curve( good_curve: GoodCurve, coset_offset: (F, F), ) -> ECFFTConfig { let domain = prepare_domain(good_curve, coset_offset.0, coset_offset.1); let (matrices, inverse_matrices) = prepare_matrices(&domain); ECFFTConfig { domain, matrices, inverse_matrices, } } pub fn gen_config(num_cols: usize) -> ECFFTConfig { assert!(num_cols.is_power_of_two()); let expansion_factor = 2; let codeword_len = num_cols * expansion_factor; let k = (codeword_len as f64).log2() as usize; let good_curve = GoodCurve::::find_k(k); let (coset_offset_x, coset_offset_y) = find_coset_offset(good_curve.a, good_curve.B_sqrt.square()); let domain = prepare_domain(good_curve, coset_offset_x, coset_offset_y); let (matrices, inverse_matrices) = prepare_matrices(&domain); ECFFTConfig { domain, matrices, inverse_matrices, } }