Skip to content
Snippets Groups Projects
Commit 62e628c8 authored by Oliver Sander's avatar Oliver Sander Committed by sander@PCPOOL.MI.FU-BERLIN.DE
Browse files

minor fixes concerning trust-region with matrix-induced norms

[[Imported from SVN: r2427]]
parent 64bdca2d
No related branches found
No related tags found
No related merge requests found
......@@ -69,7 +69,7 @@ void TruncatedCGSolver<MatrixType, VectorType>::solve()
*x_ = eta; // return eta
std::cout << "Abort1, radius = " << std::sqrt((*x_)*(*x_)) << std::endl;
std::cout << "Abort1, radius = " << std::sqrt(trustRegionScalarProduct(*x_,*x_)) << std::endl;
if (this->historyBuffer_!="")
this->writeIterate(*x_, i);
......@@ -92,7 +92,7 @@ void TruncatedCGSolver<MatrixType, VectorType>::solve()
*x_ = eta_j; // return eta + tau*delta_j
x_->axpy(tau, delta_j);
std::cout << "Abort2, radius = " << std::sqrt((*x_)*(*x_)) << std::endl;
std::cout << "Abort2, radius = " << std::sqrt(trustRegionScalarProduct(*x_,*x_)) << std::endl;
if (this->historyBuffer_!="")
this->writeIterate(*x_, i);
......@@ -113,7 +113,7 @@ void TruncatedCGSolver<MatrixType, VectorType>::solve()
*x_ = eta_jPlus1;
eta_j = eta_jPlus1;
std::cout << "Radius = " << sqrt((*x_)*(*x_)) << std::endl;
std::cout << "Radius = " << sqrt(trustRegionScalarProduct(*x_,*x_)) << std::endl;
// /////////////////////////////////////////////
// write iteration to file, if requested
......
......@@ -28,6 +28,8 @@ class TruncatedCGSolver : public IterativeSolver<VectorType>
// There must be one positive and one negative root
assert(root1*root2 <= 0);
std::cout << "root1: " << root1 << ", root2: " << root2 << std::endl;
return std::max(root1, root2);
}
......@@ -71,13 +73,14 @@ public:
TruncatedCGSolver(int maxIterations,
double tolerance,
Norm<VectorType>* errorNorm,
const MatrixType* trustRegionNormMatrix,
NumProc::VerbosityMode verbosity,
bool useRelativeError=true)
: IterativeSolver<VectorType>(tolerance,maxIterations,verbosity,useRelativeError),
matrix_(NULL), x_(NULL), rhs_(NULL),
errorNorm_(errorNorm),
trustRegionRadius_(0),
trustRegionNormMatrix_(NULL)
trustRegionNormMatrix_(trustRegionNormMatrix)
{}
void setProblem(const MatrixType& matrix,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment