Cleaned up Double_ problems

release/4.3a0
dellaert 2016-04-10 19:01:14 -07:00
parent ad54d7805c
commit a3b66a94ea
3 changed files with 11 additions and 14 deletions

View File

@ -17,7 +17,7 @@
* @brief unit tests for Block Automatic Differentiation * @brief unit tests for Block Automatic Differentiation
*/ */
#include <gtsam/nonlinear/Expression.h> #include <gtsam/nonlinear/expressions.h>
#include <gtsam/geometry/Cal3_S2.h> #include <gtsam/geometry/Cal3_S2.h>
#include <gtsam/geometry/PinholeCamera.h> #include <gtsam/geometry/PinholeCamera.h>
#include <gtsam/geometry/Point3.h> #include <gtsam/geometry/Point3.h>
@ -32,9 +32,7 @@ using boost::assign::map_list_of;
using namespace std; using namespace std;
using namespace gtsam; using namespace gtsam;
typedef Expression<double> double_;
typedef Expression<Point3> Point3_; typedef Expression<Point3> Point3_;
typedef Expression<Vector3> Vector3_;
typedef Expression<Pose3> Pose3_; typedef Expression<Pose3> Pose3_;
typedef Expression<Rot3> Rot3_; typedef Expression<Rot3> Rot3_;
@ -101,7 +99,7 @@ TEST(Expression, Unary1) {
} }
TEST(Expression, Unary2) { TEST(Expression, Unary2) {
using namespace unary; using namespace unary;
double_ e(f2, p); Double_ e(f2, p);
EXPECT(expected == e.keys()); EXPECT(expected == e.keys());
} }
@ -156,7 +154,7 @@ Point3_ p_cam(x, &Pose3::transform_to, p);
// Check that creating an expression to double compiles // Check that creating an expression to double compiles
TEST(Expression, BinaryToDouble) { TEST(Expression, BinaryToDouble) {
using namespace binary; using namespace binary;
double_ p_cam(doubleF, x, p); Double_ p_cam(doubleF, x, p);
} }
/* ************************************************************************* */ /* ************************************************************************* */
@ -372,8 +370,8 @@ TEST(Expression, TripleSum) {
/* ************************************************************************* */ /* ************************************************************************* */
TEST(Expression, SumOfUnaries) { TEST(Expression, SumOfUnaries) {
const Key key(67); const Key key(67);
const double_ norm_(&gtsam::norm, Point3_(key)); const Double_ norm_(&gtsam::norm, Point3_(key));
const double_ sum_ = norm_ + norm_; const Double_ sum_ = norm_ + norm_;
Values values; Values values;
values.insert<Point3>(key, Point3(6, 0, 0)); values.insert<Point3>(key, Point3(6, 0, 0));
@ -391,7 +389,7 @@ TEST(Expression, SumOfUnaries) {
TEST(Expression, UnaryOfSum) { TEST(Expression, UnaryOfSum) {
const Key key1(42), key2(67); const Key key1(42), key2(67);
const Point3_ sum_ = Point3_(key1) + Point3_(key2); const Point3_ sum_ = Point3_(key1) + Point3_(key2);
const double_ norm_(&gtsam::norm, sum_); const Double_ norm_(&gtsam::norm, sum_);
map<Key, int> actual_dims, expected_dims = map_list_of<Key, int>(key1, 3)(key2, 3); map<Key, int> actual_dims, expected_dims = map_list_of<Key, int>(key1, 3)(key2, 3);
norm_.dims(actual_dims); norm_.dims(actual_dims);

View File

@ -17,7 +17,7 @@
* @date December 2014 * @date December 2014
*/ */
#include <gtsam_unstable/nonlinear/ExpressionFactor.h> #include <gtsam/nonlinear/ExpressionFactor.h>
#include <gtsam_unstable/geometry/Event.h> #include <gtsam_unstable/geometry/Event.h>
namespace gtsam { namespace gtsam {
@ -25,7 +25,7 @@ namespace gtsam {
/// A "Time of Arrival" factor - so little code seems hardly worth it :-) /// A "Time of Arrival" factor - so little code seems hardly worth it :-)
class TOAFactor: public ExpressionFactor<double> { class TOAFactor: public ExpressionFactor<double> {
typedef Expression<double> double_; typedef Expression<double> Double_;
public: public:
@ -40,7 +40,7 @@ public:
const Expression<Point3>& microphone_, double toaMeasurement, const Expression<Point3>& microphone_, double toaMeasurement,
const SharedNoiseModel& model) : const SharedNoiseModel& model) :
ExpressionFactor<double>(model, toaMeasurement, ExpressionFactor<double>(model, toaMeasurement,
double_(&Event::toa, eventExpression, microphone_)) { Double_(&Event::toa, eventExpression, microphone_)) {
} }
}; };

View File

@ -31,7 +31,6 @@ using namespace std;
using namespace gtsam; using namespace gtsam;
// typedefs // typedefs
typedef Eigen::Matrix<double, 1, 1> Vector1;
typedef Expression<Point3> Point3_; typedef Expression<Point3> Point3_;
typedef Expression<Event> Event_; typedef Expression<Event> Event_;
@ -52,7 +51,7 @@ TEST( TOAFactor, NewWay ) {
Event_ eventExpression(key); Event_ eventExpression(key);
Point3_ microphoneConstant(microphoneAt0); // constant expression Point3_ microphoneConstant(microphoneAt0); // constant expression
double measurement = 7; double measurement = 7;
double_ expression(&Event::toa, eventExpression, microphoneConstant); Double_ expression(&Event::toa, eventExpression, microphoneConstant);
ExpressionFactor<double> factor(model, measurement, expression); ExpressionFactor<double> factor(model, measurement, expression);
} }
@ -92,7 +91,7 @@ TEST( TOAFactor, WholeEnchilada ) {
Event_ eventExpression(key); Event_ eventExpression(key);
for (size_t i = 0; i < K; i++) { for (size_t i = 0; i < K; i++) {
Point3_ microphone_i(microphones[i]); // constant expression Point3_ microphone_i(microphones[i]); // constant expression
double_ predictTOA(&Event::toa, eventExpression, microphone_i); Double_ predictTOA(&Event::toa, eventExpression, microphone_i);
graph.addExpressionFactor(predictTOA, simulatedTOA[i], model); graph.addExpressionFactor(predictTOA, simulatedTOA[i], model);
} }