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

◆ lift()

bool GF::lift ( const Ring * R,
const ring_elem f,
ring_elem & result ) const
virtual

Implements Ring.

Definition at line 279 of file GF.cpp.

280{
281 // Rg = Z/p[x]/F(x) ---> GF(p,n)
282 // promotion: need to be able to know the value of 'x'.
283 // lift: need to compute (primite_element)^e
284
285 if (Rg != _originalR) return false;
286
287 int e = f.get_int();
288 if (e == _ZERO)
289 result = _originalR->from_long(0);
290 else if (e == _ONE)
291 result = _originalR->from_long(1);
292 else
293 result = _originalR->power(_primitive_element->get_value(), e);
294
295 return true;
296}
const RingElement * _primitive_element
Definition GF.hpp:66
const PolynomialRing * _originalR
Definition GF.hpp:64
int _ONE
Definition GF.hpp:73
int _ZERO
Definition GF.hpp:72
VALGRIND_MAKE_MEM_DEFINED & result(result)
int get_int() const
Definition ringelem.hpp:124

References _ONE, _originalR, _primitive_element, _ZERO, ring_elem::get_int(), result(), and Ring::Ring().