Skip to content

Commit f73f1f2

Browse files
committed
remove to_vec
1 parent 8c5d074 commit f73f1f2

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

crates/stark-backend/src/gkr/prover.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,13 @@ use crate::{
2727
/// Evaluations are stored in lexicographic order i.e. `evals[0] = eq((0, ..., 0, 0), y)`,
2828
/// `evals[1] = eq((0, ..., 0, 1), y)`, etc.
2929
#[derive(Debug, Clone)]
30-
struct FixedFirstHypercubeEqEvals<F> {
31-
y: Vec<F>,
30+
struct FixedFirstHypercubeEqEvals<'a, F> {
31+
y: &'a [F],
3232
evals: Vec<F>,
3333
}
3434

35-
impl<F: Field> FixedFirstHypercubeEqEvals<F> {
36-
pub fn eval(y: &[F]) -> Self {
37-
let y = y.to_vec();
38-
35+
impl<'a, F: Field> FixedFirstHypercubeEqEvals<'a, F> {
36+
pub fn eval(y: &'a [F]) -> Self {
3937
if y.is_empty() {
4038
let evals = vec![F::ONE];
4139
return Self { evals, y };
@@ -48,7 +46,7 @@ impl<F: Field> FixedFirstHypercubeEqEvals<F> {
4846
}
4947

5048
/// Returns evaluations of the function `x -> eq(x, y) * v` for each `x` in `{0, 1}^n`.
51-
fn gen(y: &[F], v: F) -> Vec<F> {
49+
fn gen(y: &'a [F], v: F) -> Vec<F> {
5250
let n = 1 << y.len();
5351
let mut evals = vec![F::ZERO; n];
5452
evals[0] = v;
@@ -67,7 +65,7 @@ impl<F: Field> FixedFirstHypercubeEqEvals<F> {
6765
}
6866
}
6967

70-
impl<F> Deref for FixedFirstHypercubeEqEvals<F> {
68+
impl<F> Deref for FixedFirstHypercubeEqEvals<'_, F> {
7169
type Target = [F];
7270

7371
fn deref(&self) -> &Self::Target {
@@ -94,7 +92,7 @@ impl<F> Deref for FixedFirstHypercubeEqEvals<F> {
9492
/// P(x) = eq(x, y) * (numer(x) + lambda * denom(x))
9593
/// ```
9694
struct GkrMultivariatePolyOracle<'a, F: Clone> {
97-
pub eq_evals: &'a FixedFirstHypercubeEqEvals<F>,
95+
pub eq_evals: &'a FixedFirstHypercubeEqEvals<'a, F>,
9896
pub input_layer: Layer<F>,
9997
pub eq_fixed_var_correction: F,
10098
/// Used by LogUp to perform a random linear combination of the numerators and denominators.

0 commit comments

Comments
 (0)