Skip to content
Snippets Groups Projects
Commit ade802ff authored by Uli Sack's avatar Uli Sack Committed by usack
Browse files

make positivity tolerance variable, to be set in constructor

[[Imported from SVN: r6271]]
parent 800b6a1b
No related branches found
No related tags found
No related merge requests found
......@@ -28,14 +28,14 @@
/** \brief The type used for the result */
typedef typename DiscFuncType::field_type field_type;
EnergyNorm() : iterationStep_(NULL), matrix_(NULL) {}
EnergyNorm(const double tol=1e-10 ) : iterationStep_(NULL), matrix_(NULL), tol_(tol) {}
EnergyNorm(LinearIterationStep<OperatorType, DiscFuncType>& it)
: iterationStep_(&it), matrix_(NULL)
EnergyNorm(LinearIterationStep<OperatorType, DiscFuncType>& it, const double tol=1e-10)
: iterationStep_(&it), matrix_(NULL), tol_(tol)
{}
EnergyNorm(const OperatorType& matrix)
: iterationStep_(NULL), matrix_(&matrix)
EnergyNorm(const OperatorType& matrix, const double tol=1e-10)
: iterationStep_(NULL), matrix_(&matrix), tol_(tol)
{}
void setMatrix(const OperatorType* matrix) {
......@@ -81,7 +81,7 @@
if (ret < 0)
{
if (ret < -1e-13)
if (ret < -tol_)
{
char msg[1024];
sprintf(msg, "Supplied linear operator is not positive (semi-)definite: (u,Au) = %e", ret);
......@@ -96,7 +96,8 @@
/** \brief Compute the squared norm for a given vector and matrix
\todo This could be implemented without the temporary. */
static field_type normSquared(const DiscFuncType& u,
const OperatorType& A)
const OperatorType& A,
const double tol=1e-10)
{
DiscFuncType tmp(u.size());
tmp = 0;
......@@ -106,7 +107,7 @@
if (ret < 0)
{
if (ret < -1e-13)
if (ret < -tol)
{
char msg[1024];
sprintf(msg, "Supplied linear operator is not positive (semi-)definite: (u,Au) = %e", ret);
......@@ -125,6 +126,8 @@
const OperatorType* matrix_;
const double tol_;
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment