@@ -152,8 +152,7 @@ fn barycentric_evaluate_blob_at_z(z: F, ys: [F; FIELDS_PER_BLOB]) -> F {
152
152
153
153
let NUM_PARTIAL_SUMS = FIELDS_PER_BLOB / 8 ;
154
154
// Safety: This sum is checked by the following `F::evaluate_quadratic_expression` calls.
155
- let partial_sums : [F ; FIELDS_PER_BLOB / 8 ] =
156
- unsafe { __compute_partial_sums (fracs , ROOTS ) };
155
+ let partial_sums : [F ; FIELDS_PER_BLOB / 8 ] = unsafe { __compute_partial_sums (fracs ) };
157
156
158
157
// We split off the first term to check the initial sum
159
158
@@ -237,7 +236,7 @@ fn barycentric_evaluate_blob_at_z(z: F, ys: [F; FIELDS_PER_BLOB]) -> F {
237
236
238
237
// Safety: We're running under the condition that `std::runtime::is_unconstrained()` is true.
239
238
unsafe {
240
- __compute_sum (fracs , ROOTS )
239
+ __compute_sum (fracs )
241
240
}
242
241
};
243
242
@@ -335,10 +334,7 @@ fn compute_fracs(z: F, ys: [F; FIELDS_PER_BLOB]) -> [F; FIELDS_PER_BLOB] {
335
334
}
336
335
337
336
// TODO: Clean me
338
- unconstrained fn __compute_partial_sums (
339
- fracs : [F ; FIELDS_PER_BLOB ],
340
- unconstrained_roots : [F ; FIELDS_PER_BLOB ],
341
- ) -> [F ; FIELDS_PER_BLOB / 8 ] {
337
+ unconstrained fn __compute_partial_sums (fracs : [F ; FIELDS_PER_BLOB ]) -> [F ; FIELDS_PER_BLOB / 8 ] {
342
338
let mut partial_sums : [F ; FIELDS_PER_BLOB / 8 ] = std::mem:: zeroed ();
343
339
344
340
// Seeking:
@@ -352,7 +348,7 @@ unconstrained fn __compute_partial_sums(
352
348
let mut partial_sum : F = F ::zero ();
353
349
for i in 0 ..8 {
354
350
// y_k * ( omega^k / (z - omega^k) )
355
- let summand = unconstrained_roots [i ].__mul (fracs [i ]);
351
+ let summand = ROOTS [i ].__mul (fracs [i ]);
356
352
357
353
// partial_sum + ( y_k * ( omega^k / (z - omega^k) ) -> partial_sum
358
354
partial_sum = partial_sum .__add (summand );
@@ -371,7 +367,7 @@ unconstrained fn __compute_partial_sums(
371
367
for j in 0 ..8 {
372
368
let k = i * 8 + j ;
373
369
// y_k * ( omega^k / (z - omega^k) )
374
- let summand = unconstrained_roots [k ].__mul (fracs [k ]);
370
+ let summand = ROOTS [k ].__mul (fracs [k ]);
375
371
// partial_sum + ( y_k * ( omega^k / (z - omega^k) ) -> partial_sum
376
372
partial_sum = partial_sum .__add (summand );
377
373
}
@@ -381,10 +377,7 @@ unconstrained fn __compute_partial_sums(
381
377
partial_sums
382
378
}
383
379
384
- unconstrained fn __compute_sum (
385
- fracs : [F ; FIELDS_PER_BLOB ],
386
- unconstrained_roots : [F ; FIELDS_PER_BLOB ],
387
- ) -> F {
380
+ unconstrained fn __compute_sum (fracs : [F ; FIELDS_PER_BLOB ]) -> F {
388
381
// Seeking:
389
382
// ___d-1
390
383
// \ omega^i
@@ -395,7 +388,7 @@ unconstrained fn __compute_sum(
395
388
let mut sum : F = F ::zero ();
396
389
for i in 0 ..FIELDS_PER_BLOB {
397
390
// y_k * ( omega^k / (z - omega^k) )
398
- let summand = unconstrained_roots [i ].__mul (fracs [i ]);
391
+ let summand = ROOTS [i ].__mul (fracs [i ]);
399
392
400
393
// partial_sum + ( y_k * ( omega^k / (z - omega^k) ) -> partial_sum
401
394
sum = sum .__add (summand );
@@ -658,8 +651,8 @@ mod tests {
658
651
}
659
652
// Safety: this is a test
660
653
unsafe {
661
- let partial_sums = __compute_partial_sums (fields , ROOTS );
662
- let sum = __compute_sum (fields , ROOTS );
654
+ let partial_sums = __compute_partial_sums (fields );
655
+ let sum = __compute_sum (fields );
663
656
664
657
assert_eq (partial_sums [FIELDS_PER_BLOB / 8 - 1 ], sum );
665
658
}
0 commit comments