Catch up with algebra (#106)

Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
This commit is contained in:
Marcin
2022-07-29 21:16:16 +02:00
committed by GitHub
parent 76579d0fbb
commit 93e64df895
120 changed files with 934 additions and 1653 deletions

View File

@@ -1,9 +1,9 @@
use ark_ff::{
fields::fp3::{Fp3, Fp3Config},
CubicExt, MontFp,
Field, MontFp,
};
use crate::{fq::Fq, FQ_ZERO};
use crate::fq::Fq;
pub type Fq3 = Fp3<Fq3Config>;
@@ -12,7 +12,7 @@ pub struct Fq3Config;
impl Fp3Config for Fq3Config {
type Fp = Fq;
const NONRESIDUE: Fq = MontFp!(Fq, "5");
const NONRESIDUE: Fq = MontFp!("5");
const TWO_ADICITY: u32 = 34;
@@ -34,16 +34,16 @@ impl Fp3Config for Fq3Config {
0x6878f58,
];
const QUADRATIC_NONRESIDUE_TO_T: Fq3 = CubicExt!(
MontFp!(Fq, "154361449678783505076984156275977937654331103361174469632346230549735979552469642799720052"),
FQ_ZERO,
FQ_ZERO,
const QUADRATIC_NONRESIDUE_TO_T: Fq3 = Fq3::new(
MontFp!("154361449678783505076984156275977937654331103361174469632346230549735979552469642799720052"),
Fq::ZERO,
Fq::ZERO,
);
const FROBENIUS_COEFF_FP3_C1: &'static [Fq] = &[
MontFp!(Fq, "1"),
MontFp!(Fq, "471738898967521029133040851318449165997304108729558973770077319830005517129946578866686956"),
MontFp!(Fq, "4183387201740296620308398334599285547820769823264541783190415909159130177461911693276180"),
Fq::ONE,
MontFp!("471738898967521029133040851318449165997304108729558973770077319830005517129946578866686956"),
MontFp!("4183387201740296620308398334599285547820769823264541783190415909159130177461911693276180"),
];
const FROBENIUS_COEFF_FP3_C2: &'static [Fq] = &[

View File

@@ -1,9 +1,9 @@
use ark_ff::{
fields::fp6_2over3::{Fp6, Fp6Config},
CubicExt, MontFp,
Field, MontFp,
};
use crate::{Fq, Fq3, Fq3Config, FQ_ONE, FQ_ZERO};
use crate::{Fq, Fq3, Fq3Config};
pub type Fq6 = Fp6<Fq6Config>;
@@ -12,14 +12,14 @@ pub struct Fq6Config;
impl Fp6Config for Fq6Config {
type Fp3Config = Fq3Config;
const NONRESIDUE: Fq3 = CubicExt!(FQ_ZERO, FQ_ONE, FQ_ZERO);
const NONRESIDUE: Fq3 = Fq3::new(Fq::ZERO, Fq::ONE, Fq::ZERO);
const FROBENIUS_COEFF_FP6_C1: &'static [Fq] = &[
MontFp!(Fq, "1"),
MontFp!(Fq, "471738898967521029133040851318449165997304108729558973770077319830005517129946578866686957"),
MontFp!(Fq, "471738898967521029133040851318449165997304108729558973770077319830005517129946578866686956"),
MontFp!(Fq, "475922286169261325753349249653048451545124878552823515553267735739164647307408490559963136"),
MontFp!(Fq, "4183387201740296620308398334599285547820769823264541783190415909159130177461911693276180"),
MontFp!(Fq, "4183387201740296620308398334599285547820769823264541783190415909159130177461911693276181"),
Fq::ONE,
MontFp!("471738898967521029133040851318449165997304108729558973770077319830005517129946578866686957"),
MontFp!("471738898967521029133040851318449165997304108729558973770077319830005517129946578866686956"),
MontFp!("475922286169261325753349249653048451545124878552823515553267735739164647307408490559963136"),
MontFp!("4183387201740296620308398334599285547820769823264541783190415909159130177461911693276180"),
MontFp!("4183387201740296620308398334599285547820769823264541783190415909159130177461911693276181"),
];
}

View File

@@ -2,7 +2,7 @@ use ark_algebra_test_templates::{
fields::*, generate_field_serialization_test, generate_field_test,
};
use ark_ff::{
fields::{models::fp6_2over3::*, quadratic_extension::QuadExtConfig, SquareRootField},
fields::{models::fp6_2over3::*, quadratic_extension::QuadExtConfig},
Field, PrimeField,
};
use ark_serialize::{buffer_bit_byte_size, CanonicalSerialize};
@@ -11,7 +11,7 @@ use core::ops::{AddAssign, MulAssign, SubAssign};
use crate::*;
generate_field_test!(mnt6_298; fq3; fq6; mont(5, 5); );
generate_field_test!(mnt6_298; fq3; fq6_2_on_3; mont(5, 5); );
generate_field_serialization_test!(mnt6_298;);
#[test]