File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
poly/src/evaluations/multivariate/multilinear Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -450,6 +450,23 @@ mod tests {
450
450
}
451
451
}
452
452
453
+ #[ test]
454
+ fn sparse_to_evaluations_matches_to_dense ( ) {
455
+ let mut rng = test_rng ( ) ;
456
+ const NV : usize = 8 ; // 2^8 = 256, small and fast
457
+
458
+ for _ in 0 ..25 {
459
+ // Make a sparse poly with ~sqrt(2^NV) non-zeros at random indices.
460
+ let sparse = SparseMultilinearExtension :: < Fr > :: rand ( NV , & mut rng) ;
461
+ let dense_via_sparse = sparse. to_dense_multilinear_extension ( ) . evaluations ;
462
+ let dense_via_to_evals = sparse. to_evaluations ( ) ;
463
+ assert_eq ! (
464
+ dense_via_to_evals, dense_via_sparse,
465
+ "to_evaluations must reproduce the dense vector exactly"
466
+ ) ;
467
+ }
468
+ }
469
+
453
470
#[ test]
454
471
fn evaluate_edge_cases ( ) {
455
472
// test constant polynomial
You can’t perform that action at this time.
0 commit comments