Skip to content

Commit 5b598c8

Browse files
committed
rename CouplePoint to ProductPoint
1 parent b4e18ae commit 5b598c8

File tree

6 files changed

+32
-32
lines changed

6 files changed

+32
-32
lines changed

src/protocols/sqisign.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use sha3::{
99

1010
use crate::{
1111
elliptic::{basis::BasisX, curve::Curve},
12-
theta::elliptic_product::{CouplePoint, EllipticProduct},
12+
theta::elliptic_product::{EllipticProduct, ProductPoint},
1313
utilities::le_bytes::byte_slice_difference,
1414
};
1515

@@ -388,15 +388,15 @@ impl<Fq: FqTrait> Sqisign<Fq> {
388388
E2: &Curve<Fq>,
389389
B1: &BasisX<Fq>,
390390
B2: &BasisX<Fq>,
391-
) -> (EllipticProduct<Fq>, CouplePoint<Fq>, CouplePoint<Fq>) {
391+
) -> (EllipticProduct<Fq>, ProductPoint<Fq>, ProductPoint<Fq>) {
392392
let E1E2 = EllipticProduct::new(E1, E2);
393393
// TODO: lift_basis requires an inversion, we could write a function
394394
// which normallises B1 and B2 simultaneously to save one inversion
395395
// here.
396396
let (P_chl, Q_chl) = E1.lift_basis(&B1);
397397
let (P_aux, Q_aux) = E2.lift_basis(&B2);
398-
let P1P2 = CouplePoint::new(&P_chl, &P_aux);
399-
let Q1Q2 = CouplePoint::new(&Q_chl, &Q_aux);
398+
let P1P2 = ProductPoint::new(&P_chl, &P_aux);
399+
let Q1Q2 = ProductPoint::new(&Q_chl, &Q_aux);
400400

401401
(E1E2, P1P2, Q1Q2)
402402
}

src/theta/elliptic_product.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ use fp2::fq::Fq as FqTrait;
33
use crate::elliptic::{curve::Curve, projective_point::Point};
44

55
#[derive(Clone, Copy, Debug)]
6-
pub struct CouplePoint<Fq: FqTrait> {
6+
pub struct ProductPoint<Fq: FqTrait> {
77
P1: Point<Fq>,
88
P2: Point<Fq>,
99
}
1010

11-
impl<Fq: FqTrait> CouplePoint<Fq> {
11+
impl<Fq: FqTrait> ProductPoint<Fq> {
1212
/// Return the pair of points at infinity: O1, O2 on E1 x E2
1313
pub const INFINITY: Self = Self {
1414
P1: Point::INFINITY,
@@ -26,7 +26,7 @@ impl<Fq: FqTrait> CouplePoint<Fq> {
2626
}
2727
}
2828

29-
impl<Fq: FqTrait> ::std::fmt::Display for CouplePoint<Fq> {
29+
impl<Fq: FqTrait> ::std::fmt::Display for ProductPoint<Fq> {
3030
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
3131
write!(f, "CouplePoint with Points:\n{}\n{}", self.P1, self.P2)
3232
}
@@ -53,15 +53,15 @@ impl<Fq: FqTrait> EllipticProduct<Fq> {
5353
/// Addition of elements (P1, P2) and (Q1, Q2) on E1 x E2 is defined
5454
/// as (P1 + Q1, P2 + Q2). This function calls the add function for
5555
/// the pair of curves on the EllipticProduct
56-
pub fn add(self, C1: &CouplePoint<Fq>, C2: &CouplePoint<Fq>) -> CouplePoint<Fq> {
57-
let mut C3 = CouplePoint::INFINITY;
56+
pub fn add(self, C1: &ProductPoint<Fq>, C2: &ProductPoint<Fq>) -> ProductPoint<Fq> {
57+
let mut C3 = ProductPoint::INFINITY;
5858
C3.P1 = self.E1.add(&C1.P1, &C2.P1);
5959
C3.P2 = self.E2.add(&C1.P2, &C2.P2);
6060
C3
6161
}
6262

6363
/// Doubles the pair of points (P1, P2) on E1 x E2 as ([2]P1, [2]P2)
64-
pub fn double(self, C: &CouplePoint<Fq>) -> CouplePoint<Fq> {
64+
pub fn double(self, C: &ProductPoint<Fq>) -> ProductPoint<Fq> {
6565
let mut C3 = *C;
6666
C3.P1 = self.E1.double(&C3.P1);
6767
C3.P2 = self.E2.double(&C3.P2);
@@ -70,7 +70,7 @@ impl<Fq: FqTrait> EllipticProduct<Fq> {
7070

7171
/// Repeatedly doubles the pair of points (P1, P2) on E1 x E2 to get
7272
/// ([2^n]P1, [2^n]P2)
73-
pub fn double_iter(self, C: &CouplePoint<Fq>, n: usize) -> CouplePoint<Fq> {
73+
pub fn double_iter(self, C: &ProductPoint<Fq>, n: usize) -> ProductPoint<Fq> {
7474
let mut C3 = *C;
7575
C3.P1 = self.E1.double_iter(&C3.P1, n);
7676
C3.P2 = self.E2.double_iter(&C3.P2, n);

src/theta/theta_chain.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use fp2::fq::Fq as FqTrait;
22

3-
use super::elliptic_product::{CouplePoint, EllipticProduct};
3+
use super::elliptic_product::{EllipticProduct, ProductPoint};
44
use super::theta_gluing::gluing_isogeny;
55
use super::theta_isogeny::{two_isogeny, two_isogeny_to_product};
66
use super::theta_point::ThetaPoint;
@@ -16,11 +16,11 @@ use super::theta_splitting::{split_to_product, splitting_isomorphism};
1616
impl<Fq: FqTrait> EllipticProduct<Fq> {
1717
pub fn elliptic_product_isogeny_no_strategy(
1818
self,
19-
P1P2: &CouplePoint<Fq>,
20-
Q1Q2: &CouplePoint<Fq>,
19+
P1P2: &ProductPoint<Fq>,
20+
Q1Q2: &ProductPoint<Fq>,
2121
n: usize,
22-
image_points: &[CouplePoint<Fq>],
23-
) -> (EllipticProduct<Fq>, Vec<CouplePoint<Fq>>) {
22+
image_points: &[ProductPoint<Fq>],
23+
) -> (EllipticProduct<Fq>, Vec<ProductPoint<Fq>>) {
2424
// Store the number of image points we wish to evaluate to
2525
// ensure we return them all from the points we push through
2626
let num_image_points = image_points.len();

src/theta/theta_gluing.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// compatible with the isogeny formula
99
// ========================================================
1010

11-
use super::elliptic_product::{CouplePoint, EllipticProduct};
11+
use super::elliptic_product::{EllipticProduct, ProductPoint};
1212
use super::theta_point::ThetaPoint;
1313
use super::theta_structure::ThetaStructure;
1414
use super::theta_util::{apply_base_change, to_hadamard};
@@ -54,8 +54,8 @@ fn get_base_submatrix<Fq: FqTrait>(E: &Curve<Fq>, T: &Point<Fq>) -> (Fq, Fq, Fq,
5454
/// Cost 100M + 8S + 4I
5555
fn get_base_matrix<Fq: FqTrait>(
5656
E1E2: &EllipticProduct<Fq>,
57-
P1P2: &CouplePoint<Fq>,
58-
Q1Q2: &CouplePoint<Fq>,
57+
P1P2: &ProductPoint<Fq>,
58+
Q1Q2: &ProductPoint<Fq>,
5959
) -> [Fq; 16] {
6060
// First compute the submatrices from each point
6161
let (E1, E2) = E1E2.curves();
@@ -132,7 +132,7 @@ fn get_base_matrix<Fq: FqTrait>(
132132
/// Given a couple point as input, compute the corresponding ThetaPoint on
133133
/// the level two structure and then apply the basis change on this point
134134
/// Cost: 20M
135-
fn base_change_couple_point<Fq: FqTrait>(P1P2: &CouplePoint<Fq>, M: [Fq; 16]) -> ThetaPoint<Fq> {
135+
fn base_change_couple_point<Fq: FqTrait>(P1P2: &ProductPoint<Fq>, M: [Fq; 16]) -> ThetaPoint<Fq> {
136136
let (P1, P2) = P1P2.points();
137137
let (mut X1, mut Z1) = P1.to_xz();
138138
let (mut X2, mut Z2) = P2.to_xz();
@@ -295,9 +295,9 @@ fn gluing_image<Fq: FqTrait>(
295295
/// from an elliptic product.
296296
pub fn gluing_isogeny<Fq: FqTrait>(
297297
E1E2: &EllipticProduct<Fq>,
298-
P1P2_8: &CouplePoint<Fq>,
299-
Q1Q2_8: &CouplePoint<Fq>,
300-
image_points: &[CouplePoint<Fq>],
298+
P1P2_8: &ProductPoint<Fq>,
299+
Q1Q2_8: &ProductPoint<Fq>,
300+
image_points: &[ProductPoint<Fq>],
301301
) -> (ThetaStructure<Fq>, Vec<ThetaPoint<Fq>>) {
302302
// First recover the four torsion below the 8 torsion
303303
let P1P2_4 = E1E2.double(&P1P2_8);

src/theta/theta_splitting.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use fp2::fq::Fq as FqTrait;
99
use crate::elliptic::curve::Curve;
1010
use crate::elliptic::point::PointX;
1111

12-
use super::elliptic_product::{CouplePoint, EllipticProduct};
12+
use super::elliptic_product::{EllipticProduct, ProductPoint};
1313
use super::theta_point::ThetaPoint;
1414
use super::theta_structure::ThetaStructure;
1515
use super::theta_util::apply_base_change;
@@ -413,7 +413,7 @@ pub fn split_to_product<Fq: FqTrait>(
413413
Th: &ThetaStructure<Fq>,
414414
image_points: &[ThetaPoint<Fq>],
415415
num_image_points: usize,
416-
) -> (EllipticProduct<Fq>, Vec<CouplePoint<Fq>>) {
416+
) -> (EllipticProduct<Fq>, Vec<ProductPoint<Fq>>) {
417417
// First we take the domain theta null point and
418418
// split this to two level-1 theta null points
419419
let null_point = Th.null_point();
@@ -426,8 +426,8 @@ pub fn split_to_product<Fq: FqTrait>(
426426
let E3E4 = EllipticProduct::new(&E3, &E4);
427427

428428
// Now compute points on E3 x E4
429-
let mut C: CouplePoint<Fq>;
430-
let mut couple_points: Vec<CouplePoint<Fq>> = vec![];
429+
let mut C: ProductPoint<Fq>;
430+
let mut couple_points: Vec<ProductPoint<Fq>> = vec![];
431431

432432
for P in image_points.iter().take(num_image_points) {
433433
// Split to level 1
@@ -442,7 +442,7 @@ pub fn split_to_product<Fq: FqTrait>(
442442

443443
// Package these points into a CouplePoint on
444444
// E3 x E4
445-
C = CouplePoint::new(&Q1, &Q2);
445+
C = ProductPoint::new(&Q1, &Q2);
446446

447447
// Push this into the output
448448
couple_points.push(C);

tests/test_product_isogeny.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
mod test_product_isogeny {
55
use isogeny::{
66
elliptic::{curve::Curve, projective_point::Point},
7-
theta::elliptic_product::{CouplePoint, EllipticProduct},
7+
theta::elliptic_product::{EllipticProduct, ProductPoint},
88
};
99

1010
// Modulus used in test
@@ -72,13 +72,13 @@ mod test_product_isogeny {
7272
let P2 = Point::new_xy(&P2_X, &P2_Y);
7373
let Q1 = Point::new_xy(&Q1_X, &Q1_Y);
7474
let Q2 = Point::new_xy(&Q2_X, &Q2_Y);
75-
let P1P2 = CouplePoint::new(&P1, &P2);
76-
let Q1Q2 = CouplePoint::new(&Q1, &Q2);
75+
let P1P2 = ProductPoint::new(&P1, &P2);
76+
let Q1Q2 = ProductPoint::new(&Q1, &Q2);
7777

7878
// Point to push through isogeny
7979
let PA = Point::INFINITY;
8080
let PB = Point::new_xy(&PA_X, &PA_Y);
81-
let PAPB = CouplePoint::new(&PA, &PB);
81+
let PAPB = ProductPoint::new(&PA, &PB);
8282
let image_points = [PAPB];
8383

8484
// Points to compare against

0 commit comments

Comments
 (0)