diff --git a/.cproject b/.cproject
index 5916e18da..c81094465 100644
--- a/.cproject
+++ b/.cproject
@@ -362,6 +362,14 @@
truetrue
+
+ make
+ -j2
+ testGaussianFactor.run
+ true
+ true
+ true
+ make-j2
@@ -388,7 +396,6 @@
make
- tests/testBayesTree.runtruefalse
@@ -396,7 +403,6 @@
make
- testBinaryBayesNet.runtruefalse
@@ -444,7 +450,6 @@
make
- testSymbolicBayesNet.runtruefalse
@@ -452,7 +457,6 @@
make
- tests/testSymbolicFactor.runtruefalse
@@ -460,7 +464,6 @@
make
- testSymbolicFactorGraph.runtruefalse
@@ -476,20 +479,11 @@
make
- tests/testBayesTreetruefalsetrue
-
- make
- -j2
- testGaussianFactor.run
- true
- true
- true
- make-j2
@@ -516,6 +510,7 @@
make
+ testGraph.runtruefalse
@@ -587,6 +582,7 @@
make
+ testInference.runtruefalse
@@ -594,6 +590,7 @@
make
+ testGaussianFactor.runtruefalse
@@ -601,6 +598,7 @@
make
+ testJunctionTree.runtruefalse
@@ -608,6 +606,7 @@
make
+ testSymbolicBayesNet.runtruefalse
@@ -615,6 +614,7 @@
make
+ testSymbolicFactorGraph.runtruefalse
@@ -684,22 +684,6 @@
falsetrue
-
- make
- -j2
- tests/testPose2.run
- true
- true
- true
-
-
- make
- -j2
- tests/testPose3.run
- true
- true
- true
- make-j2
@@ -716,6 +700,22 @@
truetrue
+
+ make
+ -j2
+ tests/testPose2.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ tests/testPose3.run
+ true
+ true
+ true
+ make-j2
@@ -740,26 +740,18 @@
truetrue
-
+ make
- -j2
- all
+ -j5
+ nonlinear.testValues.runtruetruetrue
-
+ make
- -j2
- check
- true
- true
- true
-
-
- make
- -j2
- clean
+ -j5
+ nonlinear.testOrdering.runtruetruetrue
@@ -796,18 +788,26 @@
truetrue
-
+ make
- -j5
- nonlinear.testValues.run
+ -j2
+ alltruetruetrue
-
+ make
- -j5
- nonlinear.testOrdering.run
+ -j2
+ check
+ true
+ true
+ true
+
+
+ make
+ -j2
+ cleantruetruetrue
@@ -844,30 +844,14 @@
truetrue
-
+ make
- -j2
- install
- true
- true
- true
-
-
- make
- -j2
+ -j5checktruetruetrue
-
- make
- -j2
- clean
- true
- true
- true
- make-j2
@@ -1044,14 +1028,6 @@
truetrue
-
- make
- -j2
- SimpleRotation.run
- true
- true
- true
- make-j2
@@ -1142,7 +1118,6 @@
make
- testErrors.runtruefalse
@@ -1598,6 +1573,7 @@
make
+ testSimulated2DOriented.runtruefalse
@@ -1637,6 +1613,7 @@
make
+ testSimulated2D.runtruefalse
@@ -1644,6 +1621,7 @@
make
+ testSimulated3D.runtruefalse
@@ -1657,6 +1635,14 @@
truetrue
+
+ make
+ -j5
+ testVector.run
+ true
+ true
+ true
+ make-j2
@@ -1817,6 +1803,14 @@
truetrue
+
+ make
+ -j5
+ UGM_small.run
+ true
+ true
+ true
+ make-j2
@@ -1827,6 +1821,7 @@
make
+ tests/testGaussianISAM2truefalse
@@ -1848,6 +1843,102 @@
truetrue
+
+ make
+ -j2
+ testRot3.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testRot2.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testPose3.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ timeRot3.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testPose2.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testCal3_S2.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testSimpleCamera.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testHomography2.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testCalibratedCamera.run
+ true
+ true
+ true
+
+
+ make
+ -j2
+ check
+ true
+ true
+ true
+
+
+ make
+ -j2
+ clean
+ true
+ true
+ true
+
+
+ make
+ -j2
+ testPoint2.run
+ true
+ true
+ true
+ make-j2
@@ -2031,98 +2122,134 @@
truetrue
-
+ make
- -j2
- testRot3.run
+ -j5
+ wrap_gtsamtruetruetrue
-
+ make
- -j2
- testRot2.run
+ VERBOSE=1
+ wrap_gtsam
+ true
+ false
+ true
+
+
+ cpack
+ -G DEB
+ true
+ false
+ true
+
+
+ cpack
+ -G RPM
+ true
+ false
+ true
+
+
+ cpack
+ -G TGZ
+ true
+ false
+ true
+
+
+ cpack
+ --config CPackSourceConfig.cmake
+ true
+ false
+ true
+
+
+ make
+ -j5
+ check.discretetruetruetrue
-
+ make
- -j2
- testPose3.run
+ -j5
+ wrap_gtsam_unstabletruetruetrue
-
+ make
- -j2
- timeRot3.run
+ -j5
+ check.wraptruetruetrue
-
+ make
- -j2
- testPose2.run
+ -j5
+ check.dynamics_unstabletruetruetrue
-
+ make
- -j2
- testCal3_S2.run
+ -j5
+ check.slam_unstabletruetruetrue
-
+ make
- -j2
- testSimpleCamera.run
+ -j5
+ check.base_unstabletruetruetrue
-
+ make
- -j2
- testHomography2.run
+ -j5
+ testSpirit.runtruetruetrue
-
+ make
- -j2
- testCalibratedCamera.run
+ -j5
+ testWrap.runtruetruetrue
-
+ make
- -j2
- check
+ -j5
+ check.wraptruetruetrue
-
+ make
- -j2
- clean
+ -j5
+ wrap_gtsamtruetruetrue
-
+ make
- -j2
- testPoint2.run
+ -j5
+ wraptruetruetrue
@@ -2166,46 +2293,6 @@
falsetrue
-
- make
- -j5
- wrap.testSpirit.run
- true
- true
- true
-
-
- make
- -j5
- wrap.testWrap.run
- true
- true
- true
-
-
- make
- -j5
- check.wrap
- true
- true
- true
-
-
- make
- -j5
- wrap_gtsam
- true
- true
- true
-
-
- make
- -j5
- wrap
- true
- true
- true
-
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ebfd16e5f..45f907e14 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,10 +7,10 @@ set (GTSAM_VERSION_MINOR 9)
set (GTSAM_VERSION_PATCH 0)
# Set the default install path to home
-set (CMAKE_INSTALL_PREFIX ${HOME} CACHE DOCSTRING "Install prefix for library")
+#set (CMAKE_INSTALL_PREFIX ${HOME} CACHE PATH "Install prefix for library")
# Use macros for creating tests/timing scripts
-set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
+set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake")
include(GtsamTesting)
include(GtsamPrinting)
@@ -19,12 +19,8 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. ")
endif()
-# Default to Debug mode
-if(NOT FIRST_PASS_DONE AND NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
- "Choose the type of build, options are: None Debug Release Timing Profiling RelWithDebInfo."
- FORCE)
-endif()
+# Load build type flags and default to Debug mode
+include(GtsamBuildTypes)
# Check build types
if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 2.8 OR ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_EQUAL 2.8)
@@ -41,33 +37,29 @@ if( NOT cmake_build_type_tolower STREQUAL ""
message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are None, Debug, Release, Timing, Profiling, RelWithDebInfo (case-insensitive).")
endif()
-# Add debugging flags but only on the first pass
-if(NOT FIRST_PASS_DONE)
- set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-inline -Wall" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-inline -Wall" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
- set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -fno-inline -Wall -DNDEBUG" CACHE STRING "Flags used by the compiler during relwithdebinfo builds." FORCE)
- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -fno-inline -Wall -DNDEBUG" CACHE STRING "Flags used by the compiler during relwithdebinfo builds." FORCE)
- set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wall" CACHE STRING "Flags used by the compiler during release builds." FORCE)
- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall" CACHE STRING "Flags used by the compiler during release builds." FORCE)
- set(CMAKE_C_FLAGS_TIMING "${CMAKE_C_FLAGS_RELEASE} -DENABLE_TIMING" CACHE STRING "Flags used by the compiler during timing builds." FORCE)
- set(CMAKE_CXX_FLAGS_TIMING "${CMAKE_CXX_FLAGS_RELEASE} -DENABLE_TIMING" CACHE STRING "Flags used by the compiler during timing builds." FORCE)
- mark_as_advanced(CMAKE_C_FLAGS_TIMING CMAKE_CXX_FLAGS_TIMING)
- set(CMAKE_C_FLAGS_PROFILING "-g -O2 -Wall -DNDEBUG" CACHE STRING "Flags used by the compiler during profiling builds." FORCE)
- set(CMAKE_CXX_FLAGS_PROFILING "-g -O2 -Wall -DNDEBUG" CACHE STRING "Flags used by the compiler during profiling builds." FORCE)
- mark_as_advanced(CMAKE_C_FLAGS_PROFILING CMAKE_CXX_FLAGS_PROFILING)
-endif()
-
# Configurable Options
-option(GTSAM_BUILD_TESTS "Enable/Disable building of tests" ON)
-option(GTSAM_BUILD_TIMING "Enable/Disable building of timing scripts" ON)
-option(GTSAM_BUILD_EXAMPLES "Enable/Disable building of examples" ON)
-option(GTSAM_BUILD_WRAP "Enable/Disable building of matlab wrap utility (necessary for matlab interface)" ON)
-option(GTSAM_USE_QUATERNIONS "Enable/Disable using an internal Quaternion representation for rotations instead of rotation matrices" OFF)
+option(GTSAM_BUILD_TESTS "Enable/Disable building of tests" ON)
+option(GTSAM_BUILD_TIMING "Enable/Disable building of timing scripts" ON)
+option(GTSAM_BUILD_EXAMPLES "Enable/Disable building of examples" ON)
+option(GTSAM_BUILD_UNSTABLE "Enable/Disable libgtsam_unstable" OFF)
+option(GTSAM_BUILD_WRAP "Enable/Disable building of matlab wrap utility (necessary for matlab interface)" ON)
+option(GTSAM_BUILD_SHARED_LIBRARY "Enable/Disable building of a shared version of gtsam" ON)
+option(GTSAM_BUILD_STATIC_LIBRARY "Enable/Disable building of a static version of gtsam" ON)
+option(GTSAM_USE_QUATERNIONS "Enable/Disable using an internal Quaternion representation for rotations instead of rotation matrices" OFF)
option(GTSAM_BUILD_CONVENIENCE_LIBRARIES "Enable/Disable use of convenience libraries for faster development rebuilds, but slower install" ON)
-option(GTSAM_INSTALL_MATLAB_TOOLBOX "Enable/Disable installation of matlab toolbox" ON)
-option(GTSAM_INSTALL_MATLAB_EXAMPLES "Enable/Disable installation of matlab examples" ON)
-option(GTSAM_INSTALL_MATLAB_TESTS "Enable/Disable installation of matlab tests" ON)
-option(GTSAM_INSTALL_WRAP "Enable/Disable installation of wrap utility" ON)
+option(GTSAM_INSTALL_MATLAB_TOOLBOX "Enable/Disable installation of matlab toolbox" ON)
+option(GTSAM_INSTALL_MATLAB_EXAMPLES "Enable/Disable installation of matlab examples" ON)
+option(GTSAM_INSTALL_MATLAB_TESTS "Enable/Disable installation of matlab tests" ON)
+option(GTSAM_INSTALL_WRAP "Enable/Disable installation of wrap utility" ON)
+
+# Flags for choosing default packaging tools
+set(CPACK_SOURCE_GENERATOR "TGZ" CACHE STRING "CPack Default Source Generator")
+set(CPACK_GENERATOR "TGZ" CACHE STRING "CPack Default Binary Generator")
+
+# Sanity check building of libraries
+if (NOT GTSAM_BUILD_SHARED_LIBRARY AND NOT GTSAM_BUILD_STATIC_LIBRARY)
+ message(FATAL_ERROR "Both shared and static version of GTSAM library disabled - need to choose at least one!")
+endif()
# Add the Quaternion Build Flag if requested
if (GTSAM_USE_QUATERNIONS)
@@ -80,6 +72,10 @@ endif(GTSAM_USE_QUATERNIONS)
# FIXME: can't add install dependencies, so libraries never get built
#set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE)
+# Alternative version to keep tests from building during make install
+# Use the EXCLUDE_FROM_ALL property on test executables
+option(GTSAM_ENABLE_INSTALL_TEST_FIX "Enable/Disable fix to remove dependency of tests on 'all' target" ON)
+
# Pull in infrastructure
if (GTSAM_BUILD_TESTS)
enable_testing()
@@ -87,10 +83,6 @@ if (GTSAM_BUILD_TESTS)
include(CTest)
endif()
-# Enable make check (http://www.cmake.org/Wiki/CMakeEmulateMakeCheck)
-add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
-add_custom_target(timing)
-
# Find boost
find_package(Boost 1.40 COMPONENTS serialization REQUIRED)
@@ -122,24 +114,52 @@ if (GTSAM_BUILD_EXAMPLES)
add_subdirectory(examples)
endif(GTSAM_BUILD_EXAMPLES)
-# Mark that first pass is done
-set(FIRST_PASS_DONE true CACHE BOOL "Internally used to mark whether cmake has been run multiple times")
-mark_as_advanced(FIRST_PASS_DONE)
+# Build gtsam_unstable
+if (GTSAM_BUILD_UNSTABLE)
+ add_subdirectory(gtsam_unstable)
+endif(GTSAM_BUILD_UNSTABLE)
+
+# Set up CPack
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GTSAM")
+set(CPACK_PACKAGE_VENDOR "Frank Dellaert, Georgia Institute of Technology")
+set(CPACK_PACKAGE_CONTACT "Frank Dellaert, dellaert@cc.gatech.edu")
+set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
+set(CPACK_PACKAGE_VERSION_MAJOR ${GTSAM_VERSION_MAJOR})
+set(CPACK_PACKAGE_VERSION_MINOR ${GTSAM_VERSION_MINOR})
+set(CPACK_PACKAGE_VERSION_PATCH ${GTSAM_VERSION_PATCH})
+set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
+set(CPACK_INSTALLED_DIRECTORIES "doc;.") # Include doc directory
+set(CPACK_SOURCE_IGNORE_FILES "/build;/\\\\.;/makedoc.sh$")
+set(CPACK_SOURCE_PACKAGE_FILE_NAME "gtsam-${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}")
+#set(CPACK_SOURCE_PACKAGE_FILE_NAME "gtsam-aspn${GTSAM_VERSION_PATCH}") # Used for creating ASPN tarballs
+
+# Record the root dir for gtsam - needed during external builds, e.g., ROS
+set(GTSAM_SOURCE_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+message(STATUS "GTSAM_SOURCE_ROOT_DIR: [${GTSAM_SOURCE_ROOT_DIR}]")
# print configuration variables
message(STATUS "===============================================================")
message(STATUS "================ Configuration Options ======================")
message(STATUS "Build flags ")
-print_config_flag(${GTSAM_BUILD_TIMING} "Build Timing scripts ")
-print_config_flag(${GTSAM_BUILD_EXAMPLES} "Build Examples ")
-print_config_flag(${GTSAM_BUILD_TESTS} "Build Tests ")
-print_config_flag(${GTSAM_BUILD_WRAP} "Build Wrap ")
-print_config_flag(${GTSAM_BUILD_CONVENIENCE_LIBRARIES} "Build Convenience Libraries")
+print_config_flag(${GTSAM_BUILD_TIMING} "Build Timing scripts ")
+print_config_flag(${GTSAM_BUILD_EXAMPLES} "Build Examples ")
+print_config_flag(${GTSAM_BUILD_TESTS} "Build Tests ")
+print_config_flag(${GTSAM_BUILD_WRAP} "Build Wrap ")
+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_CONVENIENCE_LIBRARIES} "Build Convenience Libraries ")
+print_config_flag(${GTSAM_BUILD_UNSTABLE} "Build libgtsam_unstable ")
+print_config_flag(${GTSAM_ENABLE_INSTALL_TEST_FIX} "Tests excluded from all target ")
string(TOUPPER "${CMAKE_BUILD_TYPE}" cmake_build_type_toupper)
message(STATUS " Build type : ${CMAKE_BUILD_TYPE}")
message(STATUS " C compilation flags : ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${cmake_build_type_toupper}}")
message(STATUS " C++ compilation flags : ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${cmake_build_type_toupper}}")
+message(STATUS "Packaging flags ")
+message(STATUS " CPack Source Generator : ${CPACK_SOURCE_GENERATOR}")
+message(STATUS " CPack Generator : ${CPACK_GENERATOR}")
+
message(STATUS "GTSAM flags ")
print_config_flag(${GTSAM_USE_QUATERNIONS} "Quaternions as default Rot3")
@@ -150,19 +170,5 @@ print_config_flag(${GTSAM_INSTALL_MATLAB_TESTS} "Install matlab tests
print_config_flag(${GTSAM_INSTALL_WRAP} "Install wrap utility ")
message(STATUS "===============================================================")
-# Set up CPack
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GTSAM")
-set(CPACK_PACKAGE_VENDOR "Frank Dellaert, Georgia Institute of Technology")
-set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
-set(CPACK_PACKAGE_VERSION_MAJOR ${GTSAM_VERSION_MAJOR})
-set(CPACK_PACKAGE_VERSION_MINOR ${GTSAM_VERSION_MINOR})
-set(CPACK_PACKAGE_VERSION_PATCH ${GTSAM_VERSION_PATCH})
-set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
-set(CPACK_INSTALLED_DIRECTORIES "doc" ".") # Include doc directory
-set(CPACK_SOURCE_IGNORE_FILES "/build;/\\\\.;/makedoc.sh$")
-set(CPACK_SOURCE_PACKAGE_FILE_NAME "gtsam-${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}")
-#set(CPACK_SOURCE_PACKAGE_FILE_NAME "gtsam-aspn${GTSAM_VERSION_PATCH}") # Used for creating ASPN tarballs
-set(CPACK_SOURCE_GENERATOR "TGZ")
-set(CPACK_GENERATOR "TGZ")
+# Include CPack *after* all flags
include(CPack)
diff --git a/CppUnitLite/SimpleString.cpp b/CppUnitLite/SimpleString.cpp
index 90356183a..19dc7f258 100644
--- a/CppUnitLite/SimpleString.cpp
+++ b/CppUnitLite/SimpleString.cpp
@@ -102,7 +102,7 @@ SimpleString StringFrom (long value)
SimpleString StringFrom (double value)
{
char buffer [DEFAULT_SIZE];
- sprintf (buffer, "%lf", value);
+ sprintf (buffer, "%lg", value);
return SimpleString(buffer);
}
diff --git a/Doxyfile b/Doxyfile
index 2ecf956f5..2bd88de6c 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -32,7 +32,7 @@ PROJECT_NAME = gtsam
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = 0.9.3
+PROJECT_NUMBER = 1.9.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer
@@ -641,10 +641,15 @@ WARN_LOGFILE =
INPUT = gtsam/base \
gtsam/geometry \
gtsam/inference \
+ gtsam/discrete \
gtsam/linear \
gtsam/nonlinear \
- gtsam/slam \
- gtsam
+ gtsam \
+ gtsam_unstable/slam \
+ gtsam_unstable/base \
+ gtsam_unstable/geometry \
+ gtsam_unstable/dynamics \
+ gtsam_unstable
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
diff --git a/README b/README
index 095d7b79c..595bbccf4 100644
--- a/README
+++ b/README
@@ -11,7 +11,10 @@ What is GTSAM ?
GTSAM is not (yet) open source: See COPYING & LICENSE
Please see USAGE for an example on how to use GTSAM.
-The code is organized according to the following directory structure:
+The core GTSAM code within the folder gtsam, with source, headers, and
+unit tests. After building, this will generate a single library "libgtsam"
+
+The libgtsam code is organized according to the following directory structure:
3rdparty local copies of third party libraries - Eigen3 and CCOLAMD
base provides some base Math and data structures, as well as test-related utilities
@@ -20,7 +23,13 @@ The code is organized according to the following directory structure:
linear inference specialized to Gaussian linear case, GaussianFactorGraph etc...
nonlinear non-linear factor graphs and non-linear optimization
slam SLAM and visual SLAM application code
-
+
+Additionally, in the SVN development version of GTSAM, there is an area for
+unstable code directly under development in the folder gtsam_unstable, which contains
+a directory structuring mirroring the libgtsam structure as necessary. This section produces
+a single library "libgtsam_unstable". Building of gtsam_unstable is disabled by default, see
+CMake configuration options for information on enabling building.
+
This library contains unchanged copies of two third party libraries, with documentation
of licensing in LICENSE and as follows:
- CCOLAMD 2.73: Tim Davis' constrained column approximate minimum degree ordering library
@@ -28,11 +37,10 @@ of licensing in LICENSE and as follows:
- Licenced under LGPL v2.1, provided in gtsam/3rdparty/CCOLAMD/Doc/lesser.txt
- Eigen 3.0.5: General C++ matrix and linear algebra library
- Licenced under LGPL v3, provided in gtsam/3rdparty/Eigen/COPYING.LGPL
-
-All of the above contain code and tests, and produce a single library libgtsam.
+
After this is built, you can also run the more involved tests, which test the entire library:
- tests more involved tests that depend on slam
+ tests More involved unit tests that depend on slam
examples Demo applications as a tutorial for using gtsam
cmake CMake scripts used within the library, as well as for finding GTSAM by dependent projects
@@ -158,6 +166,16 @@ $] cmake -DGTSAM_BUILD_CONVENIENCE_LIBRARIES:OPTION=ON ..
link all of the tests at once. This option is best for users of GTSAM,
as it avoids rebuilding the entirety of gtsam an extra time.
+GTSAM_BUILD_UNSTABLE: Enable build and install for libgtsam_unstable library.
+Set with the command line as follows:
+$] cmake -DGTSAM_BUILD_UNSTABLE:OPTION=ON ..
+ ON When enabled, libgtsam_unstable will be built and installed with the
+ same options as libgtsam. In addition, if tests are enabled, the
+ unit tests will be built as well. The Matlab toolbox will also
+ be generated if the matlab toolbox is enabled, installing into a
+ folder called "gtsam_unstable".
+ OFF (Default) If disabled, no gtsam_unstable code will be included in build or install.
+
CMAKE_BUILD_TYPE: We support several build configurations for GTSAM (case insensitive)
Debug (default) All error checking options on, no optimization. Use for development.
Release Optimizations turned on, no debug symbols.
@@ -176,12 +194,13 @@ Running "make install" will install the library to the prefix location.
Check
-As with autotools, "make check" will build and run all of the tests. You can also
-run "make timing" to build all of the timing scripts. To run check on a particular
-subsection, there is a convention of "make check.[subfolder]", so to run just the
-geometry tests, run "make check.geometry". Individual tests can be run by
-appending ".run" to the name of the test, for example, to run testMatrix,
-run "make testMatrix.run".
+As with autotools, "make check" will build and run all of the tests. Note that the
+tests will only be built when using the "check" targets, to prevent "make install" from
+building the tests unnecessarily. You can also run "make timing" to build all of
+the timing scripts. To run check on a particular subsection, there is a convention
+of "make check.[subfolder]", so to run just the geometry tests,
+run "make check.geometry". Individual tests can be run by appending ".run" to the
+name of the test, for example, to run testMatrix, run "make testMatrix.run".
The make target "wrap" will build the wrap binary, and the "wrap_gtsam" target will
generate code for the toolbox. By default, the toolbox will be created and installed
diff --git a/examples/Pose2SLAMExample_advanced.cpp b/examples/Pose2SLAMExample_advanced.cpp
index c495dba97..9cc8c2040 100644
--- a/examples/Pose2SLAMExample_advanced.cpp
+++ b/examples/Pose2SLAMExample_advanced.cpp
@@ -65,16 +65,16 @@ int main(int argc, char** argv) {
Ordering::shared_ptr ordering = graph->orderingCOLAMD(*initial);
/* 4.2.2 set up solver and optimize */
- LevenbergMarquardtParams params;
- params.relativeErrorTol = 1e-15;
- params.absoluteErrorTol = 1e-15;
- pose2SLAM::Values result = *LevenbergMarquardtOptimizer(graph, initial, params, ordering).optimized();
+ NonlinearOptimizationParameters::shared_ptr params = NonlinearOptimizationParameters::newDecreaseThresholds(1e-15, 1e-15);
+ Optimizer optimizer(graph, initial, ordering, params);
+ Optimizer optimizer_result = optimizer.levenbergMarquardt();
+
+ pose2SLAM::Values result = *optimizer_result.values();
result.print("final result");
/* Get covariances */
- GaussianMultifrontalSolver solver(*graph->linearize(result, *ordering));
- Matrix covariance1 = solver.marginalCovariance(ordering->at(PoseKey(1)));
- Matrix covariance2 = solver.marginalCovariance(ordering->at(PoseKey(1)));
+ Matrix covariance1 = optimizer_result.marginalCovariance(PoseKey(1));
+ Matrix covariance2 = optimizer_result.marginalCovariance(PoseKey(2));
print(covariance1, "Covariance1");
print(covariance2, "Covariance2");
diff --git a/examples/README b/examples/README
index 87368b2ef..d7706a0b8 100644
--- a/examples/README
+++ b/examples/README
@@ -26,4 +26,10 @@ Visual SLAM
The directory vSLAMexample includes 2 simple examples using GTSAM:
- vSFMexample using visualSLAM in for structure-from-motion (SFM), and
- vISAMexample using visualSLAM and ISAM for incremental SLAM updates
-See the separate README file there.
\ No newline at end of file
+See the separate README file there.
+
+Undirected Graphical Models (UGM)
+=================================
+The best representation for a Markov Random Field is a factor graph :-)
+This is illustrated with some discrete examples from the UGM MATLAB toolbox, which
+can be found at http://www.di.ens.fr/~mschmidt/Software/UGM
\ No newline at end of file
diff --git a/examples/UGM_small.cpp b/examples/UGM_small.cpp
new file mode 100644
index 000000000..a4655d2ad
--- /dev/null
+++ b/examples/UGM_small.cpp
@@ -0,0 +1,74 @@
+/* ----------------------------------------------------------------------------
+
+ * 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 small.cpp
+ * @brief UGM (undirected graphical model) examples: small
+ * @author Frank Dellaert
+ *
+ * See http://www.di.ens.fr/~mschmidt/Software/UGM/small.html
+ */
+
+#include
+#include
+
+using namespace std;
+using namespace gtsam;
+
+int main(int argc, char** argv) {
+
+ // We will assume 2-state variables, where, to conform to the "small" example
+ // we have 0 == "right answer" and 1 == "wrong answer"
+ size_t nrStates = 2;
+
+ // define variables
+ DiscreteKey Cathy(1, nrStates), Heather(2, nrStates), Mark(3, nrStates),
+ Allison(4, nrStates);
+
+ // create graph
+ DiscreteFactorGraph graph;
+
+ // add node potentials
+ graph.add(Cathy, "1 3");
+ graph.add(Heather, "9 1");
+ graph.add(Mark, "1 3");
+ graph.add(Allison, "9 1");
+
+ // add edge potentials
+ graph.add(Cathy & Heather, "2 1 1 2");
+ graph.add(Heather & Mark, "2 1 1 2");
+ graph.add(Mark & Allison, "2 1 1 2");
+
+ // Print the UGM distribution
+ cout << "\nUGM distribution:" << endl;
+ for (size_t a = 0; a < nrStates; a++)
+ for (size_t m = 0; m < nrStates; m++)
+ for (size_t h = 0; h < nrStates; h++)
+ for (size_t c = 0; c < nrStates; c++) {
+ DiscreteFactor::Values values;
+ values[1] = c;
+ values[2] = h;
+ values[3] = m;
+ values[4] = a;
+ double prodPot = graph(values);
+ cout << c << " " << h << " " << m << " " << a << " :\t"
+ << prodPot << "\t" << prodPot/3790 << endl;
+ }
+
+ // "Decoding", i.e., configuration with largest value
+ // We use sequential variable elimination
+ DiscreteSequentialSolver solver(graph);
+ DiscreteFactor::sharedValues optimalDecoding = solver.optimize();
+ optimalDecoding->print("\noptimalDecoding");
+
+ return 0;
+}
+
diff --git a/gtsam.h b/gtsam.h
index 26f3457c7..0e4d70e16 100644
--- a/gtsam.h
+++ b/gtsam.h
@@ -32,6 +32,9 @@
* Namespace usage
* - Namespaces can be specified for classes in arguments and return values
* - In each case, the namespace must be fully specified, e.g., "namespace1::namespace2::ClassName"
+ * Using namespace
+ * - To use a namespace (e.g., generate a "using namespace x" line in cpp files), add "using namespace x;"
+ * - This declaration applies to all classes *after* the declaration, regardless of brackets
* Methods must start with a lowercase letter
* Static methods must start with a letter (upper or lowercase) and use the "static" keyword
* Includes in C++ wrappers
diff --git a/gtsam/3rdparty/CMakeLists.txt b/gtsam/3rdparty/CMakeLists.txt
index 673411a58..8ee371fe8 100644
--- a/gtsam/3rdparty/CMakeLists.txt
+++ b/gtsam/3rdparty/CMakeLists.txt
@@ -1,10 +1,10 @@
# install CCOLAMD headers
-install(FILES CCOLAMD/Include/ccolamd.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/gtsam/3rdparty/CCOLAMD)
-install(FILES UFconfig/UFconfig.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/gtsam/3rdparty/UFconfig)
+install(FILES CCOLAMD/Include/ccolamd.h DESTINATION include/gtsam/3rdparty/CCOLAMD)
+install(FILES UFconfig/UFconfig.h DESTINATION include/gtsam/3rdparty/UFconfig)
# install Eigen - only the headers
install(DIRECTORY Eigen/Eigen
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/gtsam/3rdparty/Eigen
+ DESTINATION include/gtsam/3rdparty/Eigen
FILES_MATCHING PATTERN "*.h")
file(GLOB eigen_dir_headers_all "Eigen/Eigen/*")
@@ -12,6 +12,6 @@ file(GLOB eigen_dir_headers_all "Eigen/Eigen/*")
foreach(eigen_dir ${eigen_dir_headers_all})
get_filename_component(filename ${eigen_dir} NAME)
if (NOT ((${filename} MATCHES "CMakeLists.txt") OR (${filename} MATCHES "src") OR (${filename} MATCHES ".svn")))
- install(FILES Eigen/Eigen/${filename} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/gtsam/3rdparty/Eigen/Eigen)
+ install(FILES Eigen/Eigen/${filename} DESTINATION include/gtsam/3rdparty/Eigen/Eigen)
endif()
endforeach(eigen_dir)
diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt
index 0ca316b36..dcbd10075 100644
--- a/gtsam/CMakeLists.txt
+++ b/gtsam/CMakeLists.txt
@@ -4,6 +4,7 @@ set (gtsam_subdirs
base
geometry
inference
+ discrete
linear
nonlinear
slam
@@ -25,10 +26,24 @@ if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
add_library(ccolamd STATIC ${3rdparty_srcs})
endif()
+# Sources to remove from builds
+set (excluded_sources
+ "${CMAKE_CURRENT_SOURCE_DIR}/discrete/TypedDiscreteFactor.cpp"
+ "${CMAKE_CURRENT_SOURCE_DIR}/discrete/TypedDiscreteFactorGraph.cpp"
+ "${CMAKE_CURRENT_SOURCE_DIR}/discrete/parseUAI.cpp"
+ "${CMAKE_CURRENT_SOURCE_DIR}/discrete/PotentialTable.cpp")
+
+if(GTSAM_USE_QUATERNIONS)
+ set(excluded_sources ${excluded_sources} "${CMAKE_CURRENT_SOURCE_DIR}/geometry/Rot3M.cpp")
+else()
+ set(excluded_sources ${excluded_sources} "${CMAKE_CURRENT_SOURCE_DIR}/geometry/Rot3Q.cpp")
+endif()
+
# assemble core libaries
foreach(subdir ${gtsam_subdirs})
# Build convenience libraries
file(GLOB subdir_srcs "${subdir}/*.cpp")
+ list(REMOVE_ITEM subdir_srcs ${excluded_sources})
set(${subdir}_srcs ${subdir_srcs})
if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
message(STATUS "Building Convenience Library: ${subdir}")
@@ -46,13 +61,12 @@ set(gtsam_srcs
${base_srcs}
${geometry_srcs}
${inference_srcs}
+ ${discrete_srcs}
${linear_srcs}
${nonlinear_srcs}
${slam_srcs}
)
-option (GTSAM_BUILD_SHARED_LIBRARY "Enable/Disable building of a shared version of gtsam" ON)
-
# Versions
set(gtsam_version ${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH})
set(gtsam_soversion ${GTSAM_VERSION_MAJOR})
@@ -60,14 +74,16 @@ message(STATUS "GTSAM Version: ${gtsam_version}")
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
# build shared and static versions of the library
-message(STATUS "Building GTSAM - static")
-add_library(gtsam-static STATIC ${gtsam_srcs})
-set_target_properties(gtsam-static PROPERTIES
- OUTPUT_NAME gtsam
- CLEAN_DIRECT_OUTPUT 1
- VERSION ${gtsam_version}
- SOVERSION ${gtsam_soversion})
-install(TARGETS gtsam-static ARCHIVE DESTINATION lib)
+if (GTSAM_BUILD_STATIC_LIBRARY)
+ message(STATUS "Building GTSAM - static")
+ add_library(gtsam-static STATIC ${gtsam_srcs})
+ set_target_properties(gtsam-static PROPERTIES
+ OUTPUT_NAME gtsam
+ CLEAN_DIRECT_OUTPUT 1
+ VERSION ${gtsam_version}
+ SOVERSION ${gtsam_soversion})
+ install(TARGETS gtsam-static ARCHIVE DESTINATION lib)
+endif (GTSAM_BUILD_STATIC_LIBRARY)
if (GTSAM_BUILD_SHARED_LIBRARY)
message(STATUS "Building GTSAM - shared")
diff --git a/gtsam/base/DSFVector.cpp b/gtsam/base/DSFVector.cpp
deleted file mode 100644
index ceb33fc23..000000000
--- a/gtsam/base/DSFVector.cpp
+++ /dev/null
@@ -1,97 +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 DSFVector.cpp
- * @date Jun 25, 2010
- * @author Kai Ni
- * @brief a faster implementation for DSF, which uses vector rather than btree.
- */
-
-#include
-#include
-#include
-
-using namespace std;
-
-namespace gtsam {
-
- /* ************************************************************************* */
- DSFVector::DSFVector (const size_t numNodes) {
- v_ = boost::make_shared(numNodes);
- int index = 0;
- keys_.reserve(numNodes);
- for(V::iterator it = v_->begin(); it!=v_->end(); it++, index++) {
- *it = index;
- keys_.push_back(index);
- }
- }
-
- /* ************************************************************************* */
- DSFVector::DSFVector(const boost::shared_ptr& v_in, const std::vector& keys) : keys_(keys) {
- v_ = v_in;
- BOOST_FOREACH(const size_t key, keys)
- (*v_)[key] = key;
- }
-
- /* ************************************************************************* */
- bool DSFVector::isSingleton(const Label& label) const {
- bool result = false;
- V::const_iterator it = keys_.begin();
- for (; it != keys_.end(); ++it) {
- if(findSet(*it) == label) {
- if (!result) // find the first occurrence
- result = true;
- else
- return false;
- }
- }
- return result;
- }
-
- /* ************************************************************************* */
- std::set DSFVector::set(const Label& label) const {
- std::set set;
- V::const_iterator it = keys_.begin();
- for (; it != keys_.end(); it++) {
- if (findSet(*it) == label)
- set.insert(*it);
- }
- return set;
- }
-
- /* ************************************************************************* */
- std::map > DSFVector::sets() const {
- std::map