-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement additive operation of polynomials
- Loading branch information
Showing
5 changed files
with
27 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
use pairing::Engine; | ||
pub mod commitment; | ||
pub mod s_eval; | ||
pub mod operations; | ||
|
||
pub struct Polynomial<E: Engine>(Vec<E::Fr>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use bellman::multicore::Worker; | ||
use pairing::{Engine, Field}; | ||
|
||
pub fn add_polynomials<F: Field>(a: &mut [F], b: &[F]) { | ||
assert_eq!(a.len(), b.len()); | ||
|
||
let worker = Worker::new(); | ||
|
||
worker.scope(a.len(), |scope, chunk| { | ||
for (a, b) in a.chunks_mut(chunk).zip(b.chunks(chunk)) { | ||
scope.spawn(move |_| { | ||
for (a, b) in a.iter_mut().zip(b.iter()) { | ||
a.add_assign(b); | ||
} | ||
}); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters