p3_goldilocks/
extension.rs
1use p3_field::extension::{BinomiallyExtendable, HasTwoAdicBinomialExtension};
2use p3_field::{FieldAlgebra, TwoAdicField};
3
4use crate::Goldilocks;
5
6impl BinomiallyExtendable<2> for Goldilocks {
7 const W: Self = Self::new(7);
10
11 const DTH_ROOT: Self = Self::new(18446744069414584320);
13
14 const EXT_GENERATOR: [Self; 2] = [
15 Self::new(18081566051660590251),
16 Self::new(16121475356294670766),
17 ];
18}
19
20impl HasTwoAdicBinomialExtension<2> for Goldilocks {
21 const EXT_TWO_ADICITY: usize = 33;
22
23 fn ext_two_adic_generator(bits: usize) -> [Self; 2] {
24 assert!(bits <= 33);
25
26 if bits == 33 {
27 [Self::ZERO, Self::new(15659105665374529263)]
28 } else {
29 [Self::two_adic_generator(bits), Self::ZERO]
30 }
31 }
32}
33
34#[cfg(test)]
35mod test_quadratic_extension {
36
37 use p3_field::extension::BinomialExtensionField;
38 use p3_field_testing::{test_field, test_two_adic_extension_field};
39
40 use crate::Goldilocks;
41
42 type F = Goldilocks;
43 type EF = BinomialExtensionField<F, 2>;
44
45 test_field!(super::EF);
46
47 test_two_adic_extension_field!(super::F, super::EF);
48}