mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-07 16:23:12 +00:00
Remove addendum
This commit is contained in:
parent
50cafca705
commit
151d1ad07b
@ -206,11 +206,6 @@ pub(crate) fn eval_vanishing_poly_base<F: Extendable<D>, const D: usize>(
|
|||||||
.for_each(|(d, q)| {
|
.for_each(|(d, q)| {
|
||||||
*q *= d.iter().copied().product();
|
*q *= d.iter().copied().product();
|
||||||
});
|
});
|
||||||
dbg!(
|
|
||||||
quotient_values[27],
|
|
||||||
current_partial_products.last().unwrap()
|
|
||||||
);
|
|
||||||
partial_product_check.pop();
|
|
||||||
vanishing_partial_products_terms.extend(partial_product_check);
|
vanishing_partial_products_terms.extend(partial_product_check);
|
||||||
|
|
||||||
// The numerator final product is the product of the last `final_num_prod` elements.
|
// The numerator final product is the product of the last `final_num_prod` elements.
|
||||||
|
|||||||
@ -13,22 +13,10 @@ pub fn partial_products<T: Product + Copy>(v: &[T], max_degree: usize) -> Vec<T>
|
|||||||
while remainder.len() > max_degree {
|
while remainder.len() > max_degree {
|
||||||
let new_partials = remainder
|
let new_partials = remainder
|
||||||
.chunks(max_degree)
|
.chunks(max_degree)
|
||||||
// No need to compute the product if the chunk has size 1.
|
|
||||||
.filter(|chunk| chunk.len() != 1)
|
|
||||||
.map(|chunk| chunk.iter().copied().product())
|
.map(|chunk| chunk.iter().copied().product())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
res.extend_from_slice(&new_partials);
|
res.extend_from_slice(&new_partials);
|
||||||
let addendum = if remainder.len() % max_degree == 1 {
|
|
||||||
vec![*remainder.last().unwrap()]
|
|
||||||
} else {
|
|
||||||
vec![]
|
|
||||||
};
|
|
||||||
remainder = new_partials;
|
remainder = new_partials;
|
||||||
// If there were a chunk of size 1, add it back to the remainder.
|
|
||||||
remainder.extend_from_slice(&addendum);
|
|
||||||
if remainder.len() <= max_degree {
|
|
||||||
res.extend(addendum);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res
|
res
|
||||||
@ -41,12 +29,8 @@ pub fn num_partial_products(n: usize, max_degree: usize) -> (usize, usize) {
|
|||||||
let mut remainder = n;
|
let mut remainder = n;
|
||||||
while remainder > max_degree {
|
while remainder > max_degree {
|
||||||
let new_partials_len = ceil_div_usize(remainder, max_degree);
|
let new_partials_len = ceil_div_usize(remainder, max_degree);
|
||||||
let addendum = if remainder % max_degree == 1 { 1 } else { 0 };
|
res += new_partials_len;
|
||||||
res += new_partials_len - addendum;
|
|
||||||
remainder = new_partials_len;
|
remainder = new_partials_len;
|
||||||
if remainder <= max_degree {
|
|
||||||
res += addendum;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(res, remainder)
|
(res, remainder)
|
||||||
@ -65,20 +49,10 @@ pub fn check_partial_products<T: Product + Copy + Sub<Output = T>>(
|
|||||||
while remainder.len() > max_degree {
|
while remainder.len() > max_degree {
|
||||||
let products = remainder
|
let products = remainder
|
||||||
.chunks(max_degree)
|
.chunks(max_degree)
|
||||||
.filter(|chunk| chunk.len() != 1)
|
|
||||||
.map(|chunk| chunk.iter().copied().product())
|
.map(|chunk| chunk.iter().copied().product())
|
||||||
.collect::<Vec<T>>();
|
.collect::<Vec<T>>();
|
||||||
res.extend(products.iter().zip(&partials).map(|(&a, &b)| a - b));
|
res.extend(products.iter().zip(&partials).map(|(&a, &b)| a - b));
|
||||||
let addendum = if remainder.len() % max_degree == 1 {
|
|
||||||
vec![*remainder.last().unwrap()]
|
|
||||||
} else {
|
|
||||||
vec![]
|
|
||||||
};
|
|
||||||
remainder = partials.drain(..products.len()).collect();
|
remainder = partials.drain(..products.len()).collect();
|
||||||
remainder.extend_from_slice(&addendum);
|
|
||||||
if remainder.len() <= max_degree {
|
|
||||||
res.extend(addendum.into_iter().map(|a| a - *partials.last().unwrap()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res
|
res
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user