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

Avoid redundant computations in finite field .conjugate() method #35643

Merged
merged 1 commit into from
May 28, 2023

Conversation

remyoudompheng
Copy link
Contributor

📚 Description

The previous implementation was factoring the order (characteristic^degree) to obtain the field degree.
The methods cardinality() and order() are really defined as return self.characteristic()**self.degree().

Sage 10rc3

sage: p = next_prime(2**160)
sage: K = GF((p,2))
sage: x = K.random_element()
sage: %timeit x.conjugate()
13.2 ms ± 77.8 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

After patch:

sage: %timeit x.conjugate()
5.01 µs ± 15.5 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)

📝 Checklist

  • The title is concise, informative, and self-explanatory.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

⌛ Dependencies

None

The previous implementation was factoring the order
(characteristic^degree) to obtain the field degree.
@github-actions
Copy link

Documentation preview for this PR is ready! 🎉
Built with commit: 8d09044

Copy link
Member

@yyyyx4 yyyyx4 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, thank you!

@vbraun vbraun merged commit 3b9d676 into sagemath:develop May 28, 2023
@mkoeppe mkoeppe added this to the sage-10.1 milestone May 28, 2023
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.

5 participants