Macaulay2 Engine
Loading...
Searching...
No Matches

◆ checkGaloisFieldInput()

const PolynomialRing * checkGaloisFieldInput ( const RingElement * f)
static

Definition at line 56 of file aring.cpp.

58{
59 // Check that the ring R of f is a polynomial ring in one var over a ZZ/p
60 // Check that f is monic
61 // If any of these fail, then return 0.
63 if (R == nullptr)
64 {
65 ERROR("expected poly ring of the form ZZ/p[x]/(f)");
66 return nullptr;
67 }
68 if (R->n_vars() != 1)
69 {
70 ERROR("expected poly ring of the form ZZ/p[x]/(f)");
71 return nullptr;
72 }
73 if (R->n_quotients() != 1)
74 {
75 ERROR("expected poly ring of the form ZZ/p[x]/(f)");
76 return nullptr;
77 }
78 if (R->characteristic() == 0)
79 {
80 ERROR("expected poly ring of the form ZZ/p[x]/(f)");
81 return nullptr;
82 }
83 return R;
84}
int n_quotients() const
Definition polyring.hpp:219
int n_vars() const
Definition polyring.hpp:196
Abstract base for the engine's polynomial-ring hierarchy.
Definition polyring.hpp:96
virtual const PolynomialRing * cast_to_PolynomialRing() const
Definition ring.hpp:243
long characteristic() const
Definition ring.hpp:159
const Ring * get_ring() const
Definition relem.hpp:81
const int ERROR
Definition m2-mem.cpp:55

References Ring::cast_to_PolynomialRing(), Ring::characteristic(), ERROR, RingElement::get_ring(), PolynomialRing::n_quotients(), and PolynomialRing::n_vars().

Referenced by rawARingGaloisField1(), rawARingGaloisFieldFlintBig(), and rawARingGaloisFieldFlintZech().