Skip to content

Commit

Permalink
Add PreProcessedColumn Trait
Browse files Browse the repository at this point in the history
  • Loading branch information
Gali-StarkWare committed Jan 9, 2025
1 parent af5475c commit 663fec9
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion crates/prover/src/constraint_framework/preprocessed_columns.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::fmt::Debug;
use std::hash::Hash;
use std::simd::Simd;

use num_traits::{One, Zero};
Expand All @@ -15,8 +17,29 @@ const SIMD_ENUMERATION_0: PackedM31 = unsafe {
]))
};

// TODO(Gali): Rename to PrerocessedColumn.
pub trait PreprocessedColumnTrait: Debug {
fn name(&self) -> &'static str;
/// Used for hashing and comparison of preprocessed columns.
/// The id should be unique for each preprocessed column - one naive
/// implementation is: "PreProcessedColumnName(PreProcessedColumnsVariables)".
fn id(&self) -> String;
fn log_size(&self) -> u32;
}
impl PartialEq for dyn PreprocessedColumnTrait {
fn eq(&self, other: &Self) -> bool {
self.id() == other.id()
}
}
impl Eq for dyn PreprocessedColumnTrait {}
impl Hash for dyn PreprocessedColumnTrait {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.id().hash(state);
}
}

// TODO(ilya): Where should this enum be placed?
// TODO(Gali): Consider making it a trait, add documentation for the rest of the variants.
// TODO(Gali): Add documentation for the rest of the variants.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum PreprocessedColumn {
/// A column with `1` at the first position, and `0` elsewhere.
Expand Down

0 comments on commit 663fec9

Please sign in to comment.