mirror of
https://github.com/arnaucube/ark-r1cs-std.git
synced 2026-01-11 08:21:30 +01:00
Add ToConstraintFieldGadget for ProjectiveVar (#13)
This commit is contained in:
@@ -31,8 +31,8 @@ impl<P: Bls12Parameters> PairingVar<P> {
|
||||
let mut c1 = coeffs.1.clone();
|
||||
let c2 = Fp2V::<P>::new(p.y.clone(), zero);
|
||||
|
||||
c1.c0 = c1.c0 * &p.x;
|
||||
c1.c1 = c1.c1 * &p.x;
|
||||
c1.c0 *= &p.x;
|
||||
c1.c1 *= &p.x;
|
||||
*f = f.mul_by_014(&c0, &c1, &c2)?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -41,8 +41,8 @@ impl<P: Bls12Parameters> PairingVar<P> {
|
||||
let mut c1 = coeffs.0.clone();
|
||||
let c2 = coeffs.1.clone();
|
||||
|
||||
c1.c0 = c1.c0 * &p.x;
|
||||
c1.c1 = c1.c1 * &p.x;
|
||||
c1.c0 *= &p.x;
|
||||
c1.c1 *= &p.x;
|
||||
*f = f.mul_by_034(&c0, &c1, &c2)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -101,14 +101,15 @@ impl<P: MNT4Parameters> PairingVar<P> {
|
||||
|
||||
let mut f = Fp4G::<P>::one();
|
||||
|
||||
let mut dbl_idx: usize = 0;
|
||||
let mut add_idx: usize = 0;
|
||||
|
||||
// code below gets executed for all bits (EXCEPT the MSB itself) of
|
||||
// mnt6_param_p (skipping leading zeros) in MSB to LSB order
|
||||
for bit in BitIteratorBE::without_leading_zeros(P::ATE_LOOP_COUNT).skip(1) {
|
||||
for (dbl_idx, bit) in BitIteratorBE::without_leading_zeros(P::ATE_LOOP_COUNT)
|
||||
.skip(1)
|
||||
.enumerate()
|
||||
{
|
||||
let dc = &q.double_coefficients[dbl_idx];
|
||||
dbl_idx += 1;
|
||||
|
||||
let g_rr_at_p = Fp4G::<P>::new(
|
||||
&dc.c_l - &dc.c_4c - &dc.c_j * &p.x_twist,
|
||||
|
||||
@@ -96,14 +96,15 @@ impl<P: MNT6Parameters> PairingVar<P> {
|
||||
|
||||
let mut f = Fp6G::<P>::one();
|
||||
|
||||
let mut dbl_idx: usize = 0;
|
||||
let mut add_idx: usize = 0;
|
||||
|
||||
// code below gets executed for all bits (EXCEPT the MSB itself) of
|
||||
// mnt6_param_p (skipping leading zeros) in MSB to LSB order
|
||||
for bit in BitIteratorBE::without_leading_zeros(P::ATE_LOOP_COUNT).skip(1) {
|
||||
for (dbl_idx, bit) in BitIteratorBE::without_leading_zeros(P::ATE_LOOP_COUNT)
|
||||
.skip(1)
|
||||
.enumerate()
|
||||
{
|
||||
let dc = &q.double_coefficients[dbl_idx];
|
||||
dbl_idx += 1;
|
||||
|
||||
let g_rr_at_p = Fp6Var::new(
|
||||
&dc.c_l - &dc.c_4c - &dc.c_j * &p.x_twist,
|
||||
|
||||
Reference in New Issue
Block a user