-
-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trac #33748: make accessing coefficients of finite-field elements easier
This comes up rather frequently: {{{#!sage sage: F.<i> = GF(431^2, modulus=x^2+1) sage: a = F.random_element() # some computation sage: coeffs = a.polynomial().padded_list(2) # cumbersome! }}} For number fields, we do have a shorthand: {{{#!sage sage: K.<i> = NumberField(x^2+1) sage: b = K.random_element() # some computation sage: coeffs = b.list() }}} This patch adds a `.__getitem__()` method to the class `FinitePolyExtElement`, which makes `a[i]` and `list(a)` and `tuple(a)` work as expected. For compatibility with number-field elements, we also add `.list()`, which should behave identically to calling `list()` on the element. URL: https://trac.sagemath.org/33748 Reported by: lorenz Ticket author(s): Lorenz Panny Reviewer(s): Travis Scrimshaw
- Loading branch information
Showing
1 changed file
with
131 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters