Added planar graph to timing script
parent
eef8445ebd
commit
26246188af
|
@ -125,15 +125,6 @@ testBayesNetPreconditioner_LDADD = libgtsam.la
|
||||||
testSubgraphPreconditioner_SOURCES = $(example) testSubgraphPreconditioner.cpp
|
testSubgraphPreconditioner_SOURCES = $(example) testSubgraphPreconditioner.cpp
|
||||||
testSubgraphPreconditioner_LDADD = libgtsam.la
|
testSubgraphPreconditioner_LDADD = libgtsam.la
|
||||||
|
|
||||||
# the timing tests below are broken for now.
|
|
||||||
#noinst_PROGRAMS = timeGaussianFactor timeGaussianFactorGraph
|
|
||||||
|
|
||||||
#timeGaussianFactor_SOURCES = timeGaussianFactor.cpp
|
|
||||||
#timeGaussianFactorGraph_SOURCES = timeGaussianFactorGraph.cpp
|
|
||||||
|
|
||||||
#timeGaussianFactor_LDADD = libgtsam.la
|
|
||||||
#timeGaussianFactorGraph_LDADD = libgtsam.la
|
|
||||||
|
|
||||||
# Nonlinear inference
|
# Nonlinear inference
|
||||||
headers += Key.h NonlinearFactorGraph.h NonlinearFactorGraph-inl.h
|
headers += Key.h NonlinearFactorGraph.h NonlinearFactorGraph-inl.h
|
||||||
headers += NonlinearOptimizer.h NonlinearOptimizer-inl.h
|
headers += NonlinearOptimizer.h NonlinearOptimizer-inl.h
|
||||||
|
@ -184,10 +175,6 @@ testCal3_S2_LDADD = libgtsam.la
|
||||||
testLieConfig_LDADD = libgtsam.la
|
testLieConfig_LDADD = libgtsam.la
|
||||||
testTupleConfig_LDADD = libgtsam.la
|
testTupleConfig_LDADD = libgtsam.la
|
||||||
|
|
||||||
noinst_PROGRAMS = timeRot3
|
|
||||||
timeRot3_SOURCES = timeRot3.cpp
|
|
||||||
timeRot3_LDADD = libgtsam.la
|
|
||||||
|
|
||||||
# simulated2D example
|
# simulated2D example
|
||||||
sources += simulated2D.cpp
|
sources += simulated2D.cpp
|
||||||
testSimulated2D_SOURCES = testSimulated2D.cpp
|
testSimulated2D_SOURCES = testSimulated2D.cpp
|
||||||
|
@ -253,6 +240,15 @@ testVSLAMConfig_LDADD = libgtsam.la
|
||||||
headers += smallExample.h
|
headers += smallExample.h
|
||||||
headers += $(sources:.cpp=.h)
|
headers += $(sources:.cpp=.h)
|
||||||
|
|
||||||
|
# Timing tests
|
||||||
|
noinst_PROGRAMS = timeGaussianFactor timeGaussianFactorGraph timeRot3
|
||||||
|
timeRot3_SOURCES = timeRot3.cpp
|
||||||
|
timeRot3_LDADD = libgtsam.la
|
||||||
|
timeGaussianFactor_SOURCES = timeGaussianFactor.cpp
|
||||||
|
timeGaussianFactor_LDADD = $(example) libgtsam.la
|
||||||
|
timeGaussianFactorGraph_SOURCES = timeGaussianFactorGraph.cpp
|
||||||
|
timeGaussianFactorGraph_LDADD = $(example) libgtsam.la
|
||||||
|
|
||||||
# create both dynamic and static libraries
|
# create both dynamic and static libraries
|
||||||
AM_CXXFLAGS = -I$(boost) -fPIC
|
AM_CXXFLAGS = -I$(boost) -fPIC
|
||||||
lib_LTLIBRARIES = libgtsam.la
|
lib_LTLIBRARIES = libgtsam.la
|
||||||
|
|
|
@ -25,13 +25,36 @@ double timeKalmanSmoother(int T) {
|
||||||
return dif;
|
return dif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
// Create a planar factor graph and optimize
|
||||||
|
double timePlanarSmoother(int N) {
|
||||||
|
GaussianFactorGraph fg;
|
||||||
|
VectorConfig config;
|
||||||
|
boost::tie(fg,config) = planarGraph(N);
|
||||||
|
Ordering ordering = fg.getOrdering();
|
||||||
|
clock_t start = clock();
|
||||||
|
fg.optimize(ordering);
|
||||||
|
clock_t end = clock ();
|
||||||
|
double dif = (double)(end - start) / CLOCKS_PER_SEC;
|
||||||
|
return dif;
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
TEST(timeGaussianFactorGraph, linearTime)
|
TEST(timeGaussianFactorGraph, linearTime)
|
||||||
{
|
{
|
||||||
int T = 1000;
|
int T = 1000;
|
||||||
double time1 = timeKalmanSmoother( T); // cout << time1 << endl;
|
double time1 = timeKalmanSmoother( T); cout << time1 << endl;
|
||||||
double time2 = timeKalmanSmoother(2*T); // cout << time2 << endl;
|
double time2 = timeKalmanSmoother(2*T); cout << time2 << endl;
|
||||||
DOUBLES_EQUAL(2*time1,time2,0.001);
|
DOUBLES_EQUAL(2*time1,time2,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
TEST(timeGaussianFactorGraph, planar)
|
||||||
|
{
|
||||||
|
// 1740: 8.12, 8.12, 8.12, 8.16, 8.14
|
||||||
|
int N = 30;
|
||||||
|
double time = timePlanarSmoother(N); cout << time << endl;
|
||||||
|
DOUBLES_EQUAL(8.12,time,0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
Loading…
Reference in New Issue