error_vectors
parent
bf504d30db
commit
c987ab397c
|
@ -12,8 +12,19 @@
|
|||
#include "GaussianFactorGraph.h"
|
||||
#include "NonlinearFactorGraph.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
/* ************************************************************************* */
|
||||
template<class Config>
|
||||
Vector NonlinearFactorGraph<Config>::error_vector(const Config& c) const {
|
||||
list<Vector> errors;
|
||||
BOOST_FOREACH(typename NonlinearFactorGraph<Config>::sharedFactor factor, this->factors_)
|
||||
errors.push_back(factor->error_vector(c));
|
||||
return concatVectors(errors);
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
template<class Config>
|
||||
double NonlinearFactorGraph<Config>::error(const Config& c) const {
|
||||
|
@ -21,9 +32,9 @@ namespace gtsam {
|
|||
// iterate over all the factors_ to accumulate the log probabilities
|
||||
BOOST_FOREACH(typename NonlinearFactorGraph<Config>::sharedFactor factor, this->factors_)
|
||||
total_error += factor->error(c);
|
||||
|
||||
return total_error;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
template<class Config>
|
||||
boost::shared_ptr<GaussianFactorGraph> NonlinearFactorGraph<Config>::linearize_(
|
||||
|
|
|
@ -31,6 +31,9 @@ namespace gtsam {
|
|||
/** unnormalized error */
|
||||
double error(const Config& c) const;
|
||||
|
||||
/** all individual errors */
|
||||
Vector error_vector(const Config& c) const;
|
||||
|
||||
/** Unnormalized probability. O(n) */
|
||||
double probPrime(const Config& c) const {
|
||||
return exp(-0.5 * error(c));
|
||||
|
@ -41,10 +44,11 @@ namespace gtsam {
|
|||
*/
|
||||
GaussianFactorGraph linearize(const Config& config) const;
|
||||
|
||||
/**
|
||||
* shared pointer versions for MATLAB
|
||||
*/
|
||||
boost::shared_ptr<GaussianFactorGraph> linearize_(const Config& config) const;
|
||||
/**
|
||||
* shared pointer versions for MATLAB
|
||||
*/
|
||||
boost::shared_ptr<GaussianFactorGraph>
|
||||
linearize_(const Config& config) const;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue