Skip to content

Commit

Permalink
wip compute_coeff
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-barrett committed Dec 21, 2023
1 parent dbfc411 commit a9aa51e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 17 additions & 2 deletions src/fib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
eval::lang::Coproc,
eval::lang::{Coproc, Lang},
field::LurkField,
lem::{eval::evaluate_simple, pointers::Ptr, store::Store},
lem::{eval::{compute_frame, eval_step, evaluate_simple}, pointers::Ptr, store::Store},
};

pub fn fib_expr<F: LurkField>(store: &Store<F>) -> Ptr {
Expand Down Expand Up @@ -29,6 +29,21 @@ pub fn fib_limit(n: usize, rc: usize) -> usize {
rc * (frame / rc + usize::from(frame % rc != 0))
}

pub fn compute_coeff<F: LurkField>(store: &Store<F>) -> (usize, usize) {
let mut input = vec![fib_expr(store), store.intern_nil(), store.cont_outermost()];
let lang: Lang<F, Coproc<F>> = Lang::new();
loop {
// TODO
let (frame, _) =
compute_frame(eval_step(), &[], &input, store, &lang, &mut vec![], 0).unwrap();

input = frame.output.clone();
let expr = frame.output[0];
break;
}
(0, 0)
}

pub fn lurk_fib<F: LurkField>(store: &Store<F>, n: usize) -> Ptr {
let frame_idx = fib_frame(n);
let limit = frame_idx;
Expand Down
2 changes: 1 addition & 1 deletion src/lem/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn get_pc<F: LurkField, C: Coprocessor<F>>(
}
}

fn compute_frame<F: LurkField, C: Coprocessor<F>>(
pub fn compute_frame<F: LurkField, C: Coprocessor<F>>(
lurk_step: &Func,
cprocs_run: &[Func],
input: &[Ptr],
Expand Down

0 comments on commit a9aa51e

Please sign in to comment.