Skip to content

Commit

Permalink
Make "poly" display mode more efficient for prime fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mhostetter committed Mar 2, 2022
1 parent 3a0c668 commit 7ffd551
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion galois/_fields/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,13 @@ def arithmetic_table(
###############################################################################

def _formatter(cls, array):
"""
Returns a NumPy printoptions "formatter" dictionary.
"""
# pylint: disable=attribute-defined-outside-init
formatter = {}
if cls.display_mode == "poly":

if cls.display_mode == "poly" and cls.is_extension_field:
formatter["int"] = cls._print_poly
formatter["object"] = cls._print_poly
elif cls.display_mode == "power":
Expand All @@ -454,6 +458,7 @@ def _formatter(cls, array):
formatter["object"] = cls._print_power
elif array.dtype == np.object_:
formatter["object"] = cls._print_int

return formatter

def _print_int(cls, element): # pylint: disable=no-self-use
Expand Down

0 comments on commit 7ffd551

Please sign in to comment.