Fix some off-by-one errors in the degrees

This commit is contained in:
wborgeaud 2021-08-09 18:42:01 +02:00
parent fe36030080
commit 21f90ca853
2 changed files with 4 additions and 4 deletions

View File

@ -64,9 +64,9 @@ impl<F: Extendable<D>, const D: usize> Tree<GateRef<F, D>> {
gates.sort_unstable_by_key(|g| (-(g.0.degree() as isize), -(g.0.num_constants() as isize)));
for max_degree_bits in 1..10 {
// The constraint polynomials are padded to the next power in `compute_vanishig_polys`.
// So we can restrict our search space by setting `max_degree` to a power of 2.
let max_degree = 1 << max_degree_bits;
// The quotient polynomials are padded to the next power of 2 in `compute_vanishig_polys`.
// So we can restrict our search space by setting `max_degree` to 1 + a power of 2.
let max_degree = 1 << max_degree_bits + 1;
for max_constants in 1..100 {
if let Some(mut best_tree) = Self::find_tree(&gates, max_degree, max_constants) {
let mut best_num_constants = best_tree.num_constants();

View File

@ -332,7 +332,7 @@ fn compute_quotient_polys<'a, F: Extendable<D>, const D: usize>(
alphas: &[F],
) -> Vec<PolynomialCoeffs<F>> {
let num_challenges = common_data.config.num_challenges;
let max_degree_bits = log2_ceil(common_data.quotient_degree_factor + 1);
let max_degree_bits = log2_ceil(common_data.quotient_degree_factor);
assert!(
max_degree_bits <= common_data.config.rate_bits,
"Having constraints of degree higher than the rate is not supported yet. \