本文整理汇总了C++中Poly::pop_back方法的典型用法代码示例。如果您正苦于以下问题:C++ Poly::pop_back方法的具体用法?C++ Poly::pop_back怎么用?C++ Poly::pop_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Poly
的用法示例。
在下文中一共展示了Poly::pop_back方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: divide
Poly divide(Poly const &a, Poly const &b, Poly &r) {
Poly c;
r = a; // remainder
assert(!b.empty());
const unsigned k = a.degree();
const unsigned l = b.degree();
c.resize(k, 0.);
for(unsigned i = k; i >= l; i--) {
assert(i >= 0);
double ci = r.back()/b.back();
c[i-l] += ci;
Poly bb = ci*b;
//std::cout << ci <<"*(" << b.shifted(i-l) << ") = "
// << bb.shifted(i-l) << " r= " << r << std::endl;
r -= bb.shifted(i-l);
r.pop_back();
}
//std::cout << "r= " << r << std::endl;
r.normalize();
c.normalize();
return c;
}
示例2: reduce
void reduce(Poly &v)
{
while (!v.empty() && v.back() % MOD == 0)
{
v.pop_back();
}
}
示例3: tidy
// Simplify the polynomial, eliminates the high-degree zero term.
void tidy(Poly& c) {
while(c.size() > 1 && fabs(c.back()) < EPS)
c.pop_back();
}
示例4: tidy
// Simplify the polynomial, eliminates the high-degree zero term.
void tidy(Poly& c) {
while(!c.empty() && c.back() == 0)
c.pop_back();
}