mirror of https://github.com/zcash/halo2.git
Migrate benches and examples to `impl Neg for Expression`
This commit is contained in:
parent
7355462a9f
commit
eb2b020d8c
|
@ -200,7 +200,7 @@ fn bench_with_k(name: &str, k: u32, c: &mut Criterion) {
|
|||
let sc = meta.query_fixed(sc, Rotation::cur());
|
||||
let sm = meta.query_fixed(sm, Rotation::cur());
|
||||
|
||||
vec![a.clone() * sa + b.clone() * sb + a * b * sm + (c * sc * (-F::one()))]
|
||||
vec![a.clone() * sa + b.clone() * sb + a * b * sm - (c * sc)]
|
||||
});
|
||||
|
||||
PlonkConfig {
|
||||
|
|
|
@ -246,13 +246,7 @@ fn main() {
|
|||
let sc = meta.query_fixed(sc, Rotation::cur());
|
||||
let sm = meta.query_fixed(sm, Rotation::cur());
|
||||
|
||||
vec![
|
||||
a.clone() * sa
|
||||
+ b.clone() * sb
|
||||
+ a * b * sm
|
||||
+ (c * sc * (-F::one()))
|
||||
+ sf * (d * e),
|
||||
]
|
||||
vec![a.clone() * sa + b.clone() * sb + a * b * sm - (c * sc) + sf * (d * e)]
|
||||
});
|
||||
|
||||
PlonkConfig {
|
||||
|
|
|
@ -118,7 +118,7 @@ impl<F: FieldExt> FieldChip<F> {
|
|||
// has the following properties:
|
||||
// - When s_mul = 0, any value is allowed in lhs, rhs, and out.
|
||||
// - When s_mul != 0, this constrains lhs * rhs = out.
|
||||
vec![s_mul * (lhs * rhs + out * -F::one())]
|
||||
vec![s_mul * (lhs * rhs - out)]
|
||||
});
|
||||
|
||||
FieldConfig {
|
||||
|
|
|
@ -170,7 +170,7 @@ impl<F: FieldExt> AddChip<F> {
|
|||
let out = meta.query_advice(advice[0], Rotation::next());
|
||||
let s_add = meta.query_selector(s_add);
|
||||
|
||||
vec![s_add * (lhs + rhs + out * -F::one())]
|
||||
vec![s_add * (lhs + rhs - out)]
|
||||
});
|
||||
|
||||
AddConfig { advice, s_add }
|
||||
|
@ -311,7 +311,7 @@ impl<F: FieldExt> MulChip<F> {
|
|||
// has the following properties:
|
||||
// - When s_mul = 0, any value is allowed in lhs, rhs, and out.
|
||||
// - When s_mul != 0, this constrains lhs * rhs = out.
|
||||
vec![s_mul * (lhs * rhs + out * -F::one())]
|
||||
vec![s_mul * (lhs * rhs - out)]
|
||||
});
|
||||
|
||||
MulConfig { advice, s_mul }
|
||||
|
|
Loading…
Reference in New Issue