ESymSolverStatus Ma27TSolverInterface::MultiSolve(bool new_matrix, const Index* airn, const Index* ajcn, Index nrhs, double* rhs_vals, bool check_NegEVals, Index numberOfNegEVals) { DBG_START_METH("Ma27TSolverInterface::MultiSolve",dbg_verbosity); DBG_ASSERT(!check_NegEVals || ProvidesInertia()); DBG_ASSERT(initialized_); DBG_ASSERT(la_!=0); if (pivtol_changed_) { DBG_PRINT((1,"Pivot tolerance has changed.\n")); pivtol_changed_ = false; // If the pivot tolerance has been changed but the matrix is not // new, we have to request the values for the matrix again to do // the factorization again. if (!new_matrix) { DBG_PRINT((1,"Ask caller to call again.\n")); refactorize_ = true; return SYMSOLVER_CALL_AGAIN; } } // check if a factorization has to be done DBG_PRINT((1, "new_matrix = %d\n", new_matrix)); if (new_matrix || refactorize_) { // perform the factorization ESymSolverStatus retval; retval = Factorization(airn, ajcn, check_NegEVals, numberOfNegEVals); if (retval!=SYMSOLVER_SUCCESS) { DBG_PRINT((1, "FACTORIZATION FAILED!\n")); return retval; // Matrix singular or error occurred } refactorize_ = false; } // do the backsolve return Backsolve(nrhs, rhs_vals); }
int main(){ fstream in("input.txt"); std::string num; in >> num; clock_t start = clock(); Factorization comp = Factorization(num.c_str()); BigNumber test(num.c_str()); //инициализируем вектор степеней десятки Ipp32u deg = ceil((test.BitSize() - 1) / log2f(10)); ++deg; BigNumber ten(10); BigNumber tmp(1); for (unsigned i = 0; i <= deg; ++i){ BigNumber::decPowers.push_back(tmp); tmp *= ten; } //std::map<BigNumber, Ipp32u> factor = comp.getFactor(); //cout << "Factorization completed! " << endl<<"time = "<<clock() - start << endl; //for (auto& i : factor){ // cout << i.first; // if (i.second > 1) // cout << "^" << i.second; // cout << endl; //} QuadraticSieve q(test); q.doFactorization(); //cout << q.modPow(BigNumber(3), BigNumber(1024), BigNumber(7)); cout << "Complete " << clock() - start << endl; ofstream out("TS_log.txt"); out << "Complete " << clock() - start << endl; system("pause"); return 0; }