Skip to content
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

Merged
merged 5 commits into from
Mar 21, 2024
Merged

Moving TestShapeCS #91

merged 5 commits into from
Mar 21, 2024

Conversation

tchataigner
Copy link

@tchataigner tchataigner commented Mar 19, 2024

Goal

This PR moves the TestShapeCS from arecibo from bellpepper. It changes the generic type from Engine to PrimeField to do so. This does not imply big changes as we were only leveraging E::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 the TestShapeCS while also revamping the ShapeCS to only use PrimeField and not Engine. This was done for uniformity but can be reverted if we deem the change to introduce too many mandatory types indication (eg: 1, 2, ...)

Comment on lines +71 to +94
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
}
Copy link

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

Copy link
Author

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?

Copy link

@adr1anh adr1anh left a 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!

Copy link
Contributor

@huitseeker huitseeker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@tchataigner tchataigner added this pull request to the merge queue Mar 21, 2024
Merged via the queue into dev with commit 1afbae9 Mar 21, 2024
7 checks passed
@tchataigner tchataigner deleted the feature/test-shape-cs branch March 21, 2024 17:28
wwared pushed a commit that referenced this pull request Aug 7, 2024
* feat(test-shape-cs): TestShapeCS

* refactor(test-shape-cs): bellpepper instead of bellpepper-core

* refactor(test-shape-cs): debug on test cs

* refactor(test-shape-cs): fix clippy & fmt

* feat(test-shape-cs): added ShapeCS
samuelburnham pushed a commit that referenced this pull request Aug 7, 2024
* feat(test-shape-cs): TestShapeCS

* refactor(test-shape-cs): bellpepper instead of bellpepper-core

* refactor(test-shape-cs): debug on test cs

* refactor(test-shape-cs): fix clippy & fmt

* feat(test-shape-cs): added ShapeCS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants