Skip to content

Commit

Permalink
Merge pull request #36 from davidkathoh/main
Browse files Browse the repository at this point in the history
implemented #24 and made field, polynomial, mpolynomila modules public
  • Loading branch information
elielnfinic authored Mar 21, 2024
2 parents 852611e + e698f5c commit 53168a3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
6 changes: 3 additions & 3 deletions baby-stark/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use baby_stark_math_lib;

use crate::field::FieldElement;

mod field;
mod polynomial;
mod mpolynomial;
pub mod field;
pub mod polynomial;
pub mod mpolynomial;

fn main() {
println!("Hello, world!");
Expand Down
40 changes: 36 additions & 4 deletions baby-stark/src/mpolynomial.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,39 @@
pub struct MPolynomial{

use crate::field::FieldElement;
use std::collections::HashMap;
pub struct MPolynomial {
dictionary: HashMap<String, FieldElement>,
}

impl MPolynomial{
impl MPolynomial {
pub fn from(dictionary: HashMap<String, FieldElement>) -> MPolynomial {
MPolynomial { dictionary }
}

}
pub fn zero() -> MPolynomial {
let my_hash_map: HashMap<String, FieldElement> = HashMap::new();

MPolynomial {
dictionary: my_hash_map,
}
}
}

#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_creation_polynomial() {
let mut my_dic: HashMap<String, FieldElement> = HashMap::new();
my_dic.insert("x".to_string(), FieldElement::new());
my_dic.insert("y".to_string(), FieldElement::new());
my_dic.insert("y".to_string(), FieldElement::new());
let x = MPolynomial { dictionary: my_dic };
}

#[test]
fn test_init_polynomial() {
let mut my_dic: HashMap<String, FieldElement> = HashMap::new();
my_dic.insert("x".to_string(), FieldElement::new());
let poly = MPolynomial::from(my_dic);
}
}

0 comments on commit 53168a3

Please sign in to comment.