18 namespace free_abelian {
20 template<
typename T,
typename C,
typename Compare>
21 Free_Abelian<T,C,Compare>&
26 std::pair<typename base::iterator,typename base::iterator> range =
28 if (range.first==range.second)
29 this->
insert(range.first,std::make_pair(p,m));
31 if ((range.first->second += m)==C(0))
32 this->erase(range.first);
37 template<
typename T,
typename C,
typename Compare>
57 typename base::iterator last=base::begin();
58 for (
typename base::const_iterator src=p.begin(); src!=p.end(); ++src)
60 last=this->
insert(last,std::make_pair(src->first,C(0)));
61 last->second += m*src->second;
62 if (last->second==C(0))
70 template<
typename T,
typename C,
typename Compare>
79 typename base::base::iterator last=base::begin();
80 for (
typename base::base::const_iterator src=p.begin(); src!=p.end(); ++src)
82 std::pair<T,coef_t> term(src->first,C(0));
84 last=this->
insert(last,term);
85 last->second += m*src->second;
86 if (last->second==C(0))
93 template<
typename T,
typename C,
typename Compare>
98 for (
typename base::base::const_iterator src=p.begin(); src!=p.end(); ++src)
99 result.add_mutiple(*
this,src->second,src->first);
Monoid_Ring & add_multiple(const Monoid_Ring &p, C m, const T &expon)
Definition: free_abelian_def.h:72
uA p
Definition: lists.cpp:26
Free_Abelian & add_term(const T &p, C m)
Definition: free_abelian_def.h:22
Monoid_Ring operator*(const Monoid_Ring &p)
Definition: free_abelian_def.h:95
Free_Abelian & add_multiple(const Free_Abelian &p, C m)
Definition: free_abelian_def.h:39
Definition: free_abelian.h:91