gradientDescent_ and conjugateGradientDescent_ works in matlab

release/4.3a0
Viorela Ila 2009-12-13 03:02:14 +00:00
parent ca34a6ef65
commit d5d70d7751
3 changed files with 24 additions and 1 deletions

View File

@ -292,3 +292,17 @@ VectorConfig GaussianFactorGraph::conjugateGradientDescent(
} }
/* ************************************************************************* */ /* ************************************************************************* */
/* ************************************************************************* */
boost::shared_ptr<VectorConfig>
GaussianFactorGraph::gradientDescent_(const VectorConfig& x0) const {
return boost::shared_ptr<VectorConfig>(new VectorConfig(gradientDescent(x0)));
}
/* ************************************************************************* */
boost::shared_ptr<VectorConfig>
GaussianFactorGraph::conjugateGradientDescent_(const VectorConfig& x0) const {
return boost::shared_ptr<VectorConfig>(new VectorConfig(conjugateGradientDescent(x0)));
}
/* ************************************************************************* */

View File

@ -187,13 +187,20 @@ namespace gtsam {
* @return solution * @return solution
*/ */
VectorConfig gradientDescent(const VectorConfig& x0) const; VectorConfig gradientDescent(const VectorConfig& x0) const;
/**
* shared pointer versions for MATLAB
*/
boost::shared_ptr<VectorConfig>gradientDescent_(const VectorConfig& x0) const;
/** /**
* Find solution using conjugate gradient descent * Find solution using conjugate gradient descent
* @param x0: VectorConfig specifying initial estimate * @param x0: VectorConfig specifying initial estimate
* @return solution * @return solution
*/ */
VectorConfig conjugateGradientDescent(const VectorConfig& x0) const; VectorConfig conjugateGradientDescent(const VectorConfig& x0) const;
/**
* shared pointer versions for MATLAB
*/
boost::shared_ptr<VectorConfig> conjugateGradientDescent_(const VectorConfig& x0) const;
}; };
} }

View File

@ -106,6 +106,8 @@ class GaussianFactorGraph {
VectorConfig* optimize_(const Ordering& ordering); VectorConfig* optimize_(const Ordering& ordering);
pair<Matrix,Vector> matrix(const Ordering& ordering) const; pair<Matrix,Vector> matrix(const Ordering& ordering) const;
Matrix sparse(const Ordering& ordering) const; Matrix sparse(const Ordering& ordering) const;
VectorConfig* gradientDescent_(const VectorConfig& x0) const;
VectorConfig* conjugateGradientDescent_(const VectorConfig& x0) const;
}; };
class Point2 { class Point2 {