Account for Rotations of LagrangeCoeff values
This commit is contained in:
parent
8e56b415fb
commit
df2d818891
|
@ -97,16 +97,22 @@ impl<F: FieldExt> Argument<F> {
|
|||
.map(|expression| {
|
||||
expression.evaluate(
|
||||
&|index| {
|
||||
let column_index = pk.vk.cs.fixed_queries[index].0.index();
|
||||
fixed_values[column_index].clone()
|
||||
let query = pk.vk.cs.fixed_queries[index];
|
||||
let column_index = query.0.index();
|
||||
let rotation = query.1;
|
||||
fixed_values[column_index].clone().rotate(rotation)
|
||||
},
|
||||
&|index| {
|
||||
let column_index = pk.vk.cs.advice_queries[index].0.index();
|
||||
advice_values[column_index].clone()
|
||||
let query = pk.vk.cs.advice_queries[index];
|
||||
let column_index = query.0.index();
|
||||
let rotation = query.1;
|
||||
advice_values[column_index].clone().rotate(rotation)
|
||||
},
|
||||
&|index| {
|
||||
let column_index = pk.vk.cs.instance_queries[index].0.index();
|
||||
instance_values[column_index].clone()
|
||||
let query = pk.vk.cs.instance_queries[index];
|
||||
let column_index = query.0.index();
|
||||
let rotation = query.1;
|
||||
instance_values[column_index].clone().rotate(rotation)
|
||||
},
|
||||
&|a, b| a + &b,
|
||||
&|a, b| {
|
||||
|
|
16
src/poly.rs
16
src/poly.rs
|
@ -187,6 +187,22 @@ impl<'a, F: Field> Mul<&'a Polynomial<F, ExtendedLagrangeCoeff>>
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, F: Field> Polynomial<F, LagrangeCoeff> {
|
||||
/// Rotates the values in a Lagrange basis polynomial by `Rotation`
|
||||
pub fn rotate(&self, rotation: Rotation) -> Polynomial<F, LagrangeCoeff> {
|
||||
let mut values = self.values.clone();
|
||||
if rotation.0 < 0 {
|
||||
values.rotate_right((-rotation.0) as usize);
|
||||
} else {
|
||||
values.rotate_left(rotation.0 as usize);
|
||||
}
|
||||
Polynomial {
|
||||
values,
|
||||
_marker: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, F: Field, B: Basis> Mul<F> for Polynomial<F, B> {
|
||||
type Output = Polynomial<F, B>;
|
||||
|
||||
|
|
Loading…
Reference in New Issue