zero-chain icon indicating copy to clipboard operation
zero-chain copied to clipboard

Use a `Polynomial` type instead of `Vec<E::Fr>`

Open osuketh opened this issue 6 years ago • 3 comments

Operations over polynomial and commitment would be changed because of the new type definition. https://github.com/LayerXcom/zero-chain/blob/d866d2e469ff4c9ee3b58db061fe25e71fbd765f/core/sonic/src/polynomials/mod.rs#L6

osuketh avatar Apr 19 '19 10:04 osuketh

It could be type alias.

osuketh avatar Apr 22 '19 10:04 osuketh

You might want +, *, etc. defined, which prevents using a type alias. You might check into using both Vec and SmallVec with roughly:

pub struct Polynomial<E,V>(V)
where E: Engine: V: Borrow<[E::Fr]>+BorrowMut<[E::Fr]>+Default; 

Appears VecLike was deprecated in favor of just Extend though, so maybe mutation does not work so well.

burdges avatar Apr 22 '19 10:04 burdges

LGTM! It should be implemented as operator overloadings. I've never used SmallVec. How much would it be optimized actually?

osuketh avatar Apr 22 '19 11:04 osuketh