Skip to content

Commit

Permalink
Create wide fib structure (#541)
Browse files Browse the repository at this point in the history
<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/starkware-libs/stwo/541)
<!-- Reviewable:end -->
  • Loading branch information
shaharsamocha7 authored Mar 27, 2024
2 parents 8694c9a + 4e7adef commit a157d76
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/examples/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pub mod fibonacci;
pub mod wide_fibonacci;
38 changes: 38 additions & 0 deletions src/examples/wide_fibonacci/constraint_eval.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
use super::structs::WideFibComponent;
use crate::core::air::accumulation::{DomainEvaluationAccumulator, PointEvaluationAccumulator};
use crate::core::air::{Component, ComponentTrace, Mask};
use crate::core::backend::CPUBackend;
use crate::core::circle::CirclePoint;
use crate::core::fields::qm31::SecureField;
use crate::core::ColumnVec;

impl Component<CPUBackend> for WideFibComponent {
fn max_constraint_log_degree_bound(&self) -> u32 {
self.log_size + 1
}

fn trace_log_degree_bounds(&self) -> Vec<u32> {
vec![self.log_size; 256]
}

fn mask(&self) -> Mask {
Mask(vec![vec![0_usize]; 256])
}

fn evaluate_constraint_quotients_on_domain(
&self,
_trace: &ComponentTrace<'_, CPUBackend>,
_evaluation_accumulator: &mut DomainEvaluationAccumulator<CPUBackend>,
) {
unimplemented!("not implemented")
}

fn evaluate_constraint_quotients_at_point(
&self,
_point: CirclePoint<SecureField>,
_mask: &ColumnVec<Vec<SecureField>>,
_evaluation_accumulator: &mut PointEvaluationAccumulator,
) {
unimplemented!("not implemented")
}
}
3 changes: 3 additions & 0 deletions src/examples/wide_fibonacci/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub mod constraint_eval;
pub mod structs;
pub mod trace_gen;
13 changes: 13 additions & 0 deletions src/examples/wide_fibonacci/structs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use crate::core::fields::m31::BaseField;

/// Component that computes fibonacci numbers over 64 columns.
pub struct WideFibComponent {
pub log_size: u32,
}

// Input for the fibonacci claim.
#[derive(Debug, Clone, Copy)]
pub struct Input {
pub a: BaseField,
pub b: BaseField,
}
7 changes: 7 additions & 0 deletions src/examples/wide_fibonacci/trace_gen.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use super::structs::Input;
use crate::core::fields::m31::BaseField;

/// Given a private input, write the trace row for the wide Fibonacci example to dst.
pub fn write_trace_row(_dst: &mut [Vec<BaseField>], _private_input: &Input, _row_offset: usize) {
unimplemented!()
}

0 comments on commit a157d76

Please sign in to comment.