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

GLV parameters structure, v2 #644

Merged
merged 47 commits into from
Apr 26, 2023
Merged

GLV parameters structure, v2 #644

merged 47 commits into from
Apr 26, 2023

Conversation

mmagician
Copy link
Member

Description

Building on the work from #588 and introducing slight interface & implementation improvements:

  1. Use [(bool, Self::ScalarField); 4] instead of separate structs for bools and scalars. (Best would be to use [(bool, num_bigint::BigInt); 4] but const initialization isn't supported for BigInt.
  2. Simplify internal impl details by using num_bigint::BigInt instead of BigUint - this way we don't need to keep track of all the signs explicitly.

Benches:

  • without GLV:


Arithmetic for Bls12_381::G1/Scalar Multiplication
                        time:   [148.64 µs 148.69 µs 148.73 µs]
  • with GLV:
Arithmetic for Bls12_381::G1/Scalar Multiplication
			time:   [94.551 µs 94.621 µs 94.693 µs]

closes: #588

@simonmasson


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (master)
  • Linked to GitHub issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the GitHub PR explorer

ec/src/scalar_mul/glv.rs Outdated Show resolved Hide resolved
ec/src/scalar_mul/glv.rs Outdated Show resolved Hide resolved
Comment on lines +88 to +90
fn endomorphism(p: &Projective<Self>) -> Projective<Self>;

fn endomorphism_affine(p: &Affine<Self>) -> Affine<Self>;
Copy link
Member

Choose a reason for hiding this comment

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

Might be worth it to add endomorphism(_affine)_in_place methods to avoid having to create a copy in implementations.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it needs at least one copy anyway:

let mut b1 = p;

test-templates/src/glv.rs Outdated Show resolved Hide resolved
@Pratyush
Copy link
Member

@mmagician thank you for the PR! I have left some comments.

@Pratyush Pratyush added T-feature Type: new features T-test Type: test improvements labels Apr 25, 2023
@Pratyush Pratyush merged commit f293ae8 into master Apr 26, 2023
@Pratyush Pratyush deleted the glv-scalar-mul2 branch April 26, 2023 04:38
aleasims pushed a commit to NilFoundation/arkworks-algebra that referenced this pull request Oct 18, 2023
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
Co-authored-by: Simon Masson <simon.masson@yahoo.fr>
aleasims added a commit to NilFoundation/arkworks-algebra that referenced this pull request Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-feature Type: new features T-test Type: test improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants