mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-05-21 17:29:52 +00:00
progress
This commit is contained in:
parent
1ccff4d004
commit
c2d7044fb6
@ -216,32 +216,23 @@ impl<F: Extendable<D>, const D: usize, const CHUNK_SIZE: usize> SimpleGenerator<
|
|||||||
|
|
||||||
let get_local_wire = |input| witness.get_wire(local_wire(input));
|
let get_local_wire = |input| witness.get_wire(local_wire(input));
|
||||||
|
|
||||||
// Compute the new vector and the values for equality_dummy and index_matches
|
for c in 0..self.gate.num_copies {
|
||||||
let vec_size = self.gate.vec_size;
|
let switch_bool = get_local_wire(self.gate.wire_switch_bool(c));
|
||||||
let access_index_f = get_local_wire(self.gate.wires_access_index());
|
for e in 0..CHUNK_SIZE {
|
||||||
|
let first_input = get_local_wire(self.gate.wire_first_input(c, e));
|
||||||
|
let second_input = get_local_wire(self.gate.wire_second_input(c, e));
|
||||||
|
let first_output_wire = local_wire(self.gate.wire_first_output(c, e));
|
||||||
|
let second_output_wire = local_wire(self.gate.wire_second_output(c, e));
|
||||||
|
|
||||||
let access_index = access_index_f.to_canonical_u64() as usize;
|
if switch_bool == F::ONE {
|
||||||
debug_assert!(
|
out_buffer.set_wire(first_output_wire, second_input);
|
||||||
access_index < vec_size,
|
out_buffer.set_wire(second_output_wire, first_input);
|
||||||
"Access index {} is larger than the vector size {}",
|
} else {
|
||||||
access_index,
|
out_buffer.set_wire(first_output_wire, first_input);
|
||||||
vec_size
|
out_buffer.set_wire(second_output_wire, second_input);
|
||||||
);
|
}
|
||||||
|
|
||||||
for i in 0..vec_size {
|
|
||||||
let equality_dummy_wire = local_wire(self.gate.wire_equality_dummy_for_index(i));
|
|
||||||
let index_matches_wire = local_wire(self.gate.wire_index_matches_for_index(i));
|
|
||||||
|
|
||||||
if i == access_index {
|
|
||||||
out_buffer.set_wire(equality_dummy_wire, F::ONE);
|
|
||||||
out_buffer.set_wire(index_matches_wire, F::ONE);
|
|
||||||
} else {
|
|
||||||
out_buffer.set_wire(
|
|
||||||
equality_dummy_wire,
|
|
||||||
(F::from_canonical_usize(i) - F::from_canonical_usize(access_index)).inverse(),
|
|
||||||
);
|
|
||||||
out_buffer.set_wire(index_matches_wire, F::ZERO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user