Merge pull request #975 from borglab/fix/warnings
commit
598c81f38f
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <gtsam/base/types.h>
|
||||||
|
|
||||||
#include <gtsam/discrete/Assignment.h>
|
#include <gtsam/discrete/Assignment.h>
|
||||||
|
|
||||||
#include <boost/function.hpp>
|
#include <boost/function.hpp>
|
||||||
|
|
@ -35,7 +37,7 @@ namespace gtsam {
|
||||||
* Y = function range (any algebra), e.g., bool, int, double
|
* Y = function range (any algebra), e.g., bool, int, double
|
||||||
*/
|
*/
|
||||||
template<typename L, typename Y>
|
template<typename L, typename Y>
|
||||||
class DecisionTree {
|
class GTSAM_EXPORT DecisionTree {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,32 +34,32 @@ namespace gtsam {
|
||||||
using DiscreteKey = std::pair<Key,size_t>;
|
using DiscreteKey = std::pair<Key,size_t>;
|
||||||
|
|
||||||
/// DiscreteKeys is a set of keys that can be assembled using the & operator
|
/// DiscreteKeys is a set of keys that can be assembled using the & operator
|
||||||
struct DiscreteKeys: public std::vector<DiscreteKey> {
|
struct GTSAM_EXPORT DiscreteKeys: public std::vector<DiscreteKey> {
|
||||||
|
|
||||||
// Forward all constructors.
|
// Forward all constructors.
|
||||||
using std::vector<DiscreteKey>::vector;
|
using std::vector<DiscreteKey>::vector;
|
||||||
|
|
||||||
/// Constructor for serialization
|
/// Constructor for serialization
|
||||||
GTSAM_EXPORT DiscreteKeys() : std::vector<DiscreteKey>::vector() {}
|
DiscreteKeys() : std::vector<DiscreteKey>::vector() {}
|
||||||
|
|
||||||
/// Construct from a key
|
/// Construct from a key
|
||||||
GTSAM_EXPORT DiscreteKeys(const DiscreteKey& key) {
|
DiscreteKeys(const DiscreteKey& key) {
|
||||||
push_back(key);
|
push_back(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Construct from a vector of keys
|
/// Construct from a vector of keys
|
||||||
GTSAM_EXPORT DiscreteKeys(const std::vector<DiscreteKey>& keys) :
|
DiscreteKeys(const std::vector<DiscreteKey>& keys) :
|
||||||
std::vector<DiscreteKey>(keys) {
|
std::vector<DiscreteKey>(keys) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Construct from cardinalities with default names
|
/// Construct from cardinalities with default names
|
||||||
GTSAM_EXPORT DiscreteKeys(const std::vector<int>& cs);
|
DiscreteKeys(const std::vector<int>& cs);
|
||||||
|
|
||||||
/// Return a vector of indices
|
/// Return a vector of indices
|
||||||
GTSAM_EXPORT KeyVector indices() const;
|
KeyVector indices() const;
|
||||||
|
|
||||||
/// Return a map from index to cardinality
|
/// Return a map from index to cardinality
|
||||||
GTSAM_EXPORT std::map<Key,size_t> cardinalities() const;
|
std::map<Key,size_t> cardinalities() const;
|
||||||
|
|
||||||
/// Add a key (non-const!)
|
/// Add a key (non-const!)
|
||||||
DiscreteKeys& operator&(const DiscreteKey& key) {
|
DiscreteKeys& operator&(const DiscreteKey& key) {
|
||||||
|
|
@ -69,5 +69,5 @@ namespace gtsam {
|
||||||
}; // DiscreteKeys
|
}; // DiscreteKeys
|
||||||
|
|
||||||
/// Create a list from two keys
|
/// Create a list from two keys
|
||||||
GTSAM_EXPORT DiscreteKeys operator&(const DiscreteKey& key1, const DiscreteKey& key2);
|
DiscreteKeys operator&(const DiscreteKey& key1, const DiscreteKey& key2);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ namespace gtsam {
|
||||||
/**
|
/**
|
||||||
* A class for computing marginals of variables in a DiscreteFactorGraph
|
* A class for computing marginals of variables in a DiscreteFactorGraph
|
||||||
*/
|
*/
|
||||||
class DiscreteMarginals {
|
class GTSAM_EXPORT DiscreteMarginals {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,6 @@ using namespace std;
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
// explicit instantiation
|
|
||||||
template class DecisionTree<Key, double>;
|
|
||||||
template class AlgebraicDecisionTree<Key>;
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
double Potentials::safe_div(const double& a, const double& b) {
|
double Potentials::safe_div(const double& a, const double& b) {
|
||||||
// cout << boost::format("%g / %g = %g\n") % a % b % ((a == 0) ? 0 : (a / b));
|
// cout << boost::format("%g / %g = %g\n") % a % b % ((a == 0) ? 0 : (a / b));
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ namespace gtsam {
|
||||||
/**
|
/**
|
||||||
* A base class for both DiscreteFactor and DiscreteConditional
|
* A base class for both DiscreteFactor and DiscreteConditional
|
||||||
*/
|
*/
|
||||||
class Potentials: public AlgebraicDecisionTree<Key> {
|
class GTSAM_EXPORT Potentials: public AlgebraicDecisionTree<Key> {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ namespace gtsam {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Safe division for probabilities
|
// Safe division for probabilities
|
||||||
GTSAM_EXPORT static double safe_div(const double& a, const double& b);
|
static double safe_div(const double& a, const double& b);
|
||||||
|
|
||||||
// // Apply either a permutation or a reduction
|
// // Apply either a permutation or a reduction
|
||||||
// template<class P>
|
// template<class P>
|
||||||
|
|
@ -55,10 +55,10 @@ namespace gtsam {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Default constructor for I/O */
|
/** Default constructor for I/O */
|
||||||
GTSAM_EXPORT Potentials();
|
Potentials();
|
||||||
|
|
||||||
/** Constructor from Indices and ADT */
|
/** Constructor from Indices and ADT */
|
||||||
GTSAM_EXPORT Potentials(const DiscreteKeys& keys, const ADT& decisionTree);
|
Potentials(const DiscreteKeys& keys, const ADT& decisionTree);
|
||||||
|
|
||||||
/** Constructor from Indices and (string or doubles) */
|
/** Constructor from Indices and (string or doubles) */
|
||||||
template<class SOURCE>
|
template<class SOURCE>
|
||||||
|
|
@ -67,8 +67,8 @@ namespace gtsam {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Testable
|
// Testable
|
||||||
GTSAM_EXPORT bool equals(const Potentials& other, double tol = 1e-9) const;
|
bool equals(const Potentials& other, double tol = 1e-9) const;
|
||||||
GTSAM_EXPORT void print(const std::string& s = "Potentials: ",
|
void print(const std::string& s = "Potentials: ",
|
||||||
const KeyFormatter& formatter = DefaultKeyFormatter) const;
|
const KeyFormatter& formatter = DefaultKeyFormatter) const;
|
||||||
|
|
||||||
size_t cardinality(Key j) const { return cardinalities_.at(j);}
|
size_t cardinality(Key j) const { return cardinalities_.at(j);}
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,6 @@ double dot(const Errors& a, const Errors& b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
template<>
|
|
||||||
void axpy(double alpha, const Errors& x, Errors& y) {
|
void axpy(double alpha, const Errors& x, Errors& y) {
|
||||||
Errors::const_iterator it = x.begin();
|
Errors::const_iterator it = x.begin();
|
||||||
for(Vector& yi: y)
|
for(Vector& yi: y)
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,6 @@ namespace gtsam {
|
||||||
/**
|
/**
|
||||||
* BLAS level 2 style
|
* BLAS level 2 style
|
||||||
*/
|
*/
|
||||||
template <>
|
|
||||||
GTSAM_EXPORT void axpy(double alpha, const Errors& x, Errors& y);
|
GTSAM_EXPORT void axpy(double alpha, const Errors& x, Errors& y);
|
||||||
|
|
||||||
/** print with optional string */
|
/** print with optional string */
|
||||||
|
|
|
||||||
|
|
@ -33,18 +33,18 @@ class TriangulationFactor: public NoiseModelFactor1<Point3> {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// CAMERA type
|
/// CAMERA type
|
||||||
typedef CAMERA Camera;
|
using Camera = CAMERA;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/// shorthand for base class type
|
/// shorthand for base class type
|
||||||
typedef NoiseModelFactor1<Point3> Base;
|
using Base = NoiseModelFactor1<Point3>;
|
||||||
|
|
||||||
/// shorthand for this class
|
/// shorthand for this class
|
||||||
typedef TriangulationFactor<CAMERA> This;
|
using This = TriangulationFactor<CAMERA>;
|
||||||
|
|
||||||
/// shorthand for measurement type, e.g. Point2 or StereoPoint2
|
/// shorthand for measurement type, e.g. Point2 or StereoPoint2
|
||||||
typedef typename CAMERA::Measurement Measurement;
|
using Measurement = typename CAMERA::Measurement;
|
||||||
|
|
||||||
// Keep a copy of measurement and calibration for I/O
|
// Keep a copy of measurement and calibration for I/O
|
||||||
const CAMERA camera_; ///< CAMERA in which this landmark was seen
|
const CAMERA camera_; ///< CAMERA in which this landmark was seen
|
||||||
|
|
@ -55,9 +55,10 @@ protected:
|
||||||
const bool verboseCheirality_; ///< If true, prints text for Cheirality exceptions (default: false)
|
const bool verboseCheirality_; ///< If true, prints text for Cheirality exceptions (default: false)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
|
||||||
|
|
||||||
/// shorthand for a smart pointer to a factor
|
/// shorthand for a smart pointer to a factor
|
||||||
typedef boost::shared_ptr<This> shared_ptr;
|
using shared_ptr = boost::shared_ptr<This>;
|
||||||
|
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
TriangulationFactor() :
|
TriangulationFactor() :
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue