void UMFPackLinearMatrixSolver<double>::solve()
    {
      assert(m != nullptr);
      assert(rhs != nullptr);
      assert(m->get_size() == rhs->get_size());

      this->tick();

      if( !setup_factorization() )
        throw Exceptions::LinearMatrixSolverException("LU factorization could not be completed.");

      if(sln != nullptr)
        delete [] sln;

      sln = new double[m->get_size()];
      memset(sln, 0, m->get_size() * sizeof(double));
      int status = umfpack_real_solve(UMFPACK_A, m->get_Ap(), m->get_Ai(), m->get_Ax(), sln, rhs->v, numeric, nullptr, nullptr);
      if(status != UMFPACK_OK)
      {
        this->free_factorization_data();
        throw Exceptions::LinearMatrixSolverException(check_status("UMFPACK solution", status));
      }

      this->tick();
    }
Beispiel #2
0
    void UMFPackLinearMatrixSolver<double>::solve()
    {
      assert(m != nullptr);
      assert(rhs != nullptr);
      assert(m->get_size() == rhs->get_size());

      this->tick();

      if (!setup_factorization())
        throw Exceptions::LinearMatrixSolverException("LU factorization could not be completed.");

      free_with_check(sln);

      sln = calloc_with_check<UMFPackLinearMatrixSolver<double>, double>(m->get_size(), this);
      int status = umfpack_real_solve(UMFPACK_A, m->get_Ap(), m->get_Ai(), m->get_Ax(), sln, rhs->v, numeric, nullptr, nullptr);
      if (status != UMFPACK_OK)
      {
        this->free_factorization_data();
        throw Exceptions::LinearMatrixSolverException(check_status("UMFPACK solution", status));
      }

      this->tick();
    }