use ark_ff::Field;
use kimchi::circuits::polynomial::COLUMNS;
use serde::Serialize;
use serde_with::serde_as;
use std::array;
#[serde_as]
#[derive(Debug, Serialize)]
pub struct Witness<F>
where
F: Field,
{
#[serde_as(as = "[Vec<o1_utils::serialization::SerdeAs>; COLUMNS]")]
inner: [Vec<F>; COLUMNS],
}
impl<F> Witness<F>
where
F: Field,
{
pub fn new(rows: usize) -> Self {
Witness {
inner: array::from_fn(|_| vec![F::zero(); rows]),
}
}
pub fn inner(self) -> [Vec<F>; COLUMNS] {
self.inner
}
}
impl<F> From<[Vec<F>; COLUMNS]> for Witness<F>
where
F: Field,
{
fn from(inner: [Vec<F>; COLUMNS]) -> Self {
Witness { inner }
}
}