Merge pull request #1138 from borglab/various-fixes
commit
4acbaa26e9
|
@ -191,7 +191,7 @@ endif()
|
||||||
|
|
||||||
if (NOT MSVC)
|
if (NOT MSVC)
|
||||||
option(GTSAM_BUILD_WITH_MARCH_NATIVE "Enable/Disable building with all instructions supported by native architecture (binary may not be portable!)" ON)
|
option(GTSAM_BUILD_WITH_MARCH_NATIVE "Enable/Disable building with all instructions supported by native architecture (binary may not be portable!)" ON)
|
||||||
if(GTSAM_BUILD_WITH_MARCH_NATIVE)
|
if(GTSAM_BUILD_WITH_MARCH_NATIVE AND (APPLE AND NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64"))
|
||||||
# Add as public flag so all dependant projects also use it, as required
|
# Add as public flag so all dependant projects also use it, as required
|
||||||
# by Eigen to avid crashes due to SIMD vectorization:
|
# by Eigen to avid crashes due to SIMD vectorization:
|
||||||
list_append_cache(GTSAM_COMPILE_OPTIONS_PUBLIC "-march=native")
|
list_append_cache(GTSAM_COMPILE_OPTIONS_PUBLIC "-march=native")
|
||||||
|
|
|
@ -786,7 +786,6 @@ namespace gtsam {
|
||||||
template <typename L, typename Y>
|
template <typename L, typename Y>
|
||||||
DecisionTree<L, Y> DecisionTree<L, Y>::apply(
|
DecisionTree<L, Y> DecisionTree<L, Y>::apply(
|
||||||
const UnaryAssignment& op) const {
|
const UnaryAssignment& op) const {
|
||||||
std::cout << "Calling the correct apply" << std::endl;
|
|
||||||
// It is unclear what should happen if tree is empty:
|
// It is unclear what should happen if tree is empty:
|
||||||
if (empty()) {
|
if (empty()) {
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
|
|
|
@ -462,7 +462,7 @@ TEST(DecisionTree, ApplyWithAssignment) {
|
||||||
|
|
||||||
DecisionTree<string, double> probTree(
|
DecisionTree<string, double> probTree(
|
||||||
keys, "0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08");
|
keys, "0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08");
|
||||||
double threshold = 0.035;
|
double threshold = 0.045;
|
||||||
|
|
||||||
// We test pruning one tree by indexing into another.
|
// We test pruning one tree by indexing into another.
|
||||||
auto pruner = [&](const Assignment<string>& choices, const int& x) {
|
auto pruner = [&](const Assignment<string>& choices, const int& x) {
|
||||||
|
@ -475,8 +475,18 @@ TEST(DecisionTree, ApplyWithAssignment) {
|
||||||
};
|
};
|
||||||
DT prunedTree = tree.apply(pruner);
|
DT prunedTree = tree.apply(pruner);
|
||||||
|
|
||||||
DT expectedTree(keys, "0 0 0 4 5 6 7 8");
|
DT expectedTree(keys, "0 0 0 0 5 6 7 8");
|
||||||
EXPECT(assert_equal(expectedTree, prunedTree));
|
EXPECT(assert_equal(expectedTree, prunedTree));
|
||||||
|
|
||||||
|
size_t count = 0;
|
||||||
|
auto counter = [&](const Assignment<string>& choices, const int& x) {
|
||||||
|
count += 1;
|
||||||
|
return x;
|
||||||
|
};
|
||||||
|
DT prunedTree2 = prunedTree.apply(counter);
|
||||||
|
|
||||||
|
// Check if apply doesn't enumerate all leaves.
|
||||||
|
EXPECT_LONGS_EQUAL(5, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
|
@ -426,7 +426,6 @@ NonlinearFactorGraph SfmData::generalSfmFactors(
|
||||||
NonlinearFactorGraph SfmData::sfmFactorGraph(
|
NonlinearFactorGraph SfmData::sfmFactorGraph(
|
||||||
const SharedNoiseModel &model, boost::optional<size_t> fixedCamera,
|
const SharedNoiseModel &model, boost::optional<size_t> fixedCamera,
|
||||||
boost::optional<size_t> fixedPoint) const {
|
boost::optional<size_t> fixedPoint) const {
|
||||||
using ProjectionFactor = GeneralSFMFactor<SfmCamera, Point3>;
|
|
||||||
NonlinearFactorGraph graph = generalSfmFactors(model);
|
NonlinearFactorGraph graph = generalSfmFactors(model);
|
||||||
using noiseModel::Constrained;
|
using noiseModel::Constrained;
|
||||||
if (fixedCamera) {
|
if (fixedCamera) {
|
||||||
|
|
Loading…
Reference in New Issue