本文整理汇总了C++中Polynomial::zero方法的典型用法代码示例。如果您正苦于以下问题:C++ Polynomial::zero方法的具体用法?C++ Polynomial::zero怎么用?C++ Polynomial::zero使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polynomial
的用法示例。
在下文中一共展示了Polynomial::zero方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: temp
void Polynomial::operator +=(const Polynomial & p) {
//GBStream << *this << "+=" << p << '\n';
if(!p.zero()) {
if(zero()) {
operator =(p);
} else {
Polynomial temp(*this);
setToZero();
const int sz1 = temp.numberOfTerms();
const int sz2 = p.numberOfTerms();
PolynomialIterator w1 = temp.begin();
PolynomialIterator w2 = p.begin();
int i1=1;
int i2=1;
Term t1 = * w1;
Term t2 = * w2;
while(i1<=sz1 && i2<=sz2) {
int cmp = compareTwoMonomials(t1.MonomialPart(),t2.MonomialPart());
//GBStream << "Add: cmp is " << cmp << '\n';
if(cmp==0) {
t1.Coefficient() += t2.CoefficientPart();
if(!t1.CoefficientPart().zero()) {
//GBStream << "Adding element" << TERM(c,t1.MonomialPart()) << '\n';
addTermToEnd(t1);
}
++w1; ++i1;
++w2; ++i2;
if(i1<=sz1 && i2<=sz2) {
t1 = * w1;
t2 = * w2;
}
} else if(cmp<0) {
//GBStream << "Adding element" << t2 << '\n';
addTermToEnd(t2);
++w2; ++i2;
if(i2<=sz2) t2 = * w2;
} else // if(cmp>0)
{
//GBStream << "Adding element" << t1 << '\n';
addTermToEnd(t1);
++w1; ++i1;
if(i1<=sz1) t1 = * w1;
}
}
for(;i1<=sz1;++i1,++w1) {
//GBStream << "Adding element" << *w1 << '\n';
addTermToEnd(*w1);
}
for(;i2<=sz2;++i2,++w2) {
//GBStream << "Adding element" << *w2 << '\n';
addTermToEnd(*w2);
}
}
}
};
示例2: get
void GrbSource::get(Polynomial& x) {
x.setToZero();
Term t;
char c;
d_so.peekCharacter(c,"\n *");
list<Term> L;
while(c!=';') {
get(t);
L.push_back(t);
d_so.peekCharacter(c,"\n *");
};
x.setWithList(L);
d_so.passCharacter();
if(x.zero()) d_eoi = true;
};
示例3: Lean
void Lean(PolySource & ps,Tag & ps_tag,
Reduction & reduce,Tag * rules_tag,
BroadCast & reportit,bool & foundSomething,
GiveNumber & giveNumber) {
Polynomial p;
Tag * poly_tag_p = 0;
GroebnerRule r;
int num;
while(ps.getNext(p,poly_tag_p,ps_tag)) {
reduce.reduce(p,*rules_tag);
if(!p.zero()) {
num = giveNumber(p);
PolynomialData data(p,num,poly_tag_p,rules_tag);
reportit.broadcast(data);
};
};
};
示例4: doubleProduct
void Polynomial::doubleProduct(const Monomial & x,
const Polynomial & poly,const Monomial & y) {
if(&poly==this) DBG();
setToZero();
if(!poly.zero()) {
Polynomial temp(poly);
Term aterm(x);
aterm *= temp.tip();
aterm.MonomialPart() *= y;
Copy<Term> copyterm(aterm);
temp.Removetip();
PolynomialRep4 * p = new PolynomialRep4(copyterm,x,temp,y);
d_set.insert(p);
#ifdef POLYNOMIAL_USE_LIST
putAllInList();
#endif
};
};
示例5: addPolynomial
// ADDING POLYNOMIAL
// add the polynomial's tip as a path.
// no sophisticated tree manipulations
void addPolynomial(const Polynomial & p) {
if(!p.zero()) (void) addPolynomialPrivate(p);
};