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

Rust wrappers for labrador ring #797

Merged
merged 8 commits into from
Mar 11, 2025
Merged

Rust wrappers for labrador ring #797

merged 8 commits into from
Mar 11, 2025

Conversation

yshekel
Copy link
Collaborator

@yshekel yshekel commented Mar 3, 2025

This PR introduces Rust wrappers for rings in both direct and RNS representations, including support for vectorized operations (vec-ops) and NTT (Number Theoretic Transform).

Key Considerations

  • To reuse existing APIs, FieldImpl and similar traits are implemented for rings. While this may seem unconventional, FieldImpl is not strictly tied to fields—it primarily provides utility methods such as one(), zero(), and from_hex().

  • ICICLE rings “mock” fields by implementing inverse(), where non-invertible elements return 0. This approach ensures correct behavior where applicable (e.g., NTT, since twiddles have inverses).

  • An alternative approach would be to introduce a separate API for rings, but this would lead to duplicated code and increased maintenance complexity.

  • The RNS representation behaves similarly to extension fields, as it is another type in the crate with its own arithmetic and API.

  • Rust wrappers for direct scalar

  • Rust wrappers for RNS scalar

Next PRs:

  • Rust wrappers for RNS<-->direct conversions
  • New ring APIs (e.g. decomposition, matrix multiplication and more)
  • Greyhound ring

@yshekel yshekel changed the title Rust wrappers for labrador direct-scalar Rust wrappers for labrador ring Mar 3, 2025
@yshekel yshekel marked this pull request as ready for review March 10, 2025 15:29
Copy link
Contributor

@LeonHibnik LeonHibnik left a comment

Choose a reason for hiding this comment

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

🚀

@yshekel yshekel merged commit 2e2d37c into main Mar 11, 2025
16 checks passed
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