Skip to content

Commit f461b4b

Browse files
committed
Add GroupMap::composition for debugging
1 parent e5552e2 commit f461b4b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

groupmap/src/lib.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ pub trait GroupMap<F> {
2626
fn setup() -> Self;
2727
fn to_group(&self, u: F) -> (F, F);
2828
fn batch_to_group_x(&self, ts: Vec<F>) -> Vec<[F; 3]>;
29+
/// For debug only
30+
fn composition(&self) -> Vec<F>;
2931
}
3032

3133
#[derive(Clone, Copy)]
@@ -127,6 +129,25 @@ fn get_xy<G: SWModelParameters>(
127129
}
128130

129131
impl<G: SWModelParameters> GroupMap<G::BaseField> for BWParameters<G> {
132+
/// For debug only
133+
fn composition(&self) -> Vec<G::BaseField> {
134+
let Self {
135+
u,
136+
fu,
137+
sqrt_neg_three_u_squared_minus_u_over_2,
138+
sqrt_neg_three_u_squared,
139+
inv_three_u_squared,
140+
} = self;
141+
142+
vec![
143+
*u,
144+
*fu,
145+
*sqrt_neg_three_u_squared_minus_u_over_2,
146+
*sqrt_neg_three_u_squared,
147+
*inv_three_u_squared,
148+
]
149+
}
150+
130151
fn setup() -> Self {
131152
assert!(G::COEFF_A.is_zero());
132153

0 commit comments

Comments
 (0)