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

◆ display()

void newf4::MonomialView::display ( std::ostream & o,
const std::vector< std::string > & varnames,
const newf4::MonomialView & m )
static

Definition at line 115 of file MonomialView.cpp.

119{
120 // Note: if the monomial is '1', nothing is printed.
121 // TODO: possibly allow print_one boolean argument, instead of handling it at calling point?
122 bool first = true;
123 for (auto t = m.begin(); t != m.end(); ++t)
124 {
125 auto v = t.var();
126 auto e = t.power();
127 if (v >= varnames.size() or v < 0)
128 {
129 throw exc::engine_error("variable out of range");
130 }
131 if (not first)
132 {
133 o << '*';
134 }
135 first = false;
136 o << varnames[v];
137 if (e != 1)
138 o << '^' << e;
139 }
140}
auto begin() const -> MonomialIterator< true >
auto end() const -> MonomialIterator< true >

References begin(), and end().

Referenced by BasicPoly::display().