be a bit more verbose
parent
3e2924a5bf
commit
2f72d585c5
|
@ -115,14 +115,16 @@ namespace gtsam {
|
||||||
V conjugateGradients(const S& Ab, V x, bool verbose, double epsilon,
|
V conjugateGradients(const S& Ab, V x, bool verbose, double epsilon,
|
||||||
double epsilon_abs, size_t maxIterations, bool steepest = false) {
|
double epsilon_abs, size_t maxIterations, bool steepest = false) {
|
||||||
|
|
||||||
CGState<S, V, E> state(Ab, x, verbose, epsilon, epsilon_abs, maxIterations,
|
CGState<S, V, E> state(Ab, x, verbose, epsilon, epsilon_abs, maxIterations,steepest);
|
||||||
steepest);
|
|
||||||
if (state.gamma < state.threshold) return x;
|
|
||||||
|
|
||||||
if (verbose) cout << "CG: epsilon = " << epsilon << ", maxIterations = "
|
if (verbose) cout << "CG: epsilon = " << epsilon << ", maxIterations = "
|
||||||
<< state.maxIterations << ", ||g0||^2 = " << state.gamma
|
<< state.maxIterations << ", ||g0||^2 = " << state.gamma
|
||||||
<< ", threshold = " << state.threshold << endl;
|
<< ", threshold = " << state.threshold << endl;
|
||||||
|
|
||||||
|
if (state.gamma < state.threshold) {
|
||||||
|
if (verbose) cout << "||g0||^2 < threshold, exiting immediately !" << endl;
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
// loop maxIterations times
|
// loop maxIterations times
|
||||||
while (!state.step(Ab, x))
|
while (!state.step(Ab, x))
|
||||||
;
|
;
|
||||||
|
|
Loading…
Reference in New Issue