Fixed compile errors on windows
parent
23cd20aa9b
commit
3c33e44c46
|
@ -56,7 +56,7 @@ struct LieMatrix : public Matrix, public DerivedValue<LieMatrix> {
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/** print @param s optional string naming the object */
|
/** print @param s optional string naming the object */
|
||||||
void print(const std::string& name="") const;
|
GTSAM_EXPORT void print(const std::string& name="") const;
|
||||||
|
|
||||||
/** equality up to tolerance */
|
/** equality up to tolerance */
|
||||||
inline bool equals(const LieMatrix& expected, double tol=1e-5) const {
|
inline bool equals(const LieMatrix& expected, double tol=1e-5) const {
|
||||||
|
|
|
@ -38,7 +38,7 @@ class DiscreteBayesTree;
|
||||||
class DiscreteJunctionTree;
|
class DiscreteJunctionTree;
|
||||||
|
|
||||||
/** Main elimination function for DiscreteFactorGraph */
|
/** Main elimination function for DiscreteFactorGraph */
|
||||||
std::pair<boost::shared_ptr<DiscreteConditional>, DecisionTreeFactor::shared_ptr>
|
GTSAM_EXPORT std::pair<boost::shared_ptr<DiscreteConditional>, DecisionTreeFactor::shared_ptr>
|
||||||
EliminateDiscrete(const DiscreteFactorGraph& factors, const Ordering& keys);
|
EliminateDiscrete(const DiscreteFactorGraph& factors, const Ordering& keys);
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
@ -62,7 +62,7 @@ template<> struct EliminationTraits<DiscreteFactorGraph>
|
||||||
* A Discrete Factor Graph is a factor graph where all factors are Discrete, i.e.
|
* A Discrete Factor Graph is a factor graph where all factors are Discrete, i.e.
|
||||||
* Factor == DiscreteFactor
|
* Factor == DiscreteFactor
|
||||||
*/
|
*/
|
||||||
class DiscreteFactorGraph: public FactorGraph<DiscreteFactor>,
|
class GTSAM_EXPORT DiscreteFactorGraph: public FactorGraph<DiscreteFactor>,
|
||||||
public EliminateableFactorGraph<DiscreteFactorGraph> {
|
public EliminateableFactorGraph<DiscreteFactorGraph> {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -120,16 +120,16 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return the set of variables involved in the factors (set union) */
|
/** Return the set of variables involved in the factors (set union) */
|
||||||
GTSAM_EXPORT FastSet<Index> keys() const;
|
FastSet<Index> keys() const;
|
||||||
|
|
||||||
/** return product of all factors as a single factor */
|
/** return product of all factors as a single factor */
|
||||||
GTSAM_EXPORT DecisionTreeFactor product() const;
|
DecisionTreeFactor product() const;
|
||||||
|
|
||||||
/** Evaluates the factor graph given values, returns the joint probability of the factor graph given specific instantiation of values*/
|
/** Evaluates the factor graph given values, returns the joint probability of the factor graph given specific instantiation of values*/
|
||||||
GTSAM_EXPORT double operator()(const DiscreteFactor::Values & values) const;
|
double operator()(const DiscreteFactor::Values & values) const;
|
||||||
|
|
||||||
/// print
|
/// print
|
||||||
GTSAM_EXPORT void print(const std::string& s = "DiscreteFactorGraph",
|
void print(const std::string& s = "DiscreteFactorGraph",
|
||||||
const IndexFormatter& formatter =DefaultIndexFormatter) const;
|
const IndexFormatter& formatter =DefaultIndexFormatter) const;
|
||||||
|
|
||||||
/** Solve the factor graph by performing variable elimination in COLAMD order using
|
/** Solve the factor graph by performing variable elimination in COLAMD order using
|
||||||
|
|
|
@ -62,7 +62,7 @@ TEST( GaussianBayesNet, optimize )
|
||||||
{
|
{
|
||||||
VectorValues actual = smallBayesNet.optimize();
|
VectorValues actual = smallBayesNet.optimize();
|
||||||
|
|
||||||
VectorValues expected = map_list_of
|
VectorValues expected = map_list_of<Key, Vector>
|
||||||
(_x_, (Vec(1) << 4.0))
|
(_x_, (Vec(1) << 4.0))
|
||||||
(_y_, (Vec(1) << 5.0));
|
(_y_, (Vec(1) << 5.0));
|
||||||
|
|
||||||
|
@ -77,12 +77,12 @@ TEST( GaussianBayesNet, optimize3 )
|
||||||
// 5 1 5
|
// 5 1 5
|
||||||
// NOTE: we are supplying a new RHS here
|
// NOTE: we are supplying a new RHS here
|
||||||
|
|
||||||
VectorValues expected = map_list_of
|
VectorValues expected = map_list_of<Key, Vector>
|
||||||
(_x_, (Vec(1) << -1.0))
|
(_x_, (Vec(1) << -1.0))
|
||||||
(_y_, (Vec(1) << 5.0));
|
(_y_, (Vec(1) << 5.0));
|
||||||
|
|
||||||
// Test different RHS version
|
// Test different RHS version
|
||||||
VectorValues gx = map_list_of
|
VectorValues gx = map_list_of<Key, Vector>
|
||||||
(_x_, (Vec(1) << 4.0))
|
(_x_, (Vec(1) << 4.0))
|
||||||
(_y_, (Vec(1) << 5.0));
|
(_y_, (Vec(1) << 5.0));
|
||||||
VectorValues actual = smallBayesNet.backSubstitute(gx);
|
VectorValues actual = smallBayesNet.backSubstitute(gx);
|
||||||
|
@ -96,10 +96,10 @@ TEST( GaussianBayesNet, backSubstituteTranspose )
|
||||||
// 2 = 1 2
|
// 2 = 1 2
|
||||||
// 5 1 1 3
|
// 5 1 1 3
|
||||||
VectorValues
|
VectorValues
|
||||||
x = map_list_of
|
x = map_list_of<Key, Vector>
|
||||||
(_x_, (Vec(1) << 2.0))
|
(_x_, (Vec(1) << 2.0))
|
||||||
(_y_, (Vec(1) << 5.0)),
|
(_y_, (Vec(1) << 5.0)),
|
||||||
expected = map_list_of
|
expected = map_list_of<Key, Vector>
|
||||||
(_x_, (Vec(1) << 2.0))
|
(_x_, (Vec(1) << 2.0))
|
||||||
(_y_, (Vec(1) << 3.0));
|
(_y_, (Vec(1) << 3.0));
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ TEST( GaussianBayesTree, eliminate )
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
TEST( GaussianBayesTree, optimizeMultiFrontal )
|
TEST( GaussianBayesTree, optimizeMultiFrontal )
|
||||||
{
|
{
|
||||||
VectorValues expected = pair_list_of
|
VectorValues expected = pair_list_of<Key, Vector>
|
||||||
(x1, (Vec(1) << 0.))
|
(x1, (Vec(1) << 0.))
|
||||||
(x2, (Vec(1) << 1.))
|
(x2, (Vec(1) << 1.))
|
||||||
(x3, (Vec(1) << 0.))
|
(x3, (Vec(1) << 0.))
|
||||||
|
@ -263,7 +263,7 @@ TEST(GaussianBayesTree, ComputeSteepestDescentPointBT) {
|
||||||
Vector expected = gradient * step;
|
Vector expected = gradient * step;
|
||||||
|
|
||||||
// Known steepest descent point from Bayes' net version
|
// Known steepest descent point from Bayes' net version
|
||||||
VectorValues expectedFromBN = pair_list_of
|
VectorValues expectedFromBN = pair_list_of<Key, Vector>
|
||||||
(0, (Vec(2) << 0.000129034, 0.000688183))
|
(0, (Vec(2) << 0.000129034, 0.000688183))
|
||||||
(1, (Vec(2) << 0.0109679, 0.0253767))
|
(1, (Vec(2) << 0.0109679, 0.0253767))
|
||||||
(2, (Vec(2) << 0.0680441, 0.114496))
|
(2, (Vec(2) << 0.0680441, 0.114496))
|
||||||
|
|
|
@ -183,7 +183,7 @@ TEST( GaussianConditional, solve_simple )
|
||||||
VectorValues actual = map_list_of
|
VectorValues actual = map_list_of
|
||||||
(2, sx1); // parent
|
(2, sx1); // parent
|
||||||
|
|
||||||
VectorValues expected = map_list_of
|
VectorValues expected = map_list_of<Key, Vector>
|
||||||
(2, sx1)
|
(2, sx1)
|
||||||
(1, (Vec(4) << -3.1,-3.4,-11.9,-13.2));
|
(1, (Vec(4) << -3.1,-3.4,-11.9,-13.2));
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ TEST( GaussianConditional, solve_multifrontal )
|
||||||
VectorValues actual = map_list_of
|
VectorValues actual = map_list_of
|
||||||
(10, sl1); // parent
|
(10, sl1); // parent
|
||||||
|
|
||||||
VectorValues expected = map_list_of
|
VectorValues expected = map_list_of<Key, Vector>
|
||||||
(1, (Vector)(Vec(2) << -3.1,-3.4))
|
(1, (Vector)(Vec(2) << -3.1,-3.4))
|
||||||
(2, (Vector)(Vec(2) << -11.9,-13.2))
|
(2, (Vector)(Vec(2) << -11.9,-13.2))
|
||||||
(10, sl1);
|
(10, sl1);
|
||||||
|
@ -257,10 +257,10 @@ TEST( GaussianConditional, solveTranspose ) {
|
||||||
// 5 1 1 3
|
// 5 1 1 3
|
||||||
|
|
||||||
VectorValues
|
VectorValues
|
||||||
x = map_list_of
|
x = map_list_of<Key, Vector>
|
||||||
(1, (Vec(1) << 2.))
|
(1, (Vec(1) << 2.))
|
||||||
(2, (Vec(1) << 5.)),
|
(2, (Vec(1) << 5.)),
|
||||||
y = map_list_of
|
y = map_list_of<Key, Vector>
|
||||||
(1, (Vec(1) << 2.))
|
(1, (Vec(1) << 2.))
|
||||||
(2, (Vec(1) << 3.));
|
(2, (Vec(1) << 3.));
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ TEST(HessianFactor, ConversionConstructor)
|
||||||
|
|
||||||
HessianFactor actual(jacobian);
|
HessianFactor actual(jacobian);
|
||||||
|
|
||||||
VectorValues values = pair_list_of
|
VectorValues values = pair_list_of<Key, Vector>
|
||||||
(0, (Vec(2) << 1.0, 2.0))
|
(0, (Vec(2) << 1.0, 2.0))
|
||||||
(1, (Vec(4) << 3.0, 4.0, 5.0, 6.0));
|
(1, (Vec(4) << 3.0, 4.0, 5.0, 6.0));
|
||||||
|
|
||||||
|
@ -89,7 +89,6 @@ TEST(HessianFactor, Constructor1)
|
||||||
Matrix G = Matrix_(2,2, 3.0, 5.0, 0.0, 6.0);
|
Matrix G = Matrix_(2,2, 3.0, 5.0, 0.0, 6.0);
|
||||||
Vector g = (Vec(2) << -8.0, -9.0);
|
Vector g = (Vec(2) << -8.0, -9.0);
|
||||||
double f = 10.0;
|
double f = 10.0;
|
||||||
|
|
||||||
HessianFactor factor(0, G, g, f);
|
HessianFactor factor(0, G, g, f);
|
||||||
|
|
||||||
// extract underlying parts
|
// extract underlying parts
|
||||||
|
@ -98,7 +97,7 @@ TEST(HessianFactor, Constructor1)
|
||||||
EXPECT(assert_equal(g, Vector(factor.linearTerm())));
|
EXPECT(assert_equal(g, Vector(factor.linearTerm())));
|
||||||
EXPECT_LONGS_EQUAL(1, (long)factor.size());
|
EXPECT_LONGS_EQUAL(1, (long)factor.size());
|
||||||
|
|
||||||
VectorValues dx = pair_list_of(0, (Vec(2) << 1.5, 2.5));
|
VectorValues dx = pair_list_of<Key, Vector>(0, (Vec(2) << 1.5, 2.5));
|
||||||
|
|
||||||
// error 0.5*(f - 2*x'*g + x'*G*x)
|
// error 0.5*(f - 2*x'*g + x'*G*x)
|
||||||
double expected = 80.375;
|
double expected = 80.375;
|
||||||
|
@ -162,7 +161,7 @@ TEST(HessianFactor, Constructor2)
|
||||||
EXPECT(assert_equal(G22, factor.info(factor.begin()+1, factor.begin()+1)));
|
EXPECT(assert_equal(G22, factor.info(factor.begin()+1, factor.begin()+1)));
|
||||||
|
|
||||||
// Check case when vector values is larger than factor
|
// Check case when vector values is larger than factor
|
||||||
VectorValues dxLarge = pair_list_of
|
VectorValues dxLarge = pair_list_of<Key, Vector>
|
||||||
(0, dx0)
|
(0, dx0)
|
||||||
(1, dx1)
|
(1, dx1)
|
||||||
(2, (Vec(2) << 0.1, 0.2));
|
(2, (Vec(2) << 0.1, 0.2));
|
||||||
|
|
|
@ -170,7 +170,7 @@ TEST(Values, expmap_a)
|
||||||
config0.insert(key1, LieVector(3, 1.0, 2.0, 3.0));
|
config0.insert(key1, LieVector(3, 1.0, 2.0, 3.0));
|
||||||
config0.insert(key2, LieVector(3, 5.0, 6.0, 7.0));
|
config0.insert(key2, LieVector(3, 5.0, 6.0, 7.0));
|
||||||
|
|
||||||
VectorValues increment = pair_list_of
|
VectorValues increment = pair_list_of<Key, Vector>
|
||||||
(key1, (Vec(3) << 1.0, 1.1, 1.2))
|
(key1, (Vec(3) << 1.0, 1.1, 1.2))
|
||||||
(key2, (Vec(3) << 1.3, 1.4, 1.5));
|
(key2, (Vec(3) << 1.3, 1.4, 1.5));
|
||||||
|
|
||||||
|
@ -188,8 +188,8 @@ TEST(Values, expmap_b)
|
||||||
config0.insert(key1, LieVector(3, 1.0, 2.0, 3.0));
|
config0.insert(key1, LieVector(3, 1.0, 2.0, 3.0));
|
||||||
config0.insert(key2, LieVector(3, 5.0, 6.0, 7.0));
|
config0.insert(key2, LieVector(3, 5.0, 6.0, 7.0));
|
||||||
|
|
||||||
VectorValues increment = pair_list_of
|
VectorValues increment = pair_list_of<Key, Vector>
|
||||||
(key2, LieVector(3, 1.3, 1.4, 1.5));
|
(key2, (Vec(3) << 1.3, 1.4, 1.5));
|
||||||
|
|
||||||
Values expected;
|
Values expected;
|
||||||
expected.insert(key1, LieVector(3, 1.0, 2.0, 3.0));
|
expected.insert(key1, LieVector(3, 1.0, 2.0, 3.0));
|
||||||
|
@ -241,7 +241,7 @@ TEST(Values, localCoordinates)
|
||||||
valuesA.insert(key1, LieVector(3, 1.0, 2.0, 3.0));
|
valuesA.insert(key1, LieVector(3, 1.0, 2.0, 3.0));
|
||||||
valuesA.insert(key2, LieVector(3, 5.0, 6.0, 7.0));
|
valuesA.insert(key2, LieVector(3, 5.0, 6.0, 7.0));
|
||||||
|
|
||||||
VectorValues expDelta = pair_list_of
|
VectorValues expDelta = pair_list_of<Key, Vector>
|
||||||
(key1, (Vec(3) << 0.1, 0.2, 0.3))
|
(key1, (Vec(3) << 0.1, 0.2, 0.3))
|
||||||
(key2, (Vec(3) << 0.4, 0.5, 0.6));
|
(key2, (Vec(3) << 0.4, 0.5, 0.6));
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ Point3 triangulateDLT(const std::vector<Pose3>& poses,
|
||||||
* @return Returns a Point3 on success, boost::none otherwise.
|
* @return Returns a Point3 on success, boost::none otherwise.
|
||||||
*/
|
*/
|
||||||
template<class CALIBRATION>
|
template<class CALIBRATION>
|
||||||
GTSAM_UNSTABLE_EXPORT Point3 triangulatePoint3(const std::vector<Pose3>& poses,
|
Point3 triangulatePoint3(const std::vector<Pose3>& poses,
|
||||||
const std::vector<Point2>& measurements, const CALIBRATION& K,
|
const std::vector<Point2>& measurements, const CALIBRATION& K,
|
||||||
double rank_tol = 1e-9, bool optimize = false) {
|
double rank_tol = 1e-9, bool optimize = false) {
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ Values createValues() {
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
VectorValues createVectorValues() {
|
VectorValues createVectorValues() {
|
||||||
using namespace impl;
|
using namespace impl;
|
||||||
VectorValues c = boost::assign::pair_list_of
|
VectorValues c = boost::assign::pair_list_of<Key, Vector>
|
||||||
(_l1_, (Vec(2) << 0.0, -1.0))
|
(_l1_, (Vec(2) << 0.0, -1.0))
|
||||||
(_x1_, (Vec(2) << 0.0, 0.0))
|
(_x1_, (Vec(2) << 0.0, 0.0))
|
||||||
(_x2_, (Vec(2) << 1.5, 0.0));
|
(_x2_, (Vec(2) << 1.5, 0.0));
|
||||||
|
@ -483,7 +483,7 @@ GaussianFactorGraph createSingleConstraintGraph() {
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
VectorValues createSingleConstraintValues() {
|
VectorValues createSingleConstraintValues() {
|
||||||
using namespace impl;
|
using namespace impl;
|
||||||
VectorValues config = boost::assign::pair_list_of
|
VectorValues config = boost::assign::pair_list_of<Key, Vector>
|
||||||
(_x_, (Vec(2) << 1.0, -1.0))
|
(_x_, (Vec(2) << 1.0, -1.0))
|
||||||
(_y_, (Vec(2) << 0.2, 0.1));
|
(_y_, (Vec(2) << 0.2, 0.1));
|
||||||
return config;
|
return config;
|
||||||
|
@ -547,7 +547,7 @@ GaussianFactorGraph createMultiConstraintGraph() {
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
VectorValues createMultiConstraintValues() {
|
VectorValues createMultiConstraintValues() {
|
||||||
using namespace impl;
|
using namespace impl;
|
||||||
VectorValues config = boost::assign::pair_list_of
|
VectorValues config = boost::assign::pair_list_of<Key, Vector>
|
||||||
(_x_, (Vec(2) << -2.0, 2.0))
|
(_x_, (Vec(2) << -2.0, 2.0))
|
||||||
(_y_, (Vec(2) << -0.1, 0.4))
|
(_y_, (Vec(2) << -0.1, 0.4))
|
||||||
(_z_, (Vec(2) <<-4.0, 5.0));
|
(_z_, (Vec(2) <<-4.0, 5.0));
|
||||||
|
|
Loading…
Reference in New Issue