- galois.printoptions(**kwargs) Generator[None, None, None]
A context manager to temporarily modify the print options for the package. This function is the
galois
equivalent ofnumpy.printoptions()
.See
set_printoptions()
for the full list of available options.- Returns¶
A context manager for use in a
with
statement. The print options are only modified inside thewith
block.
See also
Examples¶
By default, polynomials are displayed with descending degrees.
In [1]: GF = galois.GF(3**5, display="poly") In [2]: a = GF([109, 83]) In [3]: f = galois.Poly([3, 0, 5, 2], field=galois.GF(7))
Modify the print options only inside the context manager.
In [4]: print(a); print(f) [α^4 + α^3 + 1 α^4 + 2] 3x^3 + 5x + 2 In [5]: with galois.printoptions(coeffs="asc"): ...: print(a); print(f) ...: [1 + α^3 + α^4 2 + α^4] 2 + 5x + 3x^3 In [6]: print(a); print(f) [α^4 + α^3 + 1 α^4 + 2] 3x^3 + 5x + 2