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

◆ n_nonzero_terms()

int n_nonzero_terms ( int level,
const TowerPolynomial f )
static

Definition at line 127 of file dpoly.cpp.

128{
129 if (f == nullptr) return 0;
130 int nterms = 0;
131 if (level == 0)
132 {
133 for (int i = 0; i <= f->deg; i++)
134 if (f->arr.ints[i] != 0) nterms++;
135 }
136 else
137 {
138 for (int i = 0; i <= f->deg; i++)
139 if (f->arr.polys[i] != nullptr) nterms++;
140 }
141 return nterms;
142}

Referenced by DPoly::elem_text_out(), and M2::ARingTower::elem_text_out().