2009-12-28 17:56:58 +08:00
|
|
|
/*
|
|
|
|
* iterative.cpp
|
|
|
|
* @brief Iterative methods, implementation
|
|
|
|
* @author Frank Dellaert
|
|
|
|
* Created on: Dec 28, 2009
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "GaussianFactorGraph.h"
|
2009-12-29 00:26:16 +08:00
|
|
|
#include "iterative-inl.h"
|
2009-12-28 17:56:58 +08:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
namespace gtsam {
|
|
|
|
|
|
|
|
/* ************************************************************************* */
|
2009-12-29 00:15:26 +08:00
|
|
|
Vector steepestDescent(const System& Ab, const Vector& x, bool verbose,
|
|
|
|
double epsilon, size_t maxIterations) {
|
|
|
|
return conjugateGradients<System, Vector, Vector> (Ab, x, verbose, epsilon,
|
2009-12-28 20:37:34 +08:00
|
|
|
maxIterations, true);
|
|
|
|
}
|
|
|
|
|
2009-12-28 17:56:58 +08:00
|
|
|
Vector conjugateGradientDescent(const System& Ab, const Vector& x,
|
2009-12-29 00:15:26 +08:00
|
|
|
bool verbose, double epsilon, size_t maxIterations) {
|
|
|
|
return conjugateGradients<System, Vector, Vector> (Ab, x, verbose, epsilon,
|
2009-12-28 20:37:34 +08:00
|
|
|
maxIterations);
|
2009-12-28 17:56:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************* */
|
2009-12-28 20:37:34 +08:00
|
|
|
Vector steepestDescent(const Matrix& A, const Vector& b, const Vector& x,
|
2009-12-29 00:15:26 +08:00
|
|
|
bool verbose, double epsilon, size_t maxIterations) {
|
2009-12-29 01:28:48 +08:00
|
|
|
System Ab(A, b);
|
2009-12-29 00:15:26 +08:00
|
|
|
return conjugateGradients<System, Vector, Vector> (Ab, x, verbose, epsilon,
|
2009-12-28 20:37:34 +08:00
|
|
|
maxIterations, true);
|
|
|
|
}
|
|
|
|
|
2009-12-28 17:56:58 +08:00
|
|
|
Vector conjugateGradientDescent(const Matrix& A, const Vector& b,
|
2009-12-29 00:15:26 +08:00
|
|
|
const Vector& x, bool verbose, double epsilon, size_t maxIterations) {
|
2009-12-29 01:28:48 +08:00
|
|
|
System Ab(A, b);
|
2009-12-29 00:15:26 +08:00
|
|
|
return conjugateGradients<System, Vector, Vector> (Ab, x, verbose, epsilon,
|
2009-12-28 20:37:34 +08:00
|
|
|
maxIterations);
|
2009-12-28 17:56:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************************************* */
|
2009-12-28 20:37:34 +08:00
|
|
|
VectorConfig steepestDescent(const GaussianFactorGraph& fg,
|
2009-12-29 00:15:26 +08:00
|
|
|
const VectorConfig& x, bool verbose, double epsilon, size_t maxIterations) {
|
2009-12-28 20:37:34 +08:00
|
|
|
return conjugateGradients<GaussianFactorGraph, VectorConfig, Errors> (fg,
|
2009-12-29 00:15:26 +08:00
|
|
|
x, verbose, epsilon, maxIterations, true);
|
2009-12-28 20:37:34 +08:00
|
|
|
}
|
|
|
|
|
2009-12-28 17:56:58 +08:00
|
|
|
VectorConfig conjugateGradientDescent(const GaussianFactorGraph& fg,
|
2009-12-29 00:15:26 +08:00
|
|
|
const VectorConfig& x, bool verbose, double epsilon, size_t maxIterations) {
|
2009-12-28 20:37:34 +08:00
|
|
|
return conjugateGradients<GaussianFactorGraph, VectorConfig, Errors> (fg,
|
2009-12-29 00:15:26 +08:00
|
|
|
x, verbose, epsilon, maxIterations);
|
2009-12-28 17:56:58 +08:00
|
|
|
}
|
|
|
|
|
2009-12-31 20:55:16 +08:00
|
|
|
/* ************************************************************************* */
|
2009-12-28 17:56:58 +08:00
|
|
|
|
|
|
|
} // namespace gtsam
|