Skip to content
Snippets Groups Projects

CholmodSolver: Add error code member

2 files
+ 24
1
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -93,7 +93,12 @@ public:
{
// the apply() method doesn't like constant values
auto mutableRhs = *rhs_;
// setMatrix will decompose the matrix
solver.setMatrix(*matrix_);
// get the error code from Cholmod in case something happened
errorCode_ = solver.cholmodCommonObject().status;
solver.apply(*x_, mutableRhs, statistics);
}
else
@@ -102,6 +107,8 @@ public:
// The setMatrix method stores only the selected entries of the matrix (determined by the ignore field)
solver.setMatrix(*matrix_,&ignore);
// get the error code from Cholmod in case something happened
errorCode_ = solver.cholmodCommonObject().status;
auto modifiedRhs = *rhs_;
@@ -149,6 +156,19 @@ public:
}
}
/** \brief return the error code of the Cholmod factorize call
*
* In setMatrix() the matrix factorization takes place and Cholmod is
* able to communicate error codes of the factorization in the status
* field of the cholmodCommonObject.
* The return value 0 means "good" and the other values can be found
* in the Cholmod User Guide.
*/
int errorCode() const
{
return errorCode_;
}
//! Pointer to the system matrix
const MatrixType* matrix_;
@@ -157,6 +177,9 @@ public:
//! Pointer to the right hand side
const VectorType* rhs_;
//! error code of Cholmod factorize call
int errorCode_ = 0;
};
} // namespace Solvers
Loading