frontend/
utils.rs

1/// FIXME the functions below are uncategorized and probably should be moved to a more appropriate
2/// module or submodule.
3use shared_types::Field;
4
5use crate::layouter::nodes::{
6    circuit_inputs::{InputLayerNode, InputShred, InputShredData},
7    CircuitNode,
8};
9use remainder::mle::evals::MultilinearExtension;
10
11/// Using the number of variables, get an input shred that represents
12/// this information.
13pub fn get_input_shred_from_num_vars(num_vars: usize, input_node: &InputLayerNode) -> InputShred {
14    InputShred::new(num_vars, input_node)
15}
16
17/// Using a data vector, get an [InputShred] which represents its
18/// shape, along with [InputShredData] which represents the
19/// corresponding data.
20pub fn build_input_shred_and_data<F: Field>(
21    data: MultilinearExtension<F>,
22    input_node: &InputLayerNode,
23) -> (InputShred, InputShredData<F>) {
24    let input_shred = InputShred::new(data.num_vars(), input_node);
25    let input_shred_data = InputShredData::new(input_shred.id(), data);
26    (input_shred, input_shred_data)
27}