Skip to content

Conversation

@jnsiemer
Copy link
Member

Description

This PR removes the following "overprotective" measures from samplers...

  • uniform sampling now also works over intervals of size 1, which will always output this single element
  • discrete Gaussian sampling adapts the change from uniform sampling (just some changes on the doc-comments)
  • binomial sampling now also works for 0 tries, i.e. always with output 0, which is well-defined

Furthermore, this PR implements the more efficient discrete Gaussian sampler (for sampling with static Gaussian parameters across all entries) for matrices over polynomials, i.e.

  • MatPolyOverZ::sample_discrete_gauss
  • MatPolynomialRingZq::sample_discrete_gauss

Testing

  • I added basic working examples (possibly in doc-comment)
  • I added tests for large (pointer representation) values
  • I triggered all possible errors in my test in every possible way
  • I included tests for all reasonable edge cases

Checklist:

  • I have performed a self-review of my own code
    • The code provides good readability and maintainability s.t. it fulfills best practices like talking code, modularity, ...
      • The chosen implementation is not more complex than it has to be
    • My code should work as intended and no side effects occur (e.g. memory leaks)
    • The doc comments fit our style guide

@jnsiemer jnsiemer self-assigned this Jul 23, 2025
@jnsiemer jnsiemer added the documentation📖 Improvements or additions to documentation label Jul 23, 2025
Copy link
Member

@Marvin-Beckmann Marvin-Beckmann left a comment

Choose a reason for hiding this comment

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

looks good

@jnsiemer jnsiemer merged commit 89d3838 into dev Aug 14, 2025
2 checks passed
@jnsiemer jnsiemer deleted the revise_samplers branch August 14, 2025 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation📖 Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants