pub fn batch_normalize(p: &[Self], q: &mut [G2Affine]) {
        assert_eq!(p.len(), q.len());

        let mut acc = Fp2::one();
        for (p, q) in p.iter().zip(q.iter_mut()) {
            // We use the `x` field of `G2Affine` to store the product
            // of previous z-coordinates seen.
            q.x = acc;

            // We will end up skipping all identities in p
            acc = Fp2::conditional_select(&(acc * p.z), &acc, p.is_identity());
        }

        // This is the inverse, as all z-coordinates are nonzero and the ones
        // that are not are skipped.
        acc = acc.invert().unwrap();

        for (p, q) in p.iter().rev().zip(q.iter_mut().rev()) {
            let skip = p.is_identity();

            // Compute tmp = 1/z
            let tmp = q.x * acc;

            // Cancel out z-coordinate in denominator of `acc`
            acc = Fp2::conditional_select(&(acc * p.z), &acc, skip);

            // Set the coordinates to the correct value
            q.x = p.x * tmp;
            q.y = p.y * tmp;
            q.infinity = Choice::from(0u8);

            *q = G2Affine::conditional_select(&q, &G2Affine::identity(), skip);
        }
    }
/// Converts a batch of `G2Projective` elements into `G2Affine` elements. This
/// function will panic if `p.len() != q.len()`.
Converts a batch of `G2Projective` elements into `G2Affine` elements.
Converts a batch of ` G2Projective ` elements into ` G2Affine ` elements .
pub fn batch_normalize(p: &[Self], q: &mut [G2Affine]) {
        assert_eq!(p.len(), q.len());
        let mut acc = Fp2::one();
        for (p, q) in p.iter().zip(q.iter_mut()) {
            // We use the `x` field of `G2Affine` to store the product
            // of previous z-coordinates seen.
            q.x = acc;
            // We will end up skipping all identities in p
            acc = Fp2::conditional_select(&(acc * p.z), &acc, p.is_identity());
        }
        // This is the inverse, as all z-coordinates are nonzero and the ones
        // that are not are skipped.
        acc = acc.invert().unwrap();
        for (p, q) in p.iter().rev().zip(q.iter_mut().rev()) {
            let skip = p.is_identity();
            // Compute tmp = 1/z
            let tmp = q.x * acc;
            // Cancel out z-coordinate in denominator of `acc`
            acc = Fp2::conditional_select(&(acc * p.z), &acc, skip);
            // Set the coordinates to the correct value
            q.x = p.x * tmp;
            q.y = p.y * tmp;
            q.infinity = Choice::from(0u8);
            *q = G2Affine::conditional_select(&q, &G2Affine::identity(), skip);
        }
    }
pub fn batch_normalize ( p : & [ Self ] , q : & mut [ G2Affine ] ) { assert_eq ! ( p len ( ) q len ( ) ) ; let mut acc = Fp2 :: one ( ) ; for ( p , q ) in p . iter ( ) . zip ( q . iter_mut ( ) ) { // We use the `x` field of `G2Affine` to store the product // of previous z-coordinates seen. q . x = acc ; // We will end up skipping all identities in p acc = Fp2 :: conditional_select ( & ( acc * p . z ) , & acc , p . is_identity ( ) ) ; } // This is the inverse, as all z-coordinates are nonzero and the ones // that are not are skipped. acc = acc . invert ( ) . unwrap ( ) ; for ( p , q ) in p . iter ( ) . rev ( ) . zip ( q . iter_mut ( ) . rev ( ) ) { let skip = p . is_identity ( ) ; // Compute tmp = 1/z let tmp = q . x * acc ; // Cancel out z-coordinate in denominator of `acc` acc = Fp2 :: conditional_select ( & ( acc * p . z ) , & acc , skip ) ; // Set the coordinates to the correct value q . x = p . x * tmp ; q . y = p . y * tmp ; q . infinity = Choice :: from ( 0u8 ) ; * q = G2Affine :: conditional_select ( & q , & G2Affine :: identity ( ) , skip ) ; } }
Converts a batch of `G2Projective` elements into `G2Affine` elements.
Converts a batch of ` G2Projective ` elements into ` G2Affine ` elements .
p
&[Self]
q
&mut [G2Affine]
p
&[Self]
q
&mut [G2Affine]