gtsam/timing/timePose3.cpp

56 lines
1.4 KiB
C++
Raw Permalink Normal View History

2012-01-08 05:08:45 +08:00
/* ----------------------------------------------------------------------------
2012-05-15 23:28:24 +08:00
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
2012-01-08 05:08:45 +08:00
* Atlanta, Georgia 30332-0415
2012-05-15 23:28:24 +08:00
* All Rights Reserved
2012-01-08 05:08:45 +08:00
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
* See LICENSE for the license information
* -------------------------------------------------------------------------- */
/**
* @file timePose3.cpp
* @brief time Pose3 functions
* @author Frank Dellaert
*/
#include <iostream>
2014-01-10 05:38:47 +08:00
#include <gtsam/base/timing.h>
2012-01-08 05:08:45 +08:00
#include <gtsam/geometry/Pose3.h>
using namespace std;
using namespace gtsam;
2014-01-10 05:38:47 +08:00
/* ************************************************************************* */
2012-01-08 05:08:45 +08:00
#define TEST(TITLE,STATEMENT) \
2014-01-10 05:38:47 +08:00
gttic_(TITLE); \
for(int i = 0; i < n; i++) \
STATEMENT; \
gttoc_(TITLE);
2012-01-08 05:08:45 +08:00
int main()
{
2014-01-10 05:38:47 +08:00
int n = 5000000;
cout << "NOTE: Times are reported for " << n << " calls" << endl;
double norm=sqrt(1.0+16.0+4.0);
double x=1.0/norm, y=4.0/norm, z=2.0/norm;
Vector v = (Vector(6) << x, y, z, 0.1, 0.2, -0.1).finished();
Pose3 T = Pose3::Expmap((Vector(6) << 0.1, 0.1, 0.2, 0.1, 0.4, 0.2).finished()), T2 = T.retract(v);
Matrix H1,H2;
2012-01-08 05:08:45 +08:00
TEST(retract, T.retract(v))
TEST(Expmap, T*Pose3::Expmap(v))
TEST(localCoordinates, T.localCoordinates(T2))
TEST(between, T.between(T2))
TEST(between_derivatives, T.between(T2,H1,H2))
TEST(Logmap, Pose3::Logmap(T.between(T2)))
2014-01-10 05:38:47 +08:00
// Print timings
tictoc_print_();
2012-01-08 05:08:45 +08:00
return 0;
}