1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
use super::{algebra::Ring, basic::Basic, comp::ParityCmp, field::PrimeField};
use core::ops::Mul;
pub trait Affine: ParityCmp + Basic + PartialEq + Eq {
type ScalarField: PrimeField;
type RangeField: PrimeField;
type Projective: Projective;
const PARAM_A: Self::RangeField;
const PARAM_B: Self::RangeField;
fn to_projective(self) -> Self::Projective;
fn is_identity(self) -> bool;
fn is_on_curve(self) -> bool;
}
pub trait Projective: ParityCmp + Basic + Ring + Mul<Self::ScalarField, Output = Self> {
type ScalarField: PrimeField;
type RangeField: PrimeField;
type Affine: Affine;
const PARAM_A: Self::RangeField;
const PARAM_B: Self::RangeField;
fn to_affine(self) -> Self::Affine;
fn is_identity(self) -> bool;
fn double(self) -> Self;
fn is_on_curve(self) -> bool;
fn get_x(&self) -> Self::RangeField;
fn get_y(&self) -> Self::RangeField;
fn get_z(&self) -> Self::RangeField;
fn set_x(&mut self, value: Self::RangeField);
fn set_y(&mut self, value: Self::RangeField);
fn set_z(&mut self, value: Self::RangeField);
}