File tree 1 file changed +25
-18
lines changed
1 file changed +25
-18
lines changed Original file line number Diff line number Diff line change @@ -136,27 +136,34 @@ impl<E: Engine> UVUniversalKZGParam<E> {
136
136
let g = E :: G1 :: random ( & mut rng) ;
137
137
let h = E :: G2 :: random ( rng) ;
138
138
139
- let powers_of_g_projective = ( 0 ..=max_degree)
140
- . scan ( g, |acc, _| {
141
- let val = * acc;
142
- * acc *= beta;
143
- Some ( val)
144
- } )
145
- . collect :: < Vec < E :: G1 > > ( ) ;
139
+ let ( powers_of_g_projective, powers_of_h_projective) = rayon:: join (
140
+ || {
141
+ ( 0 ..=max_degree)
142
+ . scan ( g, |acc, _| {
143
+ let val = * acc;
144
+ * acc *= beta;
145
+ Some ( val)
146
+ } )
147
+ . collect :: < Vec < E :: G1 > > ( )
148
+ } ,
149
+ || {
150
+ ( 0 ..=max_degree)
151
+ . scan ( h, |acc, _| {
152
+ let val = * acc;
153
+ * acc *= beta;
154
+ Some ( val)
155
+ } )
156
+ . collect :: < Vec < E :: G2 > > ( )
157
+ } ,
158
+ ) ;
146
159
147
160
let mut powers_of_g = vec ! [ E :: G1Affine :: identity( ) ; powers_of_g_projective. len( ) ] ;
148
- E :: G1 :: batch_normalize ( & powers_of_g_projective, & mut powers_of_g) ;
149
-
150
- let powers_of_h_projective = ( 0 ..=max_degree)
151
- . scan ( h, |acc, _| {
152
- let val = * acc;
153
- * acc *= beta;
154
- Some ( val)
155
- } )
156
- . collect :: < Vec < E :: G2 > > ( ) ;
157
-
158
161
let mut powers_of_h = vec ! [ E :: G2Affine :: identity( ) ; powers_of_h_projective. len( ) ] ;
159
- E :: G2 :: batch_normalize ( & powers_of_h_projective, & mut powers_of_h) ;
162
+
163
+ rayon:: join (
164
+ || E :: G1 :: batch_normalize ( & powers_of_g_projective, & mut powers_of_g) ,
165
+ || E :: G2 :: batch_normalize ( & powers_of_h_projective, & mut powers_of_h) ,
166
+ ) ;
160
167
161
168
Self {
162
169
powers_of_g,
You can’t perform that action at this time.
0 commit comments