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

gcdCoefficents improvements #3597

Open
wants to merge 5 commits into
base: development
Choose a base branch
from

Conversation

d-torrance
Copy link
Member

A few related changes:

  • GMP has a built-in extended GCD function, so we use it instead of the current one that's implemented at top-level, improving performance:

    Before

    i1 : elapsedTime gcdCoefficients(46, 240)
     -- .000109342s elapsed
    
    o1 = {2, 47, -9}
    
    o1 : List

    After

    i1 : elapsedTime gcdCoefficients(46, 240)
     -- .00001076s elapsed
    
    o1 = {2, 47, -9}
    
    o1 : List
  • gcdCoefficients(ZZ, RingElement) and gcdCoefficients(RingElement, ZZ) have now been defined, promoting the integer to appropriate ring just like gcd.

  • The documentation has been updated (converting to SimpleDoc, adding the new methods, and adding some examples).

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the name of French mathematician Bézout needs to appear in this doc :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good! Updated

@d-torrance
Copy link
Member Author

I feel like this method should return a sequence instead of a list so that the caller can use parallel assignment, but I'm hesitant to make a breaking change.

@pzinn
Copy link
Contributor

pzinn commented Feb 23, 2025

it's only used 3 times in packages, AFAICT, so it's worth a shot.

Slight breaking change.  But this gives us the advantage of using
parallel assignment on the output.
@d-torrance d-torrance requested a review from pzinn February 23, 2025 01:37
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.

2 participants