36 template<
class S,
class V,
class E>
38 const ConjugateGradientParameters ¶meters,
bool steepest =
false);
52 System(
const Matrix& A,
const Vector& b) :
57 const Matrix&
A()
const {
return A_; }
60 const Vector&
b()
const {
return b_; }
70 void print (
const std::string& s =
"System")
const;
74 return A() ^ (A() * x - b());
89 x += alpha * A().transpose() * e;
96 GTSAM_EXPORT Vector steepestDescent(
99 const IterativeOptimizationParameters & parameters);
107 const ConjugateGradientParameters & parameters);
114 GTSAM_EXPORT Vector steepestDescent(
118 const ConjugateGradientParameters & parameters);
127 const ConjugateGradientParameters & parameters);
132 GTSAM_EXPORT VectorValues steepestDescent(
133 const GaussianFactorGraph& fg,
134 const VectorValues& x,
135 const ConjugateGradientParameters & parameters);
141 const GaussianFactorGraph& fg,
142 const VectorValues& x,
143 const ConjugateGradientParameters & parameters);
Vector gradient(const Vector &x) const
gradient of objective function 0.5*|Ax-b_|^2 at x = A_'*(Ax-b_)
Definition: iterative.h:73
void multiplyInPlace(const Vector &x, Vector &e) const
Apply operator A in place.
Definition: iterative.h:83
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:141
V conjugateGradients(const S &Ab, V x, const ConjugateGradientParameters ¶meters, bool steepest)
Method of conjugate gradients (CG) template "System" class S needs gradient(S,v), e=S*v,...
Definition: iterative-inl.h:125
const Matrix & A() const
Access A matrix.
Definition: iterative.h:57
void transposeMultiplyAdd(double alpha, const Vector &e, Vector &x) const
x += alpha* A'*e
Definition: iterative.h:88
Iterative methods, template implementation.
const Vector & b() const
Access b vector.
Definition: iterative.h:60
Implementation of Conjugate Gradient solver for a linear system.
Helper class encapsulating the combined system |Ax-b_|^2 Needed to run Conjugate Gradients on matrice...
Definition: iterative.h:44
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
typedef and functions to augment Eigen's MatrixXd
Point2 operator *(double s, const Point2 &p)
multiply with scalar
Definition: Point2.h:170
Vector conjugateGradientDescent(const System &Ab, const Vector &x, const ConjugateGradientParameters ¶meters)
Method of conjugate gradients (CG), System version.
Definition: iterative.cpp:45
Vector operator^(const Vector &e) const
Apply operator A'*e.
Definition: iterative.h:63