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

Make Q::simplify more viable #412

Merged
merged 6 commits into from
Sep 30, 2024
Merged

Make Q::simplify more viable #412

merged 6 commits into from
Sep 30, 2024

Conversation

jnsiemer
Copy link
Member

Description

The function simplify is capable of more than we thought. This PR makes sure that any developer is aware of the possibility to use it as a trade-off between precision and memory usage.

This PR implements...

  • new constants for Q : Q::MAX62 (as this is the maximum number that we can instantiate as a constant and fmpz), INV_MAX62, INV_MAX32 as constants to use for a fair trade-off reg precision and memory-usage.
  • explanations and an example of how to use simplify with these constants
  • ensurance that the sign does not change using simplify

for Q.

Testing

  • I added basic working examples (possibly in doc-comment)
  • 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 Sep 20, 2024
@jnsiemer jnsiemer added enhancement📈 New feature documentation📖 Improvements or additions to documentation labels Sep 20, 2024
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.

I like the changes, but two more suggestions:

  • also add a constant for 16 and maybe even 8 bits
  • add a test for the simplify that ensures that the denominator is actually at most having that specific number of bits when we have provided it.ideally also for large rationals and such

src/rational/q/rounding.rs Outdated Show resolved Hide resolved
src/rational/q/rounding.rs Show resolved Hide resolved
src/rational/q/default.rs Show resolved Hide resolved
@jnsiemer jnsiemer merged commit 2201543 into dev Sep 30, 2024
2 checks passed
@jnsiemer jnsiemer deleted the viability_simplify_q branch September 30, 2024 07:17
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 enhancement📈 New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants