Struct winter_prover::TraceLayout
source · pub struct TraceLayout { /* private fields */ }
Expand description
Layout of columns within an execution trace.
A layout describes how columns of a trace are arranged into segments. All execution traces must have a non-zero main segment, and may have additional auxiliary trace segments. Currently, the number of auxiliary trace segments is limited to one.
Additionally, a layout contains information on how many random elements are required to build a given auxiliary trace segment. This information is used to construct AuxTraceRandElements struct which is passed in as one of the parameters to Air::evaluate_aux_transition() and Air::get_aux_assertions() methods.
The number of random elements may be different from the number of columns in a given auxiliary segment. For example, an auxiliary segment may contain just one column, but may require many random elements.
Implementations
sourceimpl TraceLayout
impl TraceLayout
sourcepub fn new(
main_width: usize,
aux_widths: [usize; 1],
aux_rands: [usize; 1]
) -> TraceLayout
pub fn new(
main_width: usize,
aux_widths: [usize; 1],
aux_rands: [usize; 1]
) -> TraceLayout
Returns a new TraceLayout instantiated with the provided info.
Panics
Panics if:
- Width of the main trace segment is set to zero.
- Sum of all segment widths exceeds 255.
- A zero entry in auxiliary segment width array is followed by a non-zero entry.
- Number of random elements for an auxiliary trace segment of non-zero width is set to zero.
- Number of random elements for an auxiliary trace segment of zero width is set to non-zero.
- Number of random elements for any auxiliary trace segment is greater than 255.
sourcepub fn main_trace_width(&self) -> usize
pub fn main_trace_width(&self) -> usize
Returns the number of columns in the main segment of an execution trace.
This is guaranteed to be between 1 and 255.
sourcepub fn aux_trace_width(&self) -> usize
pub fn aux_trace_width(&self) -> usize
Returns the number of columns in all auxiliary segments of an execution trace.
sourcepub fn num_segments(&self) -> usize
pub fn num_segments(&self) -> usize
Returns the total number of segments in an execution trace.
sourcepub fn num_aux_segments(&self) -> usize
pub fn num_aux_segments(&self) -> usize
Returns the number of auxiliary trace segments in an execution trace.
sourcepub fn get_aux_segment_width(&self, segment_idx: usize) -> usize
pub fn get_aux_segment_width(&self, segment_idx: usize) -> usize
Returns the number of columns in the auxiliary trace segment at the specified index.
sourcepub fn get_aux_segment_rand_elements(&self, segment_idx: usize) -> usize
pub fn get_aux_segment_rand_elements(&self, segment_idx: usize) -> usize
Returns the number of random elements required by the auxiliary trace segment at the specified index.
Trait Implementations
sourceimpl Clone for TraceLayout
impl Clone for TraceLayout
sourcefn clone(&self) -> TraceLayout
fn clone(&self) -> TraceLayout
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for TraceLayout
impl Debug for TraceLayout
sourceimpl Deserializable for TraceLayout
impl Deserializable for TraceLayout
sourcefn read_from<R>(source: &mut R) -> Result<TraceLayout, DeserializationError>where
R: ByteReader,
fn read_from<R>(source: &mut R) -> Result<TraceLayout, DeserializationError>where
R: ByteReader,
Reads TraceLayout from the specified source
and returns the result.
Errors
Returns an error of a valid TraceLayout struct could not be read from the specified
source
.
sourcefn read_batch_from<R>(
source: &mut R,
num_elements: usize
) -> Result<Vec<Self, Global>, DeserializationError>where
R: ByteReader,
fn read_batch_from<R>(
source: &mut R,
num_elements: usize
) -> Result<Vec<Self, Global>, DeserializationError>where
R: ByteReader,
source
, attempts to deserialize these bytes
into a vector with the specified number of Self
elements, and returns the result. Read moresourceimpl PartialEq<TraceLayout> for TraceLayout
impl PartialEq<TraceLayout> for TraceLayout
sourcefn eq(&self, other: &TraceLayout) -> bool
fn eq(&self, other: &TraceLayout) -> bool
sourceimpl Serializable for TraceLayout
impl Serializable for TraceLayout
sourcefn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
fn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
Serializes self
and writes the resulting bytes into the target
.