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

◆ IM2_RingElement_multidegree()

M2_arrayintOrNull IM2_RingElement_multidegree ( const RingElement * a)

Definition at line 439 of file ringelement.cpp.

440{
441 try
442 {
443 if (a->is_zero())
444 {
445 ERROR("the zero element has no degree");
446 return nullptr;
447 }
448
449 auto D = a->get_ring()->degree_monoid();
450 // TODO: do we need to manually free a->degree()?
451 return to_degree_vector(D, a->degree());
452 } catch (const exc::engine_error& e)
453 {
454 ERROR(e.what());
455 return nullptr;
456 }
457}
const Monoid * degree_monoid() const
Definition ring.cpp:13
const_monomial degree() const
Definition relem.hpp:140
bool is_zero() const
Definition relem.hpp:167
const Ring * get_ring() const
Definition relem.hpp:81
M2_arrayint to_degree_vector(const Monoid *M, const_monomial d)
Definition monoid.cpp:46
const int ERROR
Definition m2-mem.cpp:55

References RingElement::degree(), Ring::degree_monoid(), ERROR, RingElement::get_ring(), RingElement::is_zero(), and to_degree_vector().