mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-07 16:23:12 +00:00
Check each PolynomialValues len
I.e. that it is the length of some power-of-two subgroup.
This commit is contained in:
parent
8a8b3f36aa
commit
464b23297c
@ -61,7 +61,7 @@ pub fn fft_with_options<F: Field>(
|
|||||||
) -> PolynomialValues<F> {
|
) -> PolynomialValues<F> {
|
||||||
let PolynomialCoeffs { coeffs: mut buffer } = poly;
|
let PolynomialCoeffs { coeffs: mut buffer } = poly;
|
||||||
fft_dispatch(&mut buffer, zero_factor, root_table);
|
fft_dispatch(&mut buffer, zero_factor, root_table);
|
||||||
PolynomialValues { values: buffer }
|
PolynomialValues::new(buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|||||||
@ -19,9 +19,7 @@ pub fn interpolant<F: Field>(points: &[(F, F)]) -> PolynomialCoeffs<F> {
|
|||||||
.map(|x| interpolate(points, x, &barycentric_weights))
|
.map(|x| interpolate(points, x, &barycentric_weights))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut coeffs = ifft(PolynomialValues {
|
let mut coeffs = ifft(PolynomialValues::new(subgroup_evals));
|
||||||
values: subgroup_evals,
|
|
||||||
});
|
|
||||||
coeffs.trim();
|
coeffs.trim();
|
||||||
coeffs
|
coeffs
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,8 @@ pub struct PolynomialValues<F: Field> {
|
|||||||
|
|
||||||
impl<F: Field> PolynomialValues<F> {
|
impl<F: Field> PolynomialValues<F> {
|
||||||
pub fn new(values: Vec<F>) -> Self {
|
pub fn new(values: Vec<F>) -> Self {
|
||||||
|
// Check that a subgroup exists of this size, which should be a power of two.
|
||||||
|
debug_assert!(log2_strict(values.len()) <= F::TWO_ADICITY);
|
||||||
PolynomialValues { values }
|
PolynomialValues { values }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user