From 60e10d7380b4647e84f520db204e8f60b1b076b0 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Wed, 3 Nov 2010 22:35:02 +0000 Subject: [PATCH] Added timeSequentialOnDataset and timeMultifrontalOnDataset, removed timeLinearOnDataset --- tests/Makefile.am | 2 +- tests/timeMultifrontalOnDataset.cpp | 59 +++++++++++++++++++ ...ataset.cpp => timeSequentialOnDataset.cpp} | 7 +-- 3 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 tests/timeMultifrontalOnDataset.cpp rename tests/{timeLinearOnDataset.cpp => timeSequentialOnDataset.cpp} (89%) diff --git a/tests/Makefile.am b/tests/Makefile.am index b1def099a..905473259 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -26,7 +26,7 @@ check_PROGRAMS += testSerialization endif # Timing tests -noinst_PROGRAMS = timeGaussianFactorGraph timeLinearOnDataset +noinst_PROGRAMS = timeGaussianFactorGraph timeSequentialOnDataset timeMultifrontalOnDataset #---------------------------------------------------------------------------------------------------- # rules to build unit tests diff --git a/tests/timeMultifrontalOnDataset.cpp b/tests/timeMultifrontalOnDataset.cpp new file mode 100644 index 000000000..6ba5503be --- /dev/null +++ b/tests/timeMultifrontalOnDataset.cpp @@ -0,0 +1,59 @@ +/* ---------------------------------------------------------------------------- + + * GTSAM Copyright 2010, Georgia Tech Research Corporation, + * Atlanta, Georgia 30332-0415 + * All Rights Reserved + * Authors: Frank Dellaert, et al. (see THANKS for the full author list) + + * See LICENSE for the license information + + * -------------------------------------------------------------------------- */ + +/** + * @file timeSequentialOnDataset.cpp + * @brief + * @author Richard Roberts + * @created Oct 7, 2010 + */ + +#include +#include +#include +#include + +using namespace std; +using namespace gtsam; +using namespace boost; + +int main(int argc, char *argv[]) { + + string datasetname; + if(argc > 1) + datasetname = argv[1]; + else + datasetname = "intel"; + + pair, shared_ptr > data = load2D(dataset(datasetname)); + + tic_("Z 1 order"); + Ordering::shared_ptr ordering(data.first->orderingCOLAMD(*data.second)); + toc_("Z 1 order"); + tictoc_print_(); + + tic_("Z 2 linearize"); + GaussianFactorGraph::shared_ptr gfg(data.first->linearize(*data.second, *ordering)); + toc_("Z 2 linearize"); + tictoc_print_(); + + for(size_t trial = 0; trial < 100; ++trial) { + + tic_("Z 3 solve"); + VectorValues soln(*GaussianMultifrontalSolver(*gfg).optimize()); + toc_("Z 3 solve"); + + tictoc_print_(); + } + + return 0; + +} diff --git a/tests/timeLinearOnDataset.cpp b/tests/timeSequentialOnDataset.cpp similarity index 89% rename from tests/timeLinearOnDataset.cpp rename to tests/timeSequentialOnDataset.cpp index 82a7a08dc..2850e2e32 100644 --- a/tests/timeLinearOnDataset.cpp +++ b/tests/timeSequentialOnDataset.cpp @@ -10,7 +10,7 @@ * -------------------------------------------------------------------------- */ /** - * @file timeLinearOnDataset.cpp + * @file timeSequentialOnDataset.cpp * @brief * @author Richard Roberts * @created Oct 7, 2010 @@ -19,7 +19,7 @@ #include #include #include -#include +#include using namespace std; using namespace gtsam; @@ -48,8 +48,7 @@ int main(int argc, char *argv[]) { for(size_t trial = 0; trial < 100; ++trial) { tic_("Z 3 solve"); - GaussianJunctionTree gjt(*gfg); - VectorValues soln(gjt.optimize()); + VectorValues soln(*GaussianSequentialSolver(*gfg).optimize()); toc_("Z 3 solve"); tictoc_print_();