本文整理汇总了C++中Poly::searchIncludeDimMonoPoly方法的典型用法代码示例。如果您正苦于以下问题:C++ Poly::searchIncludeDimMonoPoly方法的具体用法?C++ Poly::searchIncludeDimMonoPoly怎么用?C++ Poly::searchIncludeDimMonoPoly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Poly
的用法示例。
在下文中一共展示了Poly::searchIncludeDimMonoPoly方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
Poly Poly::operator()(const Poly& obj, string str) const
{
// Copy
Poly f; f = *this;
// get one of the highest term.
MonoPoly h0 = *(obj.getHighestTerm(str));
double h0_coeff = h0.getCoeff();
// calc.
// f - t + (t * h0_coeff / h0) * ((h0 - obj) / h0_coeff)
// where
// t = term including hterm
while (1) {
// search which includes hterm.
int index;
if ((index = f.searchIncludeDimMonoPoly(&h0)) == -1) { // if not break
break;
} else { // if any substitute
MonoPoly t = *(f.getMonoPolyWithIndex(index));
f = (f - t) + (t * h0_coeff / h0) * ((h0 - obj) / h0_coeff);
}
}
f.cleanPoly();
return f;
}
示例2: SingleRun
bool WuMethod::SingleRun(vector <pair <int, string> > varperm, vector <pair <int, Poly> > polyperm)
{
vector <string> wuvar;
vector <Poly> wupoly;
for (int i = 0; i < varperm.size(); i++)
wuvar.push_back(varperm[i].second);
for (int i = 0; i < varperm.size(); i++)
wupoly.push_back(polyperm[i].second);
vector <Poly> tripoly;
for (int i = 0; i < getWuVarNum(); i++) {
tripoly.push_back(wupoly[i]);
for (int j = 0; j < i; j++) {
tripoly[i] = tripoly[i](tripoly[j], wuvar[j]);
// tripoly[i].Print(); cout << "(mod "; tripoly[j].Print(); cout << ") " << wuvar[j] << " #tri" << j << endl;
}
// if there is variable not needed, return false
for (int j = 0; j < i; j++) {
MonoPoly single = MonoPoly(m_pi, wuvar[j], 1, 1.0);
if (tripoly[i].searchIncludeDimMonoPoly(&single) != -1) {
cout << "failed triangulation." << endl;
return false;
}
}
}
// if there is doubled tripoly, return false
for (int i = 0; i < tripoly.size(); i++) {
if (tripoly[i].isZeroPoly()) {
cout << "failed for 0 poly in tripoly." << endl;
return false;
}
}
for (int i = 0; i < tripoly.size(); i++) {
cout << "Tri: ";
tripoly[i].Print();
cout << " = 0" << endl;
}
Poly conc = m_wuconc;
for (int i = 0; i < getWuVarNum(); i++) {
conc = conc(tripoly[i], wuvar[i]);
// if there is variable not needed, return false
for (int j = 0; j < i; j++) {
MonoPoly single = MonoPoly(m_pi, wuvar[j], 1, 1.0);
if (conc.searchIncludeDimMonoPoly(&single) != -1) {
conc.Print(); cout << endl;
cout << "failed for unexpected reminder." << endl;
return false;
}
}
}
if (conc.isZeroPoly()) {
return true;
} else {
cout << "failed for unexpected reminder at the end." << endl;
conc.Print(); cout << endl;
return false;
}
}