Merge branch 'svn/trunk'

Conflicts:
	CMakeLists.txt
release/4.3a0
Richard Roberts 2013-07-09 17:54:06 +00:00
commit b5c530d080
4 changed files with 32 additions and 15 deletions

View File

@ -114,13 +114,13 @@ endif()
option(GTSAM_DISABLE_NEW_TIMERS "Disables using Boost.chrono for timing" OFF) option(GTSAM_DISABLE_NEW_TIMERS "Disables using Boost.chrono for timing" OFF)
# Allow for not using the timer libraries on boost < 1.48 (GTSAM timing code falls back to old timer library) # Allow for not using the timer libraries on boost < 1.48 (GTSAM timing code falls back to old timer library)
set(GTSAM_BOOST_LIBRARIES ${Boost_SERIALIZATION_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}) set(GTSAM_BOOST_LIBRARIES ${Boost_SERIALIZATION_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_REGEX_LIBRARY})
if (GTSAM_DISABLE_NEW_TIMERS) if (GTSAM_DISABLE_NEW_TIMERS)
message("WARNING: GTSAM timing instrumentation manually disabled") message("WARNING: GTSAM timing instrumentation manually disabled")
add_definitions(-DGTSAM_DISABLE_NEW_TIMERS) add_definitions(-DGTSAM_DISABLE_NEW_TIMERS)
else() else()
if(Boost_TIMER_LIBRARY) if(Boost_TIMER_LIBRARY)
list(APPEND GTSAM_BOOST_LIBRARIES ${GTSAM_BOOST_LIBRARIES} ${Boost_TIMER_LIBRARY} ${Boost_CHRONO_LIBRARY}) list(APPEND GTSAM_BOOST_LIBRARIES ${Boost_TIMER_LIBRARY} ${Boost_CHRONO_LIBRARY})
else() else()
message("WARNING: Boost older than 1.48 was found, GTSAM timing instrumentation will use the older, less accurate, Boost timer library.") message("WARNING: Boost older than 1.48 was found, GTSAM timing instrumentation will use the older, less accurate, Boost timer library.")
endif() endif()
@ -174,16 +174,19 @@ endforeach()
############################################################################### ###############################################################################
# Global compile options # Global compile options
# General build settings # Include boost - use 'BEFORE' so that a specific boost specified to CMake
# takes precedence over a system-installed one.
include_directories(BEFORE ${TBB_INCLUDE_DIRS} ${Boost_INCLUDE_DIR})
# Add includes for source directories 'BEFORE' boost and any system include
# paths so that the compiler uses GTSAM headers in our source directory instead
# of any previously installed GTSAM headers.
include_directories(BEFORE include_directories(BEFORE
gtsam/3rdparty/UFconfig gtsam/3rdparty/UFconfig
gtsam/3rdparty/CCOLAMD/Include gtsam/3rdparty/CCOLAMD/Include
${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR} # So we can include generated config header files ${CMAKE_BINARY_DIR} # So we can include generated config header files
CppUnitLite CppUnitLite)
${TBB_INCLUDE_DIRS}
${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})
if(MSVC) if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
@ -291,9 +294,9 @@ print_config_flag(${GTSAM_BUILD_TESTS} "Build Tests
if (DOXYGEN_FOUND) if (DOXYGEN_FOUND)
print_config_flag(${GTSAM_BUILD_DOCS} "Build Docs ") print_config_flag(${GTSAM_BUILD_DOCS} "Build Docs ")
endif() endif()
if(NOT MSVC)
print_config_flag(${GTSAM_BUILD_SHARED_LIBRARY} "Build shared GTSAM Library ") print_config_flag(${GTSAM_BUILD_SHARED_LIBRARY} "Build shared GTSAM Library ")
print_config_flag(${GTSAM_BUILD_STATIC_LIBRARY} "Build static GTSAM Library ") print_config_flag(${GTSAM_BUILD_STATIC_LIBRARY} "Build static GTSAM Library ")
if(NOT MSVC)
print_config_flag(${GTSAM_BUILD_CONVENIENCE_LIBRARIES} "Build Convenience Libraries ") print_config_flag(${GTSAM_BUILD_CONVENIENCE_LIBRARIES} "Build Convenience Libraries ")
endif() endif()
print_config_flag(${GTSAM_BUILD_TYPE_POSTFIXES} "Put build-type in library name ") print_config_flag(${GTSAM_BUILD_TYPE_POSTFIXES} "Put build-type in library name ")

View File

@ -71,8 +71,6 @@ foreach(subdir ${gtsam_subdirs})
add_subdirectory(${subdir}) add_subdirectory(${subdir})
endforeach(subdir) endforeach(subdir)
message(STATUS "navigation_srcs: [${navigation_srcs}]")
# To add additional sources to gtsam when building the full library (static or shared) # To add additional sources to gtsam when building the full library (static or shared)
# Add the subfolder with _srcs appended to the end to this list # Add the subfolder with _srcs appended to the end to this list
set(gtsam_srcs set(gtsam_srcs

View File

@ -24,6 +24,7 @@
#include <gtsam/linear/JacobianFactor.h> #include <gtsam/linear/JacobianFactor.h>
#include <gtsam/linear/KalmanFilter.h> #include <gtsam/linear/KalmanFilter.h>
#include <gtsam/linear/HessianFactor.h> #include <gtsam/linear/HessianFactor.h>
#include <gtsam/inference/Permutation.h>
#include <gtsam/base/Testable.h> #include <gtsam/base/Testable.h>
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
@ -33,16 +34,31 @@ namespace gtsam {
using namespace std; using namespace std;
/// Auxiliary function to solve factor graph and return pointer to root conditional /// Auxiliary function to solve factor graph and return pointer to root conditional
KalmanFilter::State solve(const GaussianFactorGraph& factorGraph, KalmanFilter::State solve(const GaussianFactorGraph& factorGraph, bool useQR)
bool useQR) { {
// Start indices at zero
Index nVars = 0;
internal::Reduction remapping;
BOOST_FOREACH(const GaussianFactorGraph::sharedFactor& factor, factorGraph)
BOOST_FOREACH(Index j, *factor)
if(remapping.insert(make_pair(j, nVars)).second)
++ nVars;
Permutation inverseRemapping = remapping.inverse();
GaussianFactorGraph factorGraphOrdered(factorGraph); // NOTE this shares the factors with the original!!
factorGraphOrdered.reduceWithInverse(remapping);
// Solve the factor graph // Solve the factor graph
GaussianSequentialSolver solver(factorGraph, useQR); GaussianSequentialSolver solver(factorGraphOrdered, useQR);
GaussianBayesNet::shared_ptr bayesNet = solver.eliminate(); GaussianBayesNet::shared_ptr bayesNet = solver.eliminate();
// As this is a filter, all we need is the posterior P(x_t), // As this is a filter, all we need is the posterior P(x_t),
// so we just keep the root of the Bayes net // so we just keep the root of the Bayes net
GaussianConditional::shared_ptr conditional = bayesNet->back(); GaussianConditional::shared_ptr conditional = bayesNet->back();
// Undo the remapping
factorGraphOrdered.permuteWithInverse(inverseRemapping);
conditional->permuteWithInverse(inverseRemapping);
// TODO: awful ! A copy constructor followed by ANOTHER copy constructor in make_shared? // TODO: awful ! A copy constructor followed by ANOTHER copy constructor in make_shared?
return boost::make_shared<GaussianDensity>(*conditional); return boost::make_shared<GaussianDensity>(*conditional);
} }

View File

@ -10,7 +10,7 @@ set (gtsam_unstable_subdirs
slam slam
) )
set(GTSAM_UNSTABLE_BOOST_LIBRARIES ${GTSAM_BOOST_LIBRARIES} ${Boost_THREAD_LIBRARY}) set(GTSAM_UNSTABLE_BOOST_LIBRARIES ${GTSAM_BOOST_LIBRARIES})
add_custom_target(check.unstable COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure) add_custom_target(check.unstable COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)