2021-05-19 15:57:28 -07:00
|
|
|
use std::convert::TryInto;
|
|
|
|
|
use std::ops::Range;
|
|
|
|
|
|
|
|
|
|
use crate::field::extension_field::{Extendable, FieldExtension};
|
2021-02-09 21:25:21 -08:00
|
|
|
use crate::field::field::Field;
|
2021-03-28 15:36:51 -07:00
|
|
|
use crate::target::Target;
|
2021-02-09 21:25:21 -08:00
|
|
|
|
2021-03-28 15:36:51 -07:00
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
|
pub struct EvaluationVars<'a, F: Field> {
|
2021-02-09 21:25:21 -08:00
|
|
|
pub(crate) local_constants: &'a [F],
|
2021-03-18 12:44:45 -07:00
|
|
|
pub(crate) local_wires: &'a [F],
|
2021-02-09 21:25:21 -08:00
|
|
|
}
|
|
|
|
|
|
2021-05-19 15:57:28 -07:00
|
|
|
impl<'a, F: Field> EvaluationVars<'a, F> {
|
|
|
|
|
pub fn get_local_ext<const D: usize>(&self, wire_range: Range<usize>) -> F::Extension
|
|
|
|
|
where
|
|
|
|
|
F: Extendable<D>,
|
|
|
|
|
{
|
|
|
|
|
debug_assert_eq!(wire_range.len(), D);
|
|
|
|
|
let arr = self.local_wires[wire_range].try_into().unwrap();
|
|
|
|
|
F::Extension::from_basefield_array(arr)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-02 19:15:39 -07:00
|
|
|
#[derive(Copy, Clone)]
|
2021-03-28 15:36:51 -07:00
|
|
|
pub struct EvaluationTargets<'a> {
|
|
|
|
|
pub(crate) local_constants: &'a [Target],
|
|
|
|
|
pub(crate) local_wires: &'a [Target],
|
2021-02-09 21:25:21 -08:00
|
|
|
}
|