From 5be0bf6e284f1a1c5af93519d65f1c3d62cb9d90 Mon Sep 17 00:00:00 2001 From: Alex Cunningham Date: Sat, 9 Oct 2010 03:53:27 +0000 Subject: [PATCH] Changed Value_t conventions to Value, fixed some install script problems --- base/Makefile.am | 2 +- inference/Makefile.am | 2 ++ nonlinear/Key.h | 2 +- nonlinear/LieValues-inl.h | 18 +++++++++--------- nonlinear/LieValues.h | 4 ++-- nonlinear/NonlinearConstraint.h | 28 ++++++++++++++-------------- nonlinear/NonlinearEquality.h | 2 +- nonlinear/NonlinearFactor.h | 12 ++++++------ nonlinear/TupleValues.h | 6 +++--- slam/BetweenConstraint.h | 2 +- slam/BetweenFactor.h | 2 +- slam/BoundingConstraint.h | 6 +++--- slam/LinearApproxFactor.h | 2 +- slam/PriorFactor.h | 2 +- slam/TransformConstraint.h | 4 ++-- slam/simulated2D.h | 8 ++++---- 16 files changed, 52 insertions(+), 50 deletions(-) diff --git a/base/Makefile.am b/base/Makefile.am index 632d6e507..673c8f1e8 100644 --- a/base/Makefile.am +++ b/base/Makefile.am @@ -13,7 +13,7 @@ check_PROGRAMS = # base Math -headers += FixedVector.h +headers += FixedVector.h types.h blockMatrices.h sources += Vector.cpp svdcmp.cpp Matrix.cpp check_PROGRAMS += tests/testFixedVector tests/testVector tests/testMatrix diff --git a/inference/Makefile.am b/inference/Makefile.am index 0e3e9731a..1d4f69669 100644 --- a/inference/Makefile.am +++ b/inference/Makefile.am @@ -26,6 +26,8 @@ check_PROGRAMS += tests/testVariableIndex tests/testVariableSlots headers += inference-inl.h VariableSlots-inl.h sources += inference.cpp VariableSlots.cpp headers += graph.h graph-inl.h +headers += Permutation.h +headers += VariableIndex.h headers += FactorGraph.h FactorGraph-inl.h headers += ClusterTree.h ClusterTree-inl.h headers += JunctionTree.h JunctionTree-inl.h diff --git a/nonlinear/Key.h b/nonlinear/Key.h index 79bf344c7..1741823e1 100644 --- a/nonlinear/Key.h +++ b/nonlinear/Key.h @@ -36,7 +36,7 @@ namespace gtsam { public: // typedefs - typedef T Value_t; + typedef T Value; // Constructors: diff --git a/nonlinear/LieValues-inl.h b/nonlinear/LieValues-inl.h index 3ae4e6710..49c5a8211 100644 --- a/nonlinear/LieValues-inl.h +++ b/nonlinear/LieValues-inl.h @@ -52,7 +52,7 @@ namespace gtsam { /* ************************************************************************* */ template - const typename J::Value_t& LieValues::at(const J& j) const { + const typename J::Value& LieValues::at(const J& j) const { const_iterator it = values_.find(j); if (it == values_.end()) throw std::invalid_argument("invalid j: " + (string)j); else return it->second; @@ -77,7 +77,7 @@ namespace gtsam { /* ************************************************************************* */ template - void LieValues::insert(const J& name, const typename J::Value_t& val) { + void LieValues::insert(const J& name, const typename J::Value& val) { values_.insert(make_pair(name, val)); } @@ -92,14 +92,14 @@ namespace gtsam { template void LieValues::update(const LieValues& cfg) { BOOST_FOREACH(const KeyValuePair& v, values_) { - boost::optional t = cfg.exists_(v.first); + boost::optional t = cfg.exists_(v.first); if (t) values_[v.first] = *t; } } /* ************************************************************************* */ template - void LieValues::update(const J& j, const typename J::Value_t& val) { + void LieValues::update(const J& j, const typename J::Value& val) { values_[j] = val; } @@ -133,10 +133,10 @@ namespace gtsam { template LieValues LieValues::expmap(const VectorValues& delta, const Ordering& ordering) const { LieValues newValues; - typedef pair KeyValue; + typedef pair KeyValue; BOOST_FOREACH(const KeyValue& value, this->values_) { const J& j = value.first; - const typename J::Value_t& pj = value.second; + const typename J::Value& pj = value.second; const Vector& dj = delta[ordering[j]]; newValues.insert(j, pj.expmap(dj)); } @@ -170,10 +170,10 @@ namespace gtsam { // } // LieValues newValues; // int delta_offset = 0; -// typedef pair KeyValue; +// typedef pair KeyValue; // BOOST_FOREACH(const KeyValue& value, this->values_) { // const J& j = value.first; -// const typename J::Value_t& pj = value.second; +// const typename J::Value& pj = value.second; // int cur_dim = pj.dim(); // newValues.insert(j,pj.expmap(sub(delta, delta_offset, delta_offset+cur_dim))); // delta_offset += cur_dim; @@ -194,7 +194,7 @@ namespace gtsam { /* ************************************************************************* */ template void LieValues::logmap(const LieValues& cp, const Ordering& ordering, VectorValues& delta) const { - typedef pair KeyValue; + typedef pair KeyValue; BOOST_FOREACH(const KeyValue& value, cp) { assert(this->exists(value.first)); delta[ordering[value.first]] = this->at(value.first).logmap(value.second); diff --git a/nonlinear/LieValues.h b/nonlinear/LieValues.h index dded5413b..1d097db2b 100644 --- a/nonlinear/LieValues.h +++ b/nonlinear/LieValues.h @@ -34,7 +34,7 @@ namespace gtsam { * * Key concept: * The key will be assumed to be sortable, and must have a - * typedef called "Value_t" with the type of the value the key + * typedef called "Value" with the type of the value the key * labels (example: Pose2, Point2, etc) */ template @@ -46,7 +46,7 @@ namespace gtsam { * Typedefs */ typedef J Key; - typedef typename J::Value_t Value; + typedef typename J::Value Value; typedef std::map, boost::fast_pool_allocator > > KeyValueMap; typedef typename KeyValueMap::value_type KeyValuePair; typedef typename KeyValueMap::iterator iterator; diff --git a/nonlinear/NonlinearConstraint.h b/nonlinear/NonlinearConstraint.h index 5c3a3fec9..5359d048c 100644 --- a/nonlinear/NonlinearConstraint.h +++ b/nonlinear/NonlinearConstraint.h @@ -99,7 +99,7 @@ template class NonlinearConstraint1 : public NonlinearConstraint { public: - typedef typename Key::Value_t X; + typedef typename Key::Value X; protected: typedef NonlinearConstraint1 This; @@ -172,7 +172,7 @@ template class NonlinearEqualityConstraint1 : public NonlinearConstraint1 { public: - typedef typename Key::Value_t X; + typedef typename Key::Value X; protected: typedef NonlinearEqualityConstraint1 This; @@ -194,8 +194,8 @@ template class NonlinearConstraint2 : public NonlinearConstraint { public: - typedef typename Key1::Value_t X1; - typedef typename Key2::Value_t X2; + typedef typename Key1::Value X1; + typedef typename Key2::Value X2; protected: typedef NonlinearConstraint2 This; @@ -275,8 +275,8 @@ template class NonlinearEqualityConstraint2 : public NonlinearConstraint2 { public: - typedef typename Key1::Value_t X1; - typedef typename Key2::Value_t X2; + typedef typename Key1::Value X1; + typedef typename Key2::Value X2; protected: typedef NonlinearEqualityConstraint2 This; @@ -299,9 +299,9 @@ template class NonlinearConstraint3 : public NonlinearConstraint { public: - typedef typename Key1::Value_t X1; - typedef typename Key2::Value_t X2; - typedef typename Key3::Value_t X3; + typedef typename Key1::Value X1; + typedef typename Key2::Value X2; + typedef typename Key3::Value X3; protected: typedef NonlinearConstraint3 This; @@ -389,9 +389,9 @@ template class NonlinearEqualityConstraint3 : public NonlinearConstraint3 { public: - typedef typename Key1::Value_t X1; - typedef typename Key2::Value_t X2; - typedef typename Key3::Value_t X3; + typedef typename Key1::Value X1; + typedef typename Key2::Value X2; + typedef typename Key3::Value X3; protected: typedef NonlinearEqualityConstraint3 This; @@ -415,7 +415,7 @@ template class NonlinearEquality1 : public NonlinearEqualityConstraint1 { public: - typedef typename Key::Value_t X; + typedef typename Key::Value X; protected: typedef NonlinearEqualityConstraint1 Base; @@ -446,7 +446,7 @@ public: template class NonlinearEquality2 : public NonlinearEqualityConstraint2 { public: - typedef typename Key::Value_t X; + typedef typename Key::Value X; protected: typedef NonlinearEqualityConstraint2 Base; diff --git a/nonlinear/NonlinearEquality.h b/nonlinear/NonlinearEquality.h index 66048a82d..a04fbd4fa 100644 --- a/nonlinear/NonlinearEquality.h +++ b/nonlinear/NonlinearEquality.h @@ -34,7 +34,7 @@ namespace gtsam { class NonlinearEquality: public NonlinearFactor1 { public: - typedef typename Key::Value_t T; + typedef typename Key::Value T; private: diff --git a/nonlinear/NonlinearFactor.h b/nonlinear/NonlinearFactor.h index f6ce52aa5..17404c3bf 100644 --- a/nonlinear/NonlinearFactor.h +++ b/nonlinear/NonlinearFactor.h @@ -152,7 +152,7 @@ namespace gtsam { public: // typedefs for value types pulled from keys - typedef typename Key::Value_t X; + typedef typename Key::Value X; protected: @@ -262,8 +262,8 @@ namespace gtsam { public: // typedefs for value types pulled from keys - typedef typename Key1::Value_t X1; - typedef typename Key2::Value_t X2; + typedef typename Key1::Value X1; + typedef typename Key2::Value X2; protected: @@ -398,9 +398,9 @@ namespace gtsam { public: // typedefs for value types pulled from keys - typedef typename Key1::Value_t X1; - typedef typename Key2::Value_t X2; - typedef typename Key3::Value_t X3; + typedef typename Key1::Value X1; + typedef typename Key2::Value X2; + typedef typename Key3::Value X3; protected: diff --git a/nonlinear/TupleValues.h b/nonlinear/TupleValues.h index 34250fbe8..2e26d4e24 100644 --- a/nonlinear/TupleValues.h +++ b/nonlinear/TupleValues.h @@ -138,17 +138,17 @@ namespace gtsam { /** a variant of exists */ template - boost::optional exists_(const Key& j) const { return second_.exists_(j); } + boost::optional exists_(const Key& j) const { return second_.exists_(j); } boost::optional exists_(const Key1& j) const { return first_.exists_(j); } /** access operator */ template - const typename Key::Value_t & operator[](const Key& j) const { return second_[j]; } + const typename Key::Value & operator[](const Key& j) const { return second_[j]; } const Value1& operator[](const Key1& j) const { return first_[j]; } /** at access function */ template - const typename Key::Value_t & at(const Key& j) const { return second_.at(j); } + const typename Key::Value & at(const Key& j) const { return second_.at(j); } const Value1& at(const Key1& j) const { return first_.at(j); } /** direct config access */ diff --git a/slam/BetweenConstraint.h b/slam/BetweenConstraint.h index 9dba9240b..9fe72d533 100644 --- a/slam/BetweenConstraint.h +++ b/slam/BetweenConstraint.h @@ -17,7 +17,7 @@ namespace gtsam { template class BetweenConstraint : public NonlinearEqualityConstraint2 { public: - typedef typename Key::Value_t X; + typedef typename Key::Value X; protected: typedef NonlinearEqualityConstraint2 Base; diff --git a/slam/BetweenFactor.h b/slam/BetweenFactor.h index df5c99d41..e853141bb 100644 --- a/slam/BetweenFactor.h +++ b/slam/BetweenFactor.h @@ -23,7 +23,7 @@ namespace gtsam { class BetweenFactor: public NonlinearFactor2 { public: - typedef typename Key1::Value_t T; + typedef typename Key1::Value T; private: diff --git a/slam/BoundingConstraint.h b/slam/BoundingConstraint.h index 14dd6f576..353bede34 100644 --- a/slam/BoundingConstraint.h +++ b/slam/BoundingConstraint.h @@ -19,7 +19,7 @@ namespace gtsam { */ template struct BoundingConstraint1: public NonlinearConstraint1 { - typedef typename Key::Value_t X; + typedef typename Key::Value X; typedef NonlinearConstraint1 Base; typedef boost::shared_ptr > shared_ptr; @@ -64,8 +64,8 @@ namespace gtsam { */ template struct BoundingConstraint2: public NonlinearConstraint2 { - typedef typename Key1::Value_t X1; - typedef typename Key2::Value_t X2; + typedef typename Key1::Value X1; + typedef typename Key2::Value X2; typedef NonlinearConstraint2 Base; typedef boost::shared_ptr > shared_ptr; diff --git a/slam/LinearApproxFactor.h b/slam/LinearApproxFactor.h index 32bdec7b8..7b958c60e 100644 --- a/slam/LinearApproxFactor.h +++ b/slam/LinearApproxFactor.h @@ -22,7 +22,7 @@ class LinearApproxFactor : public NonlinearFactor { public: /** type for the variable */ - typedef typename Key::Value_t X; + typedef typename Key::Value X; /** base type */ typedef NonlinearFactor Base; diff --git a/slam/PriorFactor.h b/slam/PriorFactor.h index 2fa22b70e..fbed502e9 100644 --- a/slam/PriorFactor.h +++ b/slam/PriorFactor.h @@ -24,7 +24,7 @@ namespace gtsam { class PriorFactor: public NonlinearFactor1 { public: - typedef typename Key::Value_t T; + typedef typename Key::Value T; private: diff --git a/slam/TransformConstraint.h b/slam/TransformConstraint.h index d8636c2af..8cdc2a834 100644 --- a/slam/TransformConstraint.h +++ b/slam/TransformConstraint.h @@ -29,8 +29,8 @@ template class TransformConstraint : public NonlinearEqualityConstraint3 { public: - typedef typename PKey::Value_t Point; - typedef typename TKey::Value_t Transform; + typedef typename PKey::Value Point; + typedef typename TKey::Value Transform; typedef NonlinearEqualityConstraint3 Base; typedef TransformConstraint This; diff --git a/slam/simulated2D.h b/slam/simulated2D.h index 80fe6b224..68948dd98 100644 --- a/slam/simulated2D.h +++ b/slam/simulated2D.h @@ -57,7 +57,7 @@ namespace gtsam { template struct GenericPrior: public NonlinearFactor1 { typedef boost::shared_ptr > shared_ptr; - typedef typename Key::Value_t Pose; + typedef typename Key::Value Pose; Pose z_; GenericPrior(const Pose& z, const SharedGaussian& model, const Key& key) : @@ -77,7 +77,7 @@ namespace gtsam { template struct GenericOdometry: public NonlinearFactor2 { typedef boost::shared_ptr > shared_ptr; - typedef typename Key::Value_t Pose; + typedef typename Key::Value Pose; Pose z_; GenericOdometry(const Pose& z, const SharedGaussian& model, @@ -99,8 +99,8 @@ namespace gtsam { class GenericMeasurement: public NonlinearFactor2 { public: typedef boost::shared_ptr > shared_ptr; - typedef typename XKey::Value_t Pose; - typedef typename LKey::Value_t Point; + typedef typename XKey::Value Pose; + typedef typename LKey::Value Point; Point z_;