excluding some examples and moved index_sequence implementation to gtsam namespace
parent
fc05618907
commit
2eecfe382b
|
@ -4,10 +4,17 @@ set (excluded_examples
|
||||||
|
|
||||||
# if GTSAM_ENABLE_BOOST_SERIALIZATION is not set then SolverComparer.cpp will not compile
|
# if GTSAM_ENABLE_BOOST_SERIALIZATION is not set then SolverComparer.cpp will not compile
|
||||||
if (NOT GTSAM_ENABLE_BOOST_SERIALIZATION)
|
if (NOT GTSAM_ENABLE_BOOST_SERIALIZATION)
|
||||||
set (excluded_examples
|
list (APPEND excluded_examples
|
||||||
${excluded_examples}
|
|
||||||
SolverComparer.cpp
|
SolverComparer.cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Add examples to exclude if GTSAM_USE_BOOST is not set
|
||||||
|
if (NOT GTSAM_USE_BOOST)
|
||||||
|
# add to excluded examples
|
||||||
|
list (APPEND excluded_examples
|
||||||
|
# Boost examples
|
||||||
|
SolverComparer.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
gtsamAddExamplesGlob("*.cpp" "${excluded_examples}" "gtsam;gtsam_unstable;${Boost_PROGRAM_OPTIONS_LIBRARY}")
|
gtsamAddExamplesGlob("*.cpp" "${excluded_examples}" "gtsam;gtsam_unstable;${Boost_PROGRAM_OPTIONS_LIBRARY}")
|
||||||
|
|
|
@ -28,16 +28,9 @@ private:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// boost::index_sequence was introduced in 1.66, so we'll manually define an
|
namespace gtsam {
|
||||||
// implementation if user has 1.65. boost::index_sequence is used to get array
|
|
||||||
// indices that align with a parameter pack.
|
|
||||||
#include <boost/version.hpp>
|
|
||||||
#if BOOST_VERSION >= 106600
|
|
||||||
#include <boost/mp11/integer_sequence.hpp>
|
|
||||||
#else
|
|
||||||
namespace boost {
|
|
||||||
namespace mp11 {
|
|
||||||
// Adapted from https://stackoverflow.com/a/32223343/9151520
|
// Adapted from https://stackoverflow.com/a/32223343/9151520
|
||||||
|
// An adaptation of boost::mp11::index_sequence
|
||||||
template <size_t... Ints>
|
template <size_t... Ints>
|
||||||
struct index_sequence {
|
struct index_sequence {
|
||||||
using type = index_sequence;
|
using type = index_sequence;
|
||||||
|
@ -49,13 +42,11 @@ template <class Sequence1, class Sequence2>
|
||||||
struct _merge_and_renumber;
|
struct _merge_and_renumber;
|
||||||
|
|
||||||
template <size_t... I1, size_t... I2>
|
template <size_t... I1, size_t... I2>
|
||||||
struct _merge_and_renumber<index_sequence<I1...>, index_sequence<I2...> >
|
struct _merge_and_renumber<index_sequence<I1...>, index_sequence<I2...>>
|
||||||
: index_sequence<I1..., (sizeof...(I1) + I2)...> {};
|
: index_sequence<I1..., (sizeof...(I1) + I2)...> {};
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
struct make_index_sequence
|
struct make_index_sequence : detail::_merge_and_renumber<typename make_index_sequence<N / 2>::type,
|
||||||
: detail::_merge_and_renumber<
|
|
||||||
typename make_index_sequence<N / 2>::type,
|
|
||||||
typename make_index_sequence<N - N / 2>::type> {};
|
typename make_index_sequence<N - N / 2>::type> {};
|
||||||
template <>
|
template <>
|
||||||
struct make_index_sequence<0> : index_sequence<> {};
|
struct make_index_sequence<0> : index_sequence<> {};
|
||||||
|
@ -63,6 +54,4 @@ template <>
|
||||||
struct make_index_sequence<1> : index_sequence<0> {};
|
struct make_index_sequence<1> : index_sequence<0> {};
|
||||||
template <class... T>
|
template <class... T>
|
||||||
using index_sequence_for = make_index_sequence<sizeof...(T)>;
|
using index_sequence_for = make_index_sequence<sizeof...(T)>;
|
||||||
} // namespace mp11
|
} // namespace gtsam
|
||||||
} // namespace boost
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <gtsam/linear/JacobianFactor.h>
|
#include <gtsam/linear/JacobianFactor.h>
|
||||||
#include <gtsam/inference/Factor.h>
|
#include <gtsam/inference/Factor.h>
|
||||||
#include <gtsam/base/OptionalJacobian.h>
|
#include <gtsam/base/OptionalJacobian.h>
|
||||||
#include <gtsam/base/utilities.h> // boost::index_sequence
|
#include <gtsam/base/utilities.h>
|
||||||
|
|
||||||
#ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
|
#ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
|
||||||
#include <boost/serialization/base_object.hpp>
|
#include <boost/serialization/base_object.hpp>
|
||||||
|
@ -609,7 +609,7 @@ protected:
|
||||||
Vector unwhitenedError(
|
Vector unwhitenedError(
|
||||||
const Values& x,
|
const Values& x,
|
||||||
OptionalMatrixVecType H = nullptr) const override {
|
OptionalMatrixVecType H = nullptr) const override {
|
||||||
return unwhitenedError(boost::mp11::index_sequence_for<ValueTypes...>{}, x,
|
return unwhitenedError(gtsam::index_sequence_for<ValueTypes...>{}, x,
|
||||||
H);
|
H);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,7 +702,7 @@ protected:
|
||||||
*/
|
*/
|
||||||
template <std::size_t... Indices>
|
template <std::size_t... Indices>
|
||||||
inline Vector unwhitenedError(
|
inline Vector unwhitenedError(
|
||||||
boost::mp11::index_sequence<Indices...>, //
|
gtsam::index_sequence<Indices...>, //
|
||||||
const Values& x,
|
const Values& x,
|
||||||
OptionalMatrixVecType H = nullptr) const {
|
OptionalMatrixVecType H = nullptr) const {
|
||||||
if (this->active(x)) {
|
if (this->active(x)) {
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
set (excluded_examples
|
# disable tests if GTSAM_USE_BOOST_FEATURES is OFF
|
||||||
|
if (NOT GTSAM_USE_BOOST_FEATURES)
|
||||||
|
set (excluded_examples
|
||||||
# fileToExclude.cpp
|
# fileToExclude.cpp
|
||||||
)
|
"schedulingExample.cpp"
|
||||||
|
"schedulingQuals12.cpp"
|
||||||
|
"schedulingQuals13.cpp"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set (excluded_examples "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gtsamAddExamplesGlob("*.cpp" "${excluded_examples}" "gtsam_unstable")
|
gtsamAddExamplesGlob("*.cpp" "${excluded_examples}" "gtsam_unstable")
|
||||||
|
|
|
@ -1,13 +1,3 @@
|
||||||
# disable tests if GTSAM_USE_BOOST_FEATURES is OFF
|
set (excluded_examples "")
|
||||||
if (NOT GTSAM_USE_BOOST_FEATURES)
|
|
||||||
set (excluded_examples
|
|
||||||
# fileToExclude.cpp
|
|
||||||
"schedulingExample.cpp"
|
|
||||||
"schedulingQuals12.cpp"
|
|
||||||
"schedulingQuals13.cpp"
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
set (excluded_examples "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
gtsamAddExamplesGlob("*.cpp" "${excluded_examples}" "gtsam_unstable")
|
gtsamAddExamplesGlob("*.cpp" "${excluded_examples}" "gtsam_unstable")
|
||||||
|
|
Loading…
Reference in New Issue