当前位置: 首页>>代码示例>>C++>>正文


C++ Poly::searchIncludeDimMonoPoly方法代码示例

本文整理汇总了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;
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例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;
    }
}
开发者ID:,项目名称:,代码行数:63,代码来源:


注:本文中的Poly::searchIncludeDimMonoPoly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。