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

◆ operator*() [1/2]

BRP BRP::operator* ( const brMonomial & other) const

Definition at line 80 of file franzi-brp.cpp.

81{
82 BRP tmp;
83 monomials::const_iterator end = m.end();
84 brMonomial last = -1; // set this to -1 so it never is the same as mono, if
85 // we set it to 0, we have problems when multiplying
86 // 1*1
87 for (monomials::const_iterator it = m.begin(); it != end; it++)
88 {
89 brMonomial mono = other | *it;
90 if (last == mono)
91 {
92 tmp.m.pop_back();
93 last = -1;
94 }
95 else
96 {
97 tmp.m.push_back(mono);
98 last = mono;
99 }
100 }
101 tmp.m.sort(funccomp);
102 monomials::iterator it = tmp.m.begin();
103 monomials::iterator lastIt = tmp.m.begin();
104 monomials::iterator tmpEnd = tmp.m.end();
105 it++;
106 while (it != tmpEnd)
107 {
108 if (*lastIt == *it)
109 {
110 lastIt = tmp.m.erase(lastIt, ++it);
111 if (lastIt != end)
112 {
113 ++it;
114 }
115 }
116 else
117 {
118 ++it;
119 ++lastIt;
120 }
121 }
122 return tmp;
123}
monomials m
bool funccomp(const brMonomial &a, const brMonomial &b)
unsigned long brMonomial
TermIterator< Nterm > end(Nterm *)
Definition ringelem.cpp:5

References BRP(), end(), funccomp(), and m.