-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moving TestShapeCS
#91
Conversation
fn proc_lc<Scalar: PrimeField>( | ||
terms: &LinearCombination<Scalar>, | ||
) -> BTreeMap<OrderedVariable, Scalar> { | ||
let mut map = BTreeMap::new(); | ||
for (var, &coeff) in terms.iter() { | ||
map.entry(OrderedVariable(var)) | ||
.or_insert_with(|| Scalar::ZERO) | ||
.add_assign(&coeff); | ||
} | ||
|
||
// Remove terms that have a zero coefficient to normalize | ||
let mut to_remove = vec![]; | ||
for (var, coeff) in map.iter() { | ||
if coeff.is_zero().into() { | ||
to_remove.push(*var) | ||
} | ||
} | ||
|
||
for var in to_remove { | ||
map.remove(&var); | ||
} | ||
|
||
map | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicated in test_cs.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method is private. As we are trying to only merge changes to bellpepper
in dev
and changes to bellpepper-core
in main
I propose that I add a todo for DRY in the code and open an issue that can be tackled on the next bellpepper-core
release.
Does that sound alright?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get the duplication figured out later on!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Goal
This PR moves the
TestShapeCS
fromarecibo
frombellpepper
. It changes the generic type fromEngine
toPrimeField
to do so. This does not imply big changes as we were only leveragingE::Scalar
anyway.Parallel to this PR I have created a branch on
arecibo
, which we can use to integrate these changes once they are merged. The branch removes theTestShapeCS
while also revamping theShapeCS
to only usePrimeField
and notEngine
. This was done for uniformity but can be reverted if we deem the change to introduce too many mandatory types indication (eg: 1, 2, ...)