Ticket #1141 (closed enhancement: fixed)
[with patch, with positive review] Number Field elements arithmetic speed
| Reported by: | jbmohler | Owned by: | somebody |
|---|---|---|---|
| Priority: | major | Milestone: | sage-2.8.15 |
| Component: | basic arithmetic | Keywords: | |
| Cc: | Author(s): | ||
| Report Upstream: | Reviewer(s): | ||
| Merged in: | Work issues: |
Description
This patch just makes a few minor adjustments which gain a bit of speed with number field elements. It's barely worth talking about for absolute fields, but its quite nice for relative number fields.
The main work of the patch is to place a pointer to the defining polynomial into the number field element. This possibly introduces more maintenance, but the alternative is to move the number field parent class to cython.
original:
sage: L.<a> = CyclotomicField(3).extension(x^3 - 2) sage: timeit a^6 100 loops, best of 3: 2.89 ms per loop sage: K.<a> = NumberField(x^3-2*x^2+12) sage: timeit a^4 10000 loops, best of 3: 44.3 µs per loop sage: O.<a,b> = EquationOrder([x^2+1, x^2+2]) sage: timeit a*b 1000 loops, best of 3: 770 µs per loop
patched:
sage: L.<a> = CyclotomicField(3).extension(x^3 - 2) sage: timeit a^6 10000 loops, best of 3: 92.7 µs per loop sage: K.<a> = NumberField(x^3-2*x^2+12) sage: timeit a^4 10000 loops, best of 3: 30.6 µs per loop sage: O.<a,b> = EquationOrder([x^2+1, x^2+2]) sage: timeit a*b 100000 loops, best of 3: 19 µs per loop
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

