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

◆ simple_degree()

template<class E, bool OC>
Exponent ExponentVector< E, OC >::simple_degree ( int nvars,
ConstExponents a )
inlinestatic

Definition at line 220 of file ExponentVector.hpp.

221 {
222 // TODO: use std::accumulate?
223 if (nvars == 0) return 0;
224 Exponent sum = a[0];
225 if constexpr (OC)
226 for (int i = 1; i < nvars; i++)
227 sum = safe::add(sum, a[i], "degree overflow");
228 else
229 for (int i = 1; i < nvars; i++) sum += a[i];
230 return sum;
231 }