Merged in feature/timing_scripts_build (pull request #17)
Fix and re-enable building of timing scriptsrelease/4.3a0
commit
33d2b4d683
|
|
@ -46,7 +46,6 @@ endif()
|
||||||
# Set up options
|
# Set up options
|
||||||
|
|
||||||
# Configurable Options
|
# Configurable Options
|
||||||
option(GTSAM_BUILD_TIMING "Enable/Disable building of timing scripts" OFF) # These do not currently work
|
|
||||||
if(GTSAM_UNSTABLE_AVAILABLE)
|
if(GTSAM_UNSTABLE_AVAILABLE)
|
||||||
option(GTSAM_BUILD_UNSTABLE "Enable/Disable libgtsam_unstable" ON)
|
option(GTSAM_BUILD_UNSTABLE "Enable/Disable libgtsam_unstable" ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
@ -304,6 +303,9 @@ add_subdirectory(tests)
|
||||||
# Build examples
|
# Build examples
|
||||||
add_subdirectory(examples)
|
add_subdirectory(examples)
|
||||||
|
|
||||||
|
# Build timing
|
||||||
|
add_subdirectory(timing)
|
||||||
|
|
||||||
# Matlab toolbox
|
# Matlab toolbox
|
||||||
if (GTSAM_INSTALL_MATLAB_TOOLBOX)
|
if (GTSAM_INSTALL_MATLAB_TOOLBOX)
|
||||||
add_subdirectory(matlab)
|
add_subdirectory(matlab)
|
||||||
|
|
@ -361,7 +363,7 @@ message(STATUS "================ Configuration Options ======================"
|
||||||
message(STATUS "Build flags ")
|
message(STATUS "Build flags ")
|
||||||
print_config_flag(${GTSAM_BUILD_TESTS} "Build Tests ")
|
print_config_flag(${GTSAM_BUILD_TESTS} "Build Tests ")
|
||||||
print_config_flag(${GTSAM_BUILD_EXAMPLES_ALWAYS} "Build examples with 'make all' ")
|
print_config_flag(${GTSAM_BUILD_EXAMPLES_ALWAYS} "Build examples with 'make all' ")
|
||||||
print_config_flag(${GTSAM_BUILD_TIMING} "Build Timing scripts ")
|
print_config_flag(${GTSAM_BUILD_TIMING_ALWAYS} "Build timing scripts with 'make all'")
|
||||||
if (DOXYGEN_FOUND)
|
if (DOXYGEN_FOUND)
|
||||||
print_config_flag(${GTSAM_BUILD_DOCS} "Build Docs ")
|
print_config_flag(${GTSAM_BUILD_DOCS} "Build Docs ")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -38,21 +38,46 @@ endmacro()
|
||||||
#
|
#
|
||||||
# Add scripts that will serve as examples of how to use the library. A list of files or
|
# Add scripts that will serve as examples of how to use the library. A list of files or
|
||||||
# glob patterns is specified, and one executable will be created for each matching .cpp
|
# glob patterns is specified, and one executable will be created for each matching .cpp
|
||||||
# file. These executables will not be installed. They are build with 'make all' if
|
# file. These executables will not be installed. They are built with 'make all' if
|
||||||
# GTSAM_BUILD_EXAMPLES_ALWAYS is enabled. They may also be built with 'make examples'.
|
# GTSAM_BUILD_EXAMPLES_ALWAYS is enabled. They may also be built with 'make examples'.
|
||||||
#
|
#
|
||||||
# Usage example:
|
# Usage example:
|
||||||
# gtsamAddExamplesGlob("*.cpp" "BrokenExample.cpp" "gtsam;GeographicLib")
|
# gtsamAddExamplesGlob("*.cpp" "BrokenExample.cpp" "gtsam;GeographicLib")
|
||||||
#
|
#
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# globPatterns: The list of files or glob patterns from which to create unit tests, with
|
# globPatterns: The list of files or glob patterns from which to create examples, with
|
||||||
# one test created for each cpp file. e.g. "*.cpp", or
|
# one program created for each cpp file. e.g. "*.cpp", or
|
||||||
# "A*.cpp;B*.cpp;MyExample.cpp".
|
# "A*.cpp;B*.cpp;MyExample.cpp".
|
||||||
# excludedFiles: A list of files or globs to exclude, e.g. "C*.cpp;BrokenExample.cpp". Pass
|
# excludedFiles: A list of files or globs to exclude, e.g. "C*.cpp;BrokenExample.cpp". Pass
|
||||||
# an empty string "" if nothing needs to be excluded.
|
# an empty string "" if nothing needs to be excluded.
|
||||||
# linkLibraries: The list of libraries to link to.
|
# linkLibraries: The list of libraries to link to.
|
||||||
macro(gtsamAddExamplesGlob globPatterns excludedFiles linkLibraries)
|
macro(gtsamAddExamplesGlob globPatterns excludedFiles linkLibraries)
|
||||||
gtsamAddExamplesGlob_impl("${globPatterns}" "${excludedFiles}" "${linkLibraries}")
|
gtsamAddExesGlob_impl("${globPatterns}" "${excludedFiles}" "${linkLibraries}" "examples" ${GTSAM_BUILD_EXAMPLES_ALWAYS})
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Macro:
|
||||||
|
#
|
||||||
|
# gtsamAddTimingGlob(globPatterns excludedFiles linkLibraries)
|
||||||
|
#
|
||||||
|
# Add scripts that time aspects of the library. A list of files or
|
||||||
|
# glob patterns is specified, and one executable will be created for each matching .cpp
|
||||||
|
# file. These executables will not be installed. They are not built with 'make all',
|
||||||
|
# but they may be built with 'make timing'.
|
||||||
|
#
|
||||||
|
# Usage example:
|
||||||
|
# gtsamAddTimingGlob("*.cpp" "DisabledTimingScript.cpp" "gtsam;GeographicLib")
|
||||||
|
#
|
||||||
|
# Arguments:
|
||||||
|
# globPatterns: The list of files or glob patterns from which to create programs, with
|
||||||
|
# one program created for each cpp file. e.g. "*.cpp", or
|
||||||
|
# "A*.cpp;B*.cpp;MyExample.cpp".
|
||||||
|
# excludedFiles: A list of files or globs to exclude, e.g. "C*.cpp;BrokenExample.cpp". Pass
|
||||||
|
# an empty string "" if nothing needs to be excluded.
|
||||||
|
# linkLibraries: The list of libraries to link to.
|
||||||
|
macro(gtsamAddTimingGlob globPatterns excludedFiles linkLibraries)
|
||||||
|
gtsamAddExesGlob_impl("${globPatterns}" "${excludedFiles}" "${linkLibraries}" "timing" ${GTSAM_BUILD_TIMING_ALWAYS})
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -63,6 +88,7 @@ enable_testing()
|
||||||
|
|
||||||
option(GTSAM_BUILD_TESTS "Enable/Disable building of tests" ON)
|
option(GTSAM_BUILD_TESTS "Enable/Disable building of tests" ON)
|
||||||
option(GTSAM_BUILD_EXAMPLES_ALWAYS "Build examples with 'make all' (build with 'make examples' if not)" ON)
|
option(GTSAM_BUILD_EXAMPLES_ALWAYS "Build examples with 'make all' (build with 'make examples' if not)" ON)
|
||||||
|
option(GTSAM_BUILD_TIMING_ALWAYS "Build timing scripts with 'make all' (build with 'make timing' if not" OFF)
|
||||||
|
|
||||||
# Add option for combining unit tests
|
# Add option for combining unit tests
|
||||||
if(MSVC OR XCODE_VERSION)
|
if(MSVC OR XCODE_VERSION)
|
||||||
|
|
@ -80,6 +106,9 @@ endif()
|
||||||
# Add examples target
|
# Add examples target
|
||||||
add_custom_target(examples)
|
add_custom_target(examples)
|
||||||
|
|
||||||
|
# Add timing target
|
||||||
|
add_custom_target(timing)
|
||||||
|
|
||||||
# Include obsolete macros - will be removed in the near future
|
# Include obsolete macros - will be removed in the near future
|
||||||
include(GtsamTestingObsolete)
|
include(GtsamTestingObsolete)
|
||||||
|
|
||||||
|
|
@ -180,7 +209,7 @@ macro(gtsamAddTestsGlob_impl groupName globPatterns excludedFiles linkLibraries)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
macro(gtsamAddExamplesGlob_impl globPatterns excludedFiles linkLibraries)
|
macro(gtsamAddExesGlob_impl globPatterns excludedFiles linkLibraries groupName buildWithAll)
|
||||||
# Get all script files
|
# Get all script files
|
||||||
file(GLOB script_files ${globPatterns})
|
file(GLOB script_files ${globPatterns})
|
||||||
|
|
||||||
|
|
@ -220,7 +249,7 @@ macro(gtsamAddExamplesGlob_impl globPatterns excludedFiles linkLibraries)
|
||||||
target_link_libraries(${script_name} ${linkLibraries})
|
target_link_libraries(${script_name} ${linkLibraries})
|
||||||
|
|
||||||
# Add target dependencies
|
# Add target dependencies
|
||||||
add_dependencies(examples ${script_name})
|
add_dependencies(${groupName} ${script_name})
|
||||||
if(NOT MSVC AND NOT XCODE_VERSION)
|
if(NOT MSVC AND NOT XCODE_VERSION)
|
||||||
add_custom_target(${script_name}.run ${EXECUTABLE_OUTPUT_PATH}${script_name})
|
add_custom_target(${script_name}.run ${EXECUTABLE_OUTPUT_PATH}${script_name})
|
||||||
endif()
|
endif()
|
||||||
|
|
@ -228,12 +257,14 @@ macro(gtsamAddExamplesGlob_impl globPatterns excludedFiles linkLibraries)
|
||||||
# Add TOPSRCDIR
|
# Add TOPSRCDIR
|
||||||
set_property(SOURCE ${script_src} APPEND PROPERTY COMPILE_DEFINITIONS "TOPSRCDIR=\"${PROJECT_SOURCE_DIR}\"")
|
set_property(SOURCE ${script_src} APPEND PROPERTY COMPILE_DEFINITIONS "TOPSRCDIR=\"${PROJECT_SOURCE_DIR}\"")
|
||||||
|
|
||||||
if(NOT GTSAM_BUILD_EXAMPLES_ALWAYS)
|
# Exclude from all or not - note weird variable assignment because we're in a macro
|
||||||
|
set(buildWithAll_on ${buildWithAll})
|
||||||
|
if(NOT buildWithAll_on)
|
||||||
# Exclude from 'make all' and 'make install'
|
# Exclude from 'make all' and 'make install'
|
||||||
set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL ON)
|
set_target_properties("${script_name}" PROPERTIES EXCLUDE_FROM_ALL ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Configure target folder (for MSVC and Xcode)
|
# Configure target folder (for MSVC and Xcode)
|
||||||
set_property(TARGET ${script_name} PROPERTY FOLDER "Examples")
|
set_property(TARGET ${script_name} PROPERTY FOLDER "${groupName}")
|
||||||
endforeach()
|
endforeach()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,3 @@ install(FILES ${base_headers_tree} DESTINATION include/gtsam/base/treeTraversal)
|
||||||
|
|
||||||
# Build tests
|
# Build tests
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|
||||||
# Build timing scripts
|
|
||||||
if (GTSAM_BUILD_TIMING)
|
|
||||||
gtsam_add_subdir_timing(base "gtsam" "gtsam" "${base_excluded_files}")
|
|
||||||
endif(GTSAM_BUILD_TIMING)
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,3 @@ install(FILES ${discrete_headers} DESTINATION include/gtsam/discrete)
|
||||||
|
|
||||||
# Add all tests
|
# Add all tests
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|
||||||
# Build timing scripts
|
|
||||||
#if (GTSAM_BUILD_TIMING)
|
|
||||||
# gtsam_add_timing(discrete "${discrete_local_libs}")
|
|
||||||
#endif(GTSAM_BUILD_TIMING)
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,3 @@ install(FILES ${geometry_headers} DESTINATION include/gtsam/geometry)
|
||||||
|
|
||||||
# Build tests
|
# Build tests
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|
||||||
# Build timing scripts
|
|
||||||
if (GTSAM_BUILD_TIMING)
|
|
||||||
gtsam_add_subdir_timing(geometry "gtsam" "gtsam" "${geometry_excluded_files}")
|
|
||||||
endif(GTSAM_BUILD_TIMING)
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,3 @@ install(FILES ${inference_headers} DESTINATION include/gtsam/inference)
|
||||||
|
|
||||||
# Build tests
|
# Build tests
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|
||||||
# Build timing scripts
|
|
||||||
if (GTSAM_BUILD_TIMING)
|
|
||||||
gtsam_add_subdir_timing(inference "gtsam" "gtsam" "${inference_excluded_files}")
|
|
||||||
endif(GTSAM_BUILD_TIMING)
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,3 @@ install(FILES ${linear_headers} DESTINATION include/gtsam/linear)
|
||||||
|
|
||||||
# Build tests
|
# Build tests
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|
||||||
# Build timing scripts
|
|
||||||
if (GTSAM_BUILD_TIMING)
|
|
||||||
gtsam_add_subdir_timing(linear "gtsam" "gtsam" "${linear_excluded_files}")
|
|
||||||
endif(GTSAM_BUILD_TIMING)
|
|
||||||
|
|
|
||||||
|
|
@ -1,144 +0,0 @@
|
||||||
/* ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
* 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 timeSLAMlike.cpp
|
|
||||||
* @brief Times solving of random SLAM-like graphs
|
|
||||||
* @author Richard Roberts
|
|
||||||
* @date Aug 30, 2010
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gtsam/linear/GaussianFactorGraph.h>
|
|
||||||
#include <gtsam/linear/NoiseModel.h>
|
|
||||||
|
|
||||||
#include <boost/random.hpp>
|
|
||||||
#include <boost/timer.hpp>
|
|
||||||
#include <boost/bind.hpp>
|
|
||||||
#include <boost/lambda/lambda.hpp>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
using namespace gtsam;
|
|
||||||
using namespace std;
|
|
||||||
using namespace boost::lambda;
|
|
||||||
|
|
||||||
typedef EliminationTree<JacobianFactor> GaussianEliminationTree;
|
|
||||||
|
|
||||||
static boost::variate_generator<boost::mt19937, boost::uniform_real<> > rg(boost::mt19937(), boost::uniform_real<>(0.0, 1.0));
|
|
||||||
|
|
||||||
bool _pair_compare(const pair<Index, Matrix>& a1, const pair<Index, Matrix>& a2) { return a1.first < a2.first; }
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
|
||||||
|
|
||||||
size_t vardim = 3;
|
|
||||||
size_t blockdim = 3;
|
|
||||||
int nVars = 500;
|
|
||||||
size_t blocksPerVar = 5;
|
|
||||||
size_t varsPerBlock = 2;
|
|
||||||
size_t varSpread = 10;
|
|
||||||
|
|
||||||
size_t nTrials = 10;
|
|
||||||
|
|
||||||
double blockbuild, blocksolve;
|
|
||||||
|
|
||||||
cout << "\n" << nVars << " variables of dimension " << vardim << ", " <<
|
|
||||||
blocksPerVar << " blocks for each variable, blocks of dimension " << blockdim << " measure " << varsPerBlock << " variables\n";
|
|
||||||
cout << nTrials << " trials\n";
|
|
||||||
|
|
||||||
boost::variate_generator<boost::mt19937, boost::uniform_int<> > ri(boost::mt19937(), boost::uniform_int<>(-varSpread, varSpread));
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Timing test with blockwise Gaussian factor graphs
|
|
||||||
|
|
||||||
{
|
|
||||||
// Build GFG's
|
|
||||||
cout << "Building SLAM-like Gaussian factor graphs... ";
|
|
||||||
cout.flush();
|
|
||||||
boost::timer timer;
|
|
||||||
timer.restart();
|
|
||||||
vector<GaussianFactorGraph> blockGfgs;
|
|
||||||
blockGfgs.reserve(nTrials);
|
|
||||||
for(size_t trial=0; trial<nTrials; ++trial) {
|
|
||||||
blockGfgs.push_back(GaussianFactorGraph());
|
|
||||||
SharedDiagonal noise = noiseModel::Isotropic::Sigma(blockdim, 1.0);
|
|
||||||
for(int c=0; c<nVars; ++c) {
|
|
||||||
for(size_t d=0; d<blocksPerVar; ++d) {
|
|
||||||
vector<pair<Index, Matrix> > terms; terms.reserve(varsPerBlock);
|
|
||||||
if(c == 0 && d == 0)
|
|
||||||
// If it's the first factor, just make a prior
|
|
||||||
terms.push_back(make_pair(0, eye(vardim)));
|
|
||||||
else if(c != 0) {
|
|
||||||
// Generate a random Gaussian factor
|
|
||||||
for(size_t h=0; h<varsPerBlock; ++h) {
|
|
||||||
int var;
|
|
||||||
// If it's the first factor for this variable, make it "odometry"
|
|
||||||
if(d == 0 && h == 0)
|
|
||||||
var = c-1;
|
|
||||||
else if(d == 0 && h == 1)
|
|
||||||
var = c;
|
|
||||||
else
|
|
||||||
// Choose random variable ids
|
|
||||||
do
|
|
||||||
var = c + ri();
|
|
||||||
while(var < 0 || var > nVars-1 || find_if(terms.begin(), terms.end(),
|
|
||||||
boost::bind(&pair<Index, Matrix>::first, boost::lambda::_1) == Index(var)) != terms.end());
|
|
||||||
Matrix A(blockdim, vardim);
|
|
||||||
for(size_t j=0; j<blockdim; ++j)
|
|
||||||
for(size_t k=0; k<vardim; ++k)
|
|
||||||
A(j,k) = rg();
|
|
||||||
terms.push_back(make_pair(Index(var), A));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vector b(blockdim);
|
|
||||||
sort(terms.begin(), terms.end(), &_pair_compare);
|
|
||||||
for(size_t j=0; j<blockdim; ++j)
|
|
||||||
b(j) = rg();
|
|
||||||
if(!terms.empty())
|
|
||||||
blockGfgs[trial].push_back(JacobianFactor::shared_ptr(new JacobianFactor(terms, b, noise)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if(trial == 0)
|
|
||||||
// blockGfgs.front().print("GFG: ");
|
|
||||||
}
|
|
||||||
blockbuild = timer.elapsed();
|
|
||||||
cout << blockbuild << " s" << endl;
|
|
||||||
|
|
||||||
// Solve GFG's
|
|
||||||
cout << "Solving SLAM-like Gaussian factor graphs... ";
|
|
||||||
cout.flush();
|
|
||||||
timer.restart();
|
|
||||||
for(size_t trial=0; trial<nTrials; ++trial) {
|
|
||||||
// cout << "Trial " << trial << endl;
|
|
||||||
VectorValues soln(*GaussianMultifrontalSolver(blockGfgs[trial]).optimize());
|
|
||||||
}
|
|
||||||
blocksolve = timer.elapsed();
|
|
||||||
cout << blocksolve << " s" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Print per-graph times
|
|
||||||
cout << "\nPer-factor-graph times for building and solving\n";
|
|
||||||
cout << " total " << (1000.0*(blockbuild+blocksolve)/double(nTrials)) <<
|
|
||||||
" build " << (1000.0*blockbuild/double(nTrials)) <<
|
|
||||||
" solve " << (1000.0*blocksolve/double(nTrials)) << " ms/graph\n";
|
|
||||||
cout << endl;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file timeSLAMlike.cpp
|
|
||||||
* @brief
|
|
||||||
* @author Richard Roberts
|
|
||||||
* @date Aug 30, 2010
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
@ -4,8 +4,3 @@ install(FILES ${navigation_headers} DESTINATION include/gtsam/navigation)
|
||||||
|
|
||||||
# Add all tests
|
# Add all tests
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|
||||||
# Build timing scripts
|
|
||||||
if (GTSAM_BUILD_TIMING)
|
|
||||||
gtsam_add_subdir_timing(navigation "gtsam" "gtsam" "${navigation_excluded_files}")
|
|
||||||
endif(GTSAM_BUILD_TIMING)
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,3 @@ install(FILES ${nonlinear_headers} DESTINATION include/gtsam/nonlinear)
|
||||||
|
|
||||||
# Build tests
|
# Build tests
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|
||||||
# Build timing scripts
|
|
||||||
if (GTSAM_BUILD_TIMING)
|
|
||||||
gtsam_add_subdir_timing(nonlinear "gtsam" "gtsam" "${nonlinear_excluded_files}")
|
|
||||||
endif(GTSAM_BUILD_TIMING)
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,3 @@ install(FILES ${slam_headers} DESTINATION include/gtsam/slam)
|
||||||
|
|
||||||
# Build tests
|
# Build tests
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|
||||||
# Build timing scripts
|
|
||||||
if (GTSAM_BUILD_TIMING)
|
|
||||||
gtsam_add_subdir_timing(slam "gtsam" "gtsam" "${slam_excluded_files}")
|
|
||||||
endif(GTSAM_BUILD_TIMING)
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,3 @@ install(FILES ${symbolic_headers} DESTINATION include/gtsam/symbolic)
|
||||||
|
|
||||||
# Build tests
|
# Build tests
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|
||||||
# Build timing scripts
|
|
||||||
if (GTSAM_BUILD_TIMING)
|
|
||||||
gtsam_add_subdir_timing(symbolic "gtsam" "gtsam" "${symbolic_excluded_files}")
|
|
||||||
endif(GTSAM_BUILD_TIMING)
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,3 +119,5 @@ endif(GTSAM_INSTALL_MATLAB_TOOLBOX)
|
||||||
# Build examples
|
# Build examples
|
||||||
add_subdirectory(examples)
|
add_subdirectory(examples)
|
||||||
|
|
||||||
|
# Build timing
|
||||||
|
add_subdirectory(timing)
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,3 @@ install(FILES ${base_headers} DESTINATION include/gtsam_unstable/base)
|
||||||
|
|
||||||
# Add all tests
|
# Add all tests
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|
||||||
# Build timing scripts
|
|
||||||
if (GTSAM_BUILD_TIMING)
|
|
||||||
gtsam_add_subdir_timing(base_unstable "${base_full_libs}" "${base_full_libs}" "${base_excluded_files}")
|
|
||||||
endif(GTSAM_BUILD_TIMING)
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,4 @@
|
||||||
file(GLOB partition_headers "*.h")
|
file(GLOB partition_headers "*.h")
|
||||||
install(FILES ${partition_headers} DESTINATION include/gtsam_unstable/parition)
|
install(FILES ${partition_headers} DESTINATION include/gtsam_unstable/parition)
|
||||||
|
|
||||||
set(ignore_test "tests/testNestedDissection.cpp")
|
add_subdirectory(tests)
|
||||||
# Add all tests
|
|
||||||
gtsamAddTestsGlob(partition_unstable "tests/*.cpp" "${ignore_test}" "gtsam_unstable;metis")
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
set(ignore_test "testNestedDissection.cpp")
|
||||||
|
gtsamAddTestsGlob(partition "test*.cpp" "${ignore_test}" "gtsam_unstable")
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
gtsamAddTimingGlob("*.cpp" "" "gtsam_unstable")
|
||||||
|
|
@ -20,9 +20,9 @@
|
||||||
#include <gtsam_unstable/slam/InertialNavFactor_GlobalVelocity.h>
|
#include <gtsam_unstable/slam/InertialNavFactor_GlobalVelocity.h>
|
||||||
#include <gtsam/geometry/Pose3.h>
|
#include <gtsam/geometry/Pose3.h>
|
||||||
#include <gtsam/nonlinear/Values.h>
|
#include <gtsam/nonlinear/Values.h>
|
||||||
#include <gtsam/nonlinear/Key.h>
|
|
||||||
#include <gtsam/base/numericalDerivative.h>
|
#include <gtsam/base/numericalDerivative.h>
|
||||||
#include <gtsam/base/LieVector.h>
|
#include <gtsam/base/LieVector.h>
|
||||||
|
#include <gtsam/inference/Key.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace gtsam;
|
using namespace gtsam;
|
||||||
|
|
@ -32,7 +32,7 @@ gtsam::Rot3 world_R_ECEF(
|
||||||
0.85173, -0.52399, 0,
|
0.85173, -0.52399, 0,
|
||||||
0.41733, 0.67835, -0.60471);
|
0.41733, 0.67835, -0.60471);
|
||||||
|
|
||||||
gtsam::Vector ECEF_omega_earth((Vec(3) << 0.0, 0.0, 7.292115e-5));
|
gtsam::Vector ECEF_omega_earth((Vector(3) << 0.0, 0.0, 7.292115e-5));
|
||||||
gtsam::Vector world_omega_earth(world_R_ECEF.matrix() * ECEF_omega_earth);
|
gtsam::Vector world_omega_earth(world_R_ECEF.matrix() * ECEF_omega_earth);
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
@ -54,16 +54,16 @@ int main() {
|
||||||
gtsam::Key BiasKey1(31);
|
gtsam::Key BiasKey1(31);
|
||||||
|
|
||||||
double measurement_dt(0.1);
|
double measurement_dt(0.1);
|
||||||
Vector world_g((Vec(3) << 0.0, 0.0, 9.81));
|
Vector world_g((Vector(3) << 0.0, 0.0, 9.81));
|
||||||
Vector world_rho((Vec(3) << 0.0, -1.5724e-05, 0.0)); // NED system
|
Vector world_rho((Vector(3) << 0.0, -1.5724e-05, 0.0)); // NED system
|
||||||
gtsam::Vector ECEF_omega_earth((Vec(3) << 0.0, 0.0, 7.292115e-5));
|
gtsam::Vector ECEF_omega_earth((Vector(3) << 0.0, 0.0, 7.292115e-5));
|
||||||
gtsam::Vector world_omega_earth(world_R_ECEF.matrix() * ECEF_omega_earth);
|
gtsam::Vector world_omega_earth(world_R_ECEF.matrix() * ECEF_omega_earth);
|
||||||
|
|
||||||
SharedGaussian model(noiseModel::Isotropic::Sigma(9, 0.1));
|
SharedGaussian model(noiseModel::Isotropic::Sigma(9, 0.1));
|
||||||
|
|
||||||
// Second test: zero angular motion, some acceleration - generated in matlab
|
// Second test: zero angular motion, some acceleration - generated in matlab
|
||||||
Vector measurement_acc((Vec(3) << 6.501390843381716, -6.763926150509185, -2.300389940090343));
|
Vector measurement_acc((Vector(3) << 6.501390843381716, -6.763926150509185, -2.300389940090343));
|
||||||
Vector measurement_gyro((Vec(3) << 0.1, 0.2, 0.3));
|
Vector measurement_gyro((Vector(3) << 0.1, 0.2, 0.3));
|
||||||
|
|
||||||
InertialNavFactor_GlobalVelocity<Pose3, LieVector, imuBias::ConstantBias> f(PoseKey1, VelKey1, BiasKey1, PoseKey2, VelKey2, measurement_acc, measurement_gyro, measurement_dt, world_g, world_rho, world_omega_earth, model);
|
InertialNavFactor_GlobalVelocity<Pose3, LieVector, imuBias::ConstantBias> f(PoseKey1, VelKey1, BiasKey1, PoseKey2, VelKey2, measurement_acc, measurement_gyro, measurement_dt, world_g, world_rho, world_omega_earth, model);
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@ int main() {
|
||||||
-0.652537293, 0.709880342, 0.265075427);
|
-0.652537293, 0.709880342, 0.265075427);
|
||||||
Point3 t1(2.0,1.0,3.0);
|
Point3 t1(2.0,1.0,3.0);
|
||||||
Pose3 Pose1(R1, t1);
|
Pose3 Pose1(R1, t1);
|
||||||
LieVector Vel1(3,0.5,-0.5,0.4);
|
LieVector Vel1 = Vector((Vector(3) << 0.5,-0.5,0.4));
|
||||||
Rot3 R2(0.473618898, 0.119523052, 0.872582019,
|
Rot3 R2(0.473618898, 0.119523052, 0.872582019,
|
||||||
0.609241153, 0.67099888, -0.422594037,
|
0.609241153, 0.67099888, -0.422594037,
|
||||||
-0.636011287, 0.731761397, 0.244979388);
|
-0.636011287, 0.731761397, 0.244979388);
|
||||||
|
|
@ -99,7 +99,7 @@ int main() {
|
||||||
GaussianFactorGraph graph;
|
GaussianFactorGraph graph;
|
||||||
gttic_(LinearizeTiming);
|
gttic_(LinearizeTiming);
|
||||||
for(size_t i = 0; i < 100000; ++i) {
|
for(size_t i = 0; i < 100000; ++i) {
|
||||||
GaussianFactor::shared_ptr g = f.linearize(values, ordering);
|
GaussianFactor::shared_ptr g = f.linearize(values);
|
||||||
graph.push_back(g);
|
graph.push_back(g);
|
||||||
}
|
}
|
||||||
gttoc_(LinearizeTiming);
|
gttoc_(LinearizeTiming);
|
||||||
|
|
@ -14,16 +14,3 @@ if(MSVC)
|
||||||
set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/testSerializationSLAM.cpp"
|
set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/testSerializationSLAM.cpp"
|
||||||
APPEND PROPERTY COMPILE_FLAGS "/bigobj")
|
APPEND PROPERTY COMPILE_FLAGS "/bigobj")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Build timing scripts
|
|
||||||
if (GTSAM_BUILD_TIMING)
|
|
||||||
# Subdirectory target for timing - does not actually execute the scripts
|
|
||||||
add_custom_target(timing.tests)
|
|
||||||
set(is_test FALSE)
|
|
||||||
|
|
||||||
# Build grouped benchmarks
|
|
||||||
gtsam_add_grouped_scripts("tests" # Use subdirectory as group label
|
|
||||||
"time*.cpp" timing "Timing Benchmark" # Standard for all timing scripts
|
|
||||||
"${tests_full_libs}" "${tests_full_libs}" "${tests_exclude}" # Pass in linking and exclusion lists
|
|
||||||
${is_test})
|
|
||||||
endif (GTSAM_BUILD_TIMING)
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
gtsamAddTimingGlob("*.cpp" "" "gtsam")
|
||||||
|
|
||||||
|
target_link_libraries(timeGaussianFactorGraph CppUnitLite)
|
||||||
|
|
@ -27,11 +27,11 @@ int main()
|
||||||
{
|
{
|
||||||
int n = 100000;
|
int n = 100000;
|
||||||
|
|
||||||
const Pose3 pose1((Matrix)(Mat(3,3) <<
|
const Pose3 pose1(Matrix3((Matrix(3,3) <<
|
||||||
1., 0., 0.,
|
1., 0., 0.,
|
||||||
0.,-1., 0.,
|
0.,-1., 0.,
|
||||||
0., 0.,-1.
|
0., 0.,-1.
|
||||||
),
|
)),
|
||||||
Point3(0,0,0.5));
|
Point3(0,0,0.5));
|
||||||
|
|
||||||
const CalibratedCamera camera(pose1);
|
const CalibratedCamera camera(pose1);
|
||||||
|
|
@ -16,30 +16,29 @@
|
||||||
* @date Aug 20, 2010
|
* @date Aug 20, 2010
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <gtsam/base/timing.h>
|
||||||
|
#include <gtsam/linear/GaussianBayesNet.h>
|
||||||
#include <gtsam/linear/GaussianFactorGraph.h>
|
#include <gtsam/linear/GaussianFactorGraph.h>
|
||||||
#include <gtsam/linear/NoiseModel.h>
|
#include <gtsam/linear/NoiseModel.h>
|
||||||
#include <gtsam/inference/EliminationTree-inl.h>
|
#include <gtsam/linear/VectorValues.h>
|
||||||
|
|
||||||
#include <boost/random.hpp>
|
#include <boost/random.hpp>
|
||||||
#include <boost/timer.hpp>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
using namespace gtsam;
|
using namespace gtsam;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
typedef EliminationTree<GaussianFactor> GaussianEliminationTree;
|
|
||||||
|
|
||||||
static boost::variate_generator<boost::mt19937, boost::uniform_real<> > rg(boost::mt19937(), boost::uniform_real<>(0.0, 1.0));
|
static boost::variate_generator<boost::mt19937, boost::uniform_real<> > rg(boost::mt19937(), boost::uniform_real<>(0.0, 1.0));
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
Index key = 0;
|
Key key = 0;
|
||||||
|
|
||||||
size_t vardim = 2;
|
size_t vardim = 2;
|
||||||
size_t blockdim = 1;
|
size_t blockdim = 1;
|
||||||
size_t nBlocks = 2000;
|
size_t nBlocks = 4000;
|
||||||
|
|
||||||
size_t nTrials = 10;
|
size_t nTrials = 20;
|
||||||
|
|
||||||
double blockbuild, blocksolve, combbuild, combsolve;
|
double blockbuild, blocksolve, combbuild, combsolve;
|
||||||
|
|
||||||
|
|
@ -54,8 +53,7 @@ int main(int argc, char *argv[]) {
|
||||||
// Build GFG's
|
// Build GFG's
|
||||||
cout << "Building blockwise Gaussian factor graphs... ";
|
cout << "Building blockwise Gaussian factor graphs... ";
|
||||||
cout.flush();
|
cout.flush();
|
||||||
boost::timer timer;
|
gttic_(blockbuild);
|
||||||
timer.restart();
|
|
||||||
vector<GaussianFactorGraph> blockGfgs;
|
vector<GaussianFactorGraph> blockGfgs;
|
||||||
blockGfgs.reserve(nTrials);
|
blockGfgs.reserve(nTrials);
|
||||||
for(size_t trial=0; trial<nTrials; ++trial) {
|
for(size_t trial=0; trial<nTrials; ++trial) {
|
||||||
|
|
@ -70,22 +68,26 @@ int main(int argc, char *argv[]) {
|
||||||
Vector b(blockdim);
|
Vector b(blockdim);
|
||||||
for(size_t j=0; j<blockdim; ++j)
|
for(size_t j=0; j<blockdim; ++j)
|
||||||
b(j) = rg();
|
b(j) = rg();
|
||||||
blockGfgs[trial].push_back(JacobianFactor::shared_ptr(new JacobianFactor(key, A, b, noise)));
|
blockGfgs[trial].push_back(boost::make_shared<JacobianFactor>(key, A, b, noise));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
blockbuild = timer.elapsed();
|
gttoc_(blockbuild);
|
||||||
|
tictoc_getNode(blockbuildNode, blockbuild);
|
||||||
|
blockbuild = blockbuildNode->secs();
|
||||||
cout << blockbuild << " s" << endl;
|
cout << blockbuild << " s" << endl;
|
||||||
|
|
||||||
// Solve GFG's
|
// Solve GFG's
|
||||||
cout << "Solving blockwise Gaussian factor graphs... ";
|
cout << "Solving blockwise Gaussian factor graphs... ";
|
||||||
cout.flush();
|
cout.flush();
|
||||||
timer.restart();
|
gttic_(blocksolve);
|
||||||
for(size_t trial=0; trial<nTrials; ++trial) {
|
for(size_t trial=0; trial<nTrials; ++trial) {
|
||||||
// cout << "Trial " << trial << endl;
|
// cout << "Trial " << trial << endl;
|
||||||
GaussianBayesNet::shared_ptr gbn(GaussianEliminationTree::Create(blockGfgs[trial])->eliminate(&EliminateQR));
|
GaussianBayesNet::shared_ptr gbn = blockGfgs[trial].eliminateSequential();
|
||||||
VectorValues soln(optimize(*gbn));
|
VectorValues soln = gbn->optimize();
|
||||||
}
|
}
|
||||||
blocksolve = timer.elapsed();
|
gttoc_(blocksolve);
|
||||||
|
tictoc_getNode(blocksolveNode, blocksolve);
|
||||||
|
blocksolve = blocksolveNode->secs();
|
||||||
cout << blocksolve << " s" << endl;
|
cout << blocksolve << " s" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -97,8 +99,7 @@ int main(int argc, char *argv[]) {
|
||||||
// Build GFG's
|
// Build GFG's
|
||||||
cout << "Building combined-factor Gaussian factor graphs... ";
|
cout << "Building combined-factor Gaussian factor graphs... ";
|
||||||
cout.flush();
|
cout.flush();
|
||||||
boost::timer timer;
|
gttic_(combbuild);
|
||||||
timer.restart();
|
|
||||||
vector<GaussianFactorGraph> combGfgs;
|
vector<GaussianFactorGraph> combGfgs;
|
||||||
for(size_t trial=0; trial<nTrials; ++trial) {
|
for(size_t trial=0; trial<nTrials; ++trial) {
|
||||||
combGfgs.push_back(GaussianFactorGraph());
|
combGfgs.push_back(GaussianFactorGraph());
|
||||||
|
|
@ -115,21 +116,25 @@ int main(int argc, char *argv[]) {
|
||||||
for(size_t j=0; j<blockdim; ++j)
|
for(size_t j=0; j<blockdim; ++j)
|
||||||
bcomb(blockdim*i+j) = rg();
|
bcomb(blockdim*i+j) = rg();
|
||||||
}
|
}
|
||||||
combGfgs[trial].push_back(JacobianFactor::shared_ptr(new JacobianFactor(key, Acomb, bcomb,
|
combGfgs[trial].push_back(boost::make_shared<JacobianFactor>(key, Acomb, bcomb,
|
||||||
noiseModel::Isotropic::Sigma(blockdim*nBlocks, 1.0))));
|
noiseModel::Isotropic::Sigma(blockdim*nBlocks, 1.0)));
|
||||||
}
|
}
|
||||||
combbuild = timer.elapsed();
|
gttoc(combbuild);
|
||||||
|
tictoc_getNode(combbuildNode, combbuild);
|
||||||
|
combbuild = combbuildNode->secs();
|
||||||
cout << combbuild << " s" << endl;
|
cout << combbuild << " s" << endl;
|
||||||
|
|
||||||
// Solve GFG's
|
// Solve GFG's
|
||||||
cout << "Solving combined-factor Gaussian factor graphs... ";
|
cout << "Solving combined-factor Gaussian factor graphs... ";
|
||||||
cout.flush();
|
cout.flush();
|
||||||
timer.restart();
|
gttic_(combsolve);
|
||||||
for(size_t trial=0; trial<nTrials; ++trial) {
|
for(size_t trial=0; trial<nTrials; ++trial) {
|
||||||
GaussianBayesNet::shared_ptr gbn(GaussianEliminationTree::Create(combGfgs[trial])->eliminate(&EliminateQR));
|
GaussianBayesNet::shared_ptr gbn = combGfgs[trial].eliminateSequential();
|
||||||
VectorValues soln(optimize(*gbn));
|
VectorValues soln = gbn->optimize();
|
||||||
}
|
}
|
||||||
combsolve = timer.elapsed();
|
gttoc_(combsolve);
|
||||||
|
tictoc_getNode(combsolveNode, combsolve);
|
||||||
|
combsolve = combsolveNode->secs();
|
||||||
cout << combsolve << " s" << endl;
|
cout << combsolve << " s" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
#include <boost/assign/std/list.hpp> // for operator += in Ordering
|
#include <boost/assign/list_of.hpp>
|
||||||
|
|
||||||
#include <gtsam/base/Matrix.h>
|
#include <gtsam/base/Matrix.h>
|
||||||
#include <gtsam/linear/JacobianFactor.h>
|
#include <gtsam/linear/JacobianFactor.h>
|
||||||
|
|
@ -33,7 +33,7 @@ using namespace std;
|
||||||
using namespace gtsam;
|
using namespace gtsam;
|
||||||
using namespace boost::assign;
|
using namespace boost::assign;
|
||||||
|
|
||||||
static const Index _x1_=1, _x2_=2, _l1_=3;
|
static const Key _x1_=1, _x2_=2, _l1_=3;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Alex's Machine
|
* Alex's Machine
|
||||||
|
|
@ -53,7 +53,7 @@ static const Index _x1_=1, _x2_=2, _l1_=3;
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
// create a linear factor
|
// create a linear factor
|
||||||
Matrix Ax2 = (Mat(8, 2) <<
|
Matrix Ax2 = (Matrix(8, 2) <<
|
||||||
// x2
|
// x2
|
||||||
-5., 0.,
|
-5., 0.,
|
||||||
+0.,-5.,
|
+0.,-5.,
|
||||||
|
|
@ -65,7 +65,7 @@ int main()
|
||||||
+0.,10.
|
+0.,10.
|
||||||
);
|
);
|
||||||
|
|
||||||
Matrix Al1 = (Mat(8, 10) <<
|
Matrix Al1 = (Matrix(8, 10) <<
|
||||||
// l1
|
// l1
|
||||||
5., 0.,1.,2.,3.,4.,5.,6.,7.,8.,
|
5., 0.,1.,2.,3.,4.,5.,6.,7.,8.,
|
||||||
0., 5.,1.,2.,3.,4.,5.,6.,7.,8.,
|
0., 5.,1.,2.,3.,4.,5.,6.,7.,8.,
|
||||||
|
|
@ -77,7 +77,7 @@ int main()
|
||||||
0., 0.,1.,2.,3.,4.,5.,6.,7.,8.
|
0., 0.,1.,2.,3.,4.,5.,6.,7.,8.
|
||||||
);
|
);
|
||||||
|
|
||||||
Matrix Ax1 = (Mat(8, 2) <<
|
Matrix Ax1 = (Matrix(8, 2) <<
|
||||||
// x1
|
// x1
|
||||||
0.00, 0.,1.,2.,3.,4.,5.,6.,7.,8.,
|
0.00, 0.,1.,2.,3.,4.,5.,6.,7.,8.,
|
||||||
0.00, 0.,1.,2.,3.,4.,5.,6.,7.,8.,
|
0.00, 0.,1.,2.,3.,4.,5.,6.,7.,8.,
|
||||||
|
|
@ -108,7 +108,8 @@ int main()
|
||||||
JacobianFactor::shared_ptr factor;
|
JacobianFactor::shared_ptr factor;
|
||||||
|
|
||||||
for(int i = 0; i < n; i++)
|
for(int i = 0; i < n; i++)
|
||||||
conditional = JacobianFactor(combined).eliminateFirst();
|
boost::tie(conditional, factor) =
|
||||||
|
JacobianFactor(combined).eliminate(Ordering(boost::assign::list_of(_x2_)));
|
||||||
|
|
||||||
long timeLog2 = clock();
|
long timeLog2 = clock();
|
||||||
double seconds = (double)(timeLog2-timeLog)/CLOCKS_PER_SEC;
|
double seconds = (double)(timeLog2-timeLog)/CLOCKS_PER_SEC;
|
||||||
|
|
@ -29,10 +29,10 @@ using namespace boost::assign;
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
// Create a Kalman smoother for t=1:T and optimize
|
// Create a Kalman smoother for t=1:T and optimize
|
||||||
double timeKalmanSmoother(int T) {
|
double timeKalmanSmoother(int T) {
|
||||||
pair<GaussianFactorGraph,Ordering> smoother_ordering = createSmoother(T);
|
GaussianFactorGraph smoother = createSmoother(T);
|
||||||
GaussianFactorGraph& smoother(smoother_ordering.first);
|
|
||||||
clock_t start = clock();
|
clock_t start = clock();
|
||||||
GaussianSequentialSolver(smoother).optimize();
|
// Keys will come out sorted since keys() returns a set
|
||||||
|
smoother.optimize(Ordering(smoother.keys()));
|
||||||
clock_t end = clock ();
|
clock_t end = clock ();
|
||||||
double dif = (double)(end - start) / CLOCKS_PER_SEC;
|
double dif = (double)(end - start) / CLOCKS_PER_SEC;
|
||||||
return dif;
|
return dif;
|
||||||
|
|
@ -40,12 +40,10 @@ double timeKalmanSmoother(int T) {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
// Create a planar factor graph and optimize
|
// Create a planar factor graph and optimize
|
||||||
// todo: use COLAMD ordering again (removed when linear baked-in ordering added)
|
|
||||||
double timePlanarSmoother(int N, bool old = true) {
|
double timePlanarSmoother(int N, bool old = true) {
|
||||||
boost::tuple<GaussianFactorGraph, VectorValues> pg = planarGraph(N);
|
GaussianFactorGraph fg = planarGraph(N).get<0>();
|
||||||
GaussianFactorGraph& fg(pg.get<0>());
|
|
||||||
clock_t start = clock();
|
clock_t start = clock();
|
||||||
GaussianSequentialSolver(fg).optimize();
|
fg.optimize();
|
||||||
clock_t end = clock ();
|
clock_t end = clock ();
|
||||||
double dif = (double)(end - start) / CLOCKS_PER_SEC;
|
double dif = (double)(end - start) / CLOCKS_PER_SEC;
|
||||||
return dif;
|
return dif;
|
||||||
|
|
@ -53,12 +51,10 @@ double timePlanarSmoother(int N, bool old = true) {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
// Create a planar factor graph and eliminate
|
// Create a planar factor graph and eliminate
|
||||||
// todo: use COLAMD ordering again (removed when linear baked-in ordering added)
|
|
||||||
double timePlanarSmootherEliminate(int N, bool old = true) {
|
double timePlanarSmootherEliminate(int N, bool old = true) {
|
||||||
boost::tuple<GaussianFactorGraph, VectorValues> pg = planarGraph(N);
|
GaussianFactorGraph fg = planarGraph(N).get<0>();
|
||||||
GaussianFactorGraph& fg(pg.get<0>());
|
|
||||||
clock_t start = clock();
|
clock_t start = clock();
|
||||||
GaussianSequentialSolver(fg).eliminate();
|
fg.eliminateMultifrontal();
|
||||||
clock_t end = clock ();
|
clock_t end = clock ();
|
||||||
double dif = (double)(end - start) / CLOCKS_PER_SEC;
|
double dif = (double)(end - start) / CLOCKS_PER_SEC;
|
||||||
return dif;
|
return dif;
|
||||||
|
|
@ -189,7 +189,7 @@ double timeColumn(size_t reps) {
|
||||||
*/
|
*/
|
||||||
double timeHouseholder(size_t reps) {
|
double timeHouseholder(size_t reps) {
|
||||||
// create a matrix
|
// create a matrix
|
||||||
Matrix Abase = Mat(4, 7) <<
|
Matrix Abase = (Matrix(4, 7) <<
|
||||||
-5, 0, 5, 0, 0, 0, -1,
|
-5, 0, 5, 0, 0, 0, -1,
|
||||||
00, -5, 0, 5, 0, 0, 1.5,
|
00, -5, 0, 5, 0, 0, 1.5,
|
||||||
10, 0, 0, 0,-10, 0, 2,
|
10, 0, 0, 0,-10, 0, 2,
|
||||||
|
|
@ -28,7 +28,7 @@ int main()
|
||||||
{
|
{
|
||||||
int n = 1000000;
|
int n = 1000000;
|
||||||
|
|
||||||
const Pose3 pose1((Matrix)(Mat(3,3) <<
|
const Pose3 pose1((Matrix)(Matrix(3,3) <<
|
||||||
1., 0., 0.,
|
1., 0., 0.,
|
||||||
0.,-1., 0.,
|
0.,-1., 0.,
|
||||||
0., 0.,-1.
|
0., 0.,-1.
|
||||||
|
|
@ -58,7 +58,7 @@ Pose2 Pose2betweenOptimized(const Pose2& r1, const Pose2& r2,
|
||||||
if (H1) {
|
if (H1) {
|
||||||
double dt1 = -s2 * x + c2 * y;
|
double dt1 = -s2 * x + c2 * y;
|
||||||
double dt2 = -c2 * x - s2 * y;
|
double dt2 = -c2 * x - s2 * y;
|
||||||
*H1 = (Mat(3,3) <<
|
*H1 = (Matrix(3,3) <<
|
||||||
-c, -s, dt1,
|
-c, -s, dt1,
|
||||||
s, -c, dt2,
|
s, -c, dt2,
|
||||||
0.0, 0.0,-1.0);
|
0.0, 0.0,-1.0);
|
||||||
|
|
@ -37,8 +37,8 @@ int main()
|
||||||
|
|
||||||
double norm=sqrt(1.0+16.0+4.0);
|
double norm=sqrt(1.0+16.0+4.0);
|
||||||
double x=1.0/norm, y=4.0/norm, z=2.0/norm;
|
double x=1.0/norm, y=4.0/norm, z=2.0/norm;
|
||||||
Vector v = (Vec(6) << x, y, z, 0.1, 0.2, -0.1);
|
Vector v = (Vector(6) << x, y, z, 0.1, 0.2, -0.1);
|
||||||
Pose3 T = Pose3::Expmap((Vec(6) << 0.1, 0.1, 0.2, 0.1, 0.4, 0.2)), T2 = T.retract(v);
|
Pose3 T = Pose3::Expmap((Vector(6) << 0.1, 0.1, 0.2, 0.1, 0.4, 0.2)), T2 = T.retract(v);
|
||||||
Matrix H1,H2;
|
Matrix H1,H2;
|
||||||
|
|
||||||
TEST(retract, T.retract(v))
|
TEST(retract, T.retract(v))
|
||||||
|
|
@ -27,7 +27,7 @@ int main()
|
||||||
{
|
{
|
||||||
int n = 100000;
|
int n = 100000;
|
||||||
|
|
||||||
const Pose3 pose1((Matrix)(Mat(3,3) <<
|
const Pose3 pose1((Matrix)(Matrix(3,3) <<
|
||||||
1., 0., 0.,
|
1., 0., 0.,
|
||||||
0.,-1., 0.,
|
0.,-1., 0.,
|
||||||
0., 0.,-1.
|
0., 0.,-1.
|
||||||
Loading…
Reference in New Issue