Skip to content

feat: direct multivariate polynomial evaluation in non-native#1299

Merged
ivokub merged 14 commits intomasterfrom
feat/nna-poly
Nov 22, 2024
Merged

feat: direct multivariate polynomial evaluation in non-native#1299
ivokub merged 14 commits intomasterfrom
feat/nna-poly

Conversation

@ivokub
Copy link
Copy Markdown
Collaborator

@ivokub ivokub commented Oct 16, 2024

Description

This PR adds direct multivariate polynomial evaluation using non-native arithmetic. It can be used to perform direct extension computation, used in pairing computation (BW6, BN254, BLS12-377).

The idea is very similar to the multiplication approach, but when we do the evaluation check then we can work with arbitrary multivariate polynomials. This is really beneficial as the most of the cost is in range checking the result and the quotient, so when we can amortize multiple operations.

Another PR using it in BW6 evaluation is incoming, but it saves more than 50% of constraints in the Miller loop computation.

NB! One thing which I haven't figure out is how to allow negative coefficients. For example for BW6 we need to multiply by the non residue -4 for which we currently use a non-native value. But this changes the carry computation and SZ check which still isn't fully functional. But I think I'll keep it for the future to get working.

Type of change

  • New feature (non-breaking change which adds functionality)

How has this been tested?

  • TestPolyEval

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@ivokub ivokub mentioned this pull request Oct 22, 2024
9 tasks
@ivokub ivokub requested a review from gbotrel November 4, 2024 16:13
@ivokub ivokub self-assigned this Nov 4, 2024
@ivokub ivokub added this to the v0.11.N milestone Nov 4, 2024
@ivokub ivokub marked this pull request as ready for review November 4, 2024 16:13
Copy link
Copy Markdown
Collaborator

@gbotrel gbotrel left a comment

Choose a reason for hiding this comment

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

nice, I like the new interface and multivariate poly representation, much easier to follow / less verbose :)

@ivokub ivokub requested a review from gbotrel November 22, 2024 13:32
@ivokub ivokub merged commit 32e3404 into master Nov 22, 2024
@ivokub ivokub deleted the feat/nna-poly branch November 22, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants