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

◆ elem_text_out()

void SchurRing::elem_text_out ( buffer & o,
const ring_elem f,
bool p_one = true,
bool p_plus = false,
bool p_parens = false ) const
virtual

Reimplemented from PolyRing.

Definition at line 351 of file schur.cpp.

356{
357 exponents_t EXP = ALLOCATE_EXPONENTS(sizeof(int) * (nvars_ + 1));
358 int n = n_terms(f);
359
360 bool needs_parens = p_parens && (n > 1);
361 if (needs_parens)
362 {
363 if (p_plus) o << '+';
364 o << '(';
365 p_plus = false;
366 }
367
368 p_one = false;
369 for (Nterm& t : f)
370 {
371 int isone = M_->is_one(t.monom);
372 p_parens = !isone;
373 K_->elem_text_out(o, t.coeff, p_one, p_plus, p_parens);
374 to_partition(t.monom, EXP);
375 o << "{" << EXP[1];
376 for (int i = 2; i <= nvars_ && EXP[i] != 0; i++) o << "," << EXP[i];
377 o << "}";
378 p_plus = true;
379 }
380 if (needs_parens) o << ')';
381}
exponents::Exponents exponents_t
int n_terms(const ring_elem f) const
Definition polyring.hpp:360
const Ring * K_
Definition polyring.hpp:123
const Monoid * M_
Definition polyring.hpp:124
void to_partition(const int *m, int *exp) const
Definition schur.cpp:120
#define ALLOCATE_EXPONENTS(byte_len)
Definition monoid.hpp:62

References ALLOCATE_EXPONENTS, PolynomialRing::K_, PolynomialRing::M_, PolynomialRing::n_terms(), PolynomialRing::nvars_, and to_partition().