kimchi/circuits/witness/copy_cell.rs
1use ark_ff::Field;
2
3use super::{variables::Variables, WitnessCell};
4
5/// Witness cell copied from another witness cell
6pub struct CopyCell {
7 row: usize,
8 col: usize,
9}
10
11impl CopyCell {
12 /// Create a witness cell copied from the witness cell at position (row, col)
13 pub fn create(row: usize, col: usize) -> Box<CopyCell> {
14 Box::new(CopyCell { row, col })
15 }
16}
17
18impl<F: Field, const W: usize> WitnessCell<F, F, W> for CopyCell {
19 fn value(&self, witness: &mut [Vec<F>; W], _variables: &Variables<F>, _index: usize) -> F {
20 witness[self.col][self.row]
21 }
22}