Removed unused inference-inl.h and testOrdering.cpp, added unit test for ordering with unobserved variables.
parent
b928b6d4f5
commit
a6fd5ff9e2
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include <gtsam/base/FastSet.h>
|
#include <gtsam/base/FastSet.h>
|
||||||
#include <gtsam/inference/BayesTree.h>
|
#include <gtsam/inference/BayesTree.h>
|
||||||
#include <gtsam/inference/inference-inl.h>
|
#include <gtsam/inference/inference.h>
|
||||||
#include <gtsam/inference/GenericSequentialSolver-inl.h>
|
#include <gtsam/inference/GenericSequentialSolver-inl.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <gtsam/inference/FactorBase-inl.h>
|
#include <gtsam/inference/FactorBase-inl.h>
|
||||||
#include <gtsam/inference/JunctionTree-inl.h>
|
#include <gtsam/inference/JunctionTree-inl.h>
|
||||||
#include <gtsam/inference/BayesNet-inl.h>
|
#include <gtsam/inference/BayesNet-inl.h>
|
||||||
#include <gtsam/inference/inference-inl.h>
|
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <gtsam/inference/FactorBase-inl.h>
|
#include <gtsam/inference/FactorBase-inl.h>
|
||||||
#include <gtsam/inference/EliminationTree-inl.h>
|
#include <gtsam/inference/EliminationTree-inl.h>
|
||||||
#include <gtsam/inference/BayesNet-inl.h>
|
#include <gtsam/inference/BayesNet-inl.h>
|
||||||
#include <gtsam/inference/inference-inl.h>
|
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <gtsam/inference/SymbolicFactorGraph.h>
|
#include <gtsam/inference/SymbolicFactorGraph.h>
|
||||||
#include <gtsam/inference/BayesTree-inl.h>
|
#include <gtsam/inference/BayesTree-inl.h>
|
||||||
#include <gtsam/inference/JunctionTree.h>
|
#include <gtsam/inference/JunctionTree.h>
|
||||||
#include <gtsam/inference/inference-inl.h>
|
|
||||||
#include <gtsam/inference/VariableSlots.h>
|
#include <gtsam/inference/VariableSlots.h>
|
||||||
#include <gtsam/inference/EliminationTree-inl.h>
|
#include <gtsam/inference/EliminationTree-inl.h>
|
||||||
#include <gtsam/inference/ClusterTree-inl.h>
|
#include <gtsam/inference/ClusterTree-inl.h>
|
||||||
|
|
|
@ -24,7 +24,6 @@ check_PROGRAMS += tests/testSymbolicBayesNet tests/testVariableIndex tests/testV
|
||||||
|
|
||||||
# Inference
|
# Inference
|
||||||
headers += GenericMultifrontalSolver.h GenericMultifrontalSolver-inl.h GenericSequentialSolver.h GenericSequentialSolver-inl.h
|
headers += GenericMultifrontalSolver.h GenericMultifrontalSolver-inl.h GenericSequentialSolver.h GenericSequentialSolver-inl.h
|
||||||
headers += inference-inl.h
|
|
||||||
sources += inference.cpp VariableSlots.cpp Permutation.cpp VariableIndex.cpp
|
sources += inference.cpp VariableSlots.cpp Permutation.cpp VariableIndex.cpp
|
||||||
sources += IndexFactor.cpp IndexConditional.cpp
|
sources += IndexFactor.cpp IndexConditional.cpp
|
||||||
headers += graph.h graph-inl.h
|
headers += graph.h graph-inl.h
|
||||||
|
@ -35,6 +34,7 @@ headers += EliminationTree.h EliminationTree-inl.h
|
||||||
headers += BayesNet.h BayesNet-inl.h
|
headers += BayesNet.h BayesNet-inl.h
|
||||||
headers += BayesTree.h BayesTree-inl.h
|
headers += BayesTree.h BayesTree-inl.h
|
||||||
headers += ISAM.h ISAM-inl.h
|
headers += ISAM.h ISAM-inl.h
|
||||||
|
check_PROGRAMS += tests/testInference
|
||||||
check_PROGRAMS += tests/testFactorGraph
|
check_PROGRAMS += tests/testFactorGraph
|
||||||
check_PROGRAMS += tests/testFactorGraph
|
check_PROGRAMS += tests/testFactorGraph
|
||||||
check_PROGRAMS += tests/testBayesTree
|
check_PROGRAMS += tests/testBayesTree
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <gtsam/inference/SymbolicFactorGraph.h>
|
#include <gtsam/inference/SymbolicFactorGraph.h>
|
||||||
#include <gtsam/inference/BayesNet-inl.h>
|
#include <gtsam/inference/BayesNet-inl.h>
|
||||||
#include <gtsam/inference/IndexFactor.h>
|
#include <gtsam/inference/IndexFactor.h>
|
||||||
#include <gtsam/inference/inference-inl.h>
|
|
||||||
#include <gtsam/inference/EliminationTree-inl.h>
|
#include <gtsam/inference/EliminationTree-inl.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
|
@ -1,26 +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 inference-inl.h
|
|
||||||
* @brief inference template definitions
|
|
||||||
* @author Frank Dellaert, Richard Roberts
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <gtsam/inference/inference.h>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
namespace gtsam {
|
|
||||||
|
|
||||||
} // namespace gtsam
|
|
|
@ -15,14 +15,18 @@
|
||||||
* @author Frank Dellaert, Richard Roberts
|
* @author Frank Dellaert, Richard Roberts
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gtsam/inference/inference-inl.h>
|
#include <gtsam/inference/inference.h>
|
||||||
#include <gtsam/inference/SymbolicFactorGraph.h>
|
#include <gtsam/inference/SymbolicFactorGraph.h>
|
||||||
|
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <ccolamd.h>
|
#include <ccolamd.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
Permutation::shared_ptr Inference::PermutationCOLAMD_(const VariableIndex& variableIndex, std::vector<int>& cmember) {
|
Permutation::shared_ptr Inference::PermutationCOLAMD_(const VariableIndex& variableIndex, std::vector<int>& cmember) {
|
||||||
|
@ -73,7 +77,10 @@ Permutation::shared_ptr Inference::PermutationCOLAMD_(const VariableIndex& varia
|
||||||
// Convert elimination ordering in p to an ordering
|
// Convert elimination ordering in p to an ordering
|
||||||
Permutation::shared_ptr permutation(new Permutation(nVars));
|
Permutation::shared_ptr permutation(new Permutation(nVars));
|
||||||
for (Index j = 0; j < nVars; j++) {
|
for (Index j = 0; j < nVars; j++) {
|
||||||
permutation->operator[](j) = p[j];
|
// if(p[j] == -1)
|
||||||
|
// permutation->operator[](j) = j;
|
||||||
|
// else
|
||||||
|
permutation->operator[](j) = p[j];
|
||||||
if(debug) cout << "COLAMD: " << j << "->" << p[j] << endl;
|
if(debug) cout << "COLAMD: " << j << "->" << p[j] << endl;
|
||||||
}
|
}
|
||||||
if(debug) cout << "COLAMD: p[" << nVars << "] = " << p[nVars] << endl;
|
if(debug) cout << "COLAMD: p[" << nVars << "] = " << p[nVars] << endl;
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
* 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 testInference.cpp
|
||||||
|
* @brief
|
||||||
|
* @author Richard Roberts
|
||||||
|
* @created Dec 6, 2010
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <CppUnitLite/TestHarness.h>
|
||||||
|
|
||||||
|
#include <gtsam/inference/inference.h>
|
||||||
|
#include <gtsam/inference/VariableIndex.h>
|
||||||
|
#include <gtsam/inference/SymbolicFactorGraph.h>
|
||||||
|
|
||||||
|
using namespace gtsam;
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
TEST(Inference, UnobservedVariables) {
|
||||||
|
SymbolicFactorGraph sfg;
|
||||||
|
|
||||||
|
// Create a factor graph that skips some variables
|
||||||
|
sfg.push_factor(0,1);
|
||||||
|
sfg.push_factor(1,3);
|
||||||
|
sfg.push_factor(3,5);
|
||||||
|
|
||||||
|
VariableIndex variableIndex(sfg);
|
||||||
|
|
||||||
|
Permutation::shared_ptr colamd(Inference::PermutationCOLAMD(variableIndex));
|
||||||
|
|
||||||
|
colamd->print("colamd: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
int main() {
|
||||||
|
TestResult tr;
|
||||||
|
return TestRegistry::runAllTests(tr);
|
||||||
|
}
|
|
@ -1,53 +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 testOrdering.cpp
|
|
||||||
* @author Alex Cunningham
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <boost/assign/std/list.hpp> // for operator +=
|
|
||||||
using namespace boost::assign;
|
|
||||||
|
|
||||||
#include <CppUnitLite/TestHarness.h>
|
|
||||||
|
|
||||||
// Magically turn strings into Symbols
|
|
||||||
#define GTSAM_MAGIC_KEY
|
|
||||||
|
|
||||||
#include <gtsam/inference/Ordering.h>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace gtsam;
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
|
||||||
TEST ( Ordering, subtract )
|
|
||||||
{
|
|
||||||
Ordering init, delta;
|
|
||||||
init += "a", "b", "c", "d", "e";
|
|
||||||
CHECK(assert_equal(init.subtract(delta), init));
|
|
||||||
|
|
||||||
delta += "b";
|
|
||||||
Ordering expected1;
|
|
||||||
expected1 += "a", "c", "d", "e";
|
|
||||||
CHECK(assert_equal(init.subtract(delta), expected1));
|
|
||||||
|
|
||||||
delta += "e";
|
|
||||||
Ordering expected2;
|
|
||||||
expected2 += "a", "c", "d";
|
|
||||||
CHECK(assert_equal(init.subtract(delta), expected2));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
|
||||||
int main() {
|
|
||||||
TestResult tr;
|
|
||||||
return TestRegistry::runAllTests(tr);
|
|
||||||
}
|
|
||||||
/* ************************************************************************* */
|
|
|
@ -47,8 +47,6 @@
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
class GaussianFactorGraph;
|
|
||||||
|
|
||||||
/** A map from key to dimension, useful in various contexts */
|
/** A map from key to dimension, useful in various contexts */
|
||||||
typedef std::map<Index, size_t> Dimensions;
|
typedef std::map<Index, size_t> Dimensions;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
#include <gtsam/linear/GaussianFactorGraph.h>
|
#include <gtsam/linear/GaussianFactorGraph.h>
|
||||||
#include <gtsam/inference/FactorGraph-inl.h>
|
#include <gtsam/inference/FactorGraph-inl.h>
|
||||||
#include <gtsam/inference/inference-inl.h>
|
|
||||||
#include <gtsam/linear/iterative.h>
|
#include <gtsam/linear/iterative.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
#include <gtsam/linear/GaussianFactorGraph.h>
|
#include <gtsam/linear/GaussianFactorGraph.h>
|
||||||
#include <gtsam/linear/SharedDiagonal.h>
|
#include <gtsam/linear/SharedDiagonal.h>
|
||||||
#include <gtsam/inference/inference-inl.h>
|
|
||||||
#include <gtsam/inference/EliminationTree-inl.h>
|
#include <gtsam/inference/EliminationTree-inl.h>
|
||||||
|
|
||||||
#include <boost/random.hpp>
|
#include <boost/random.hpp>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <gtsam/linear/GaussianFactorGraph.h>
|
#include <gtsam/linear/GaussianFactorGraph.h>
|
||||||
#include <gtsam/nonlinear/NonlinearFactorGraph.h>
|
#include <gtsam/nonlinear/NonlinearFactorGraph.h>
|
||||||
#include <gtsam/inference/FactorGraph-inl.h>
|
#include <gtsam/inference/FactorGraph-inl.h>
|
||||||
#include <gtsam/inference/inference-inl.h>
|
#include <gtsam/inference/inference.h>
|
||||||
|
|
||||||
#define INSTANTIATE_NONLINEAR_FACTOR_GRAPH(C) \
|
#define INSTANTIATE_NONLINEAR_FACTOR_GRAPH(C) \
|
||||||
INSTANTIATE_FACTOR_GRAPH(NonlinearFactor<C>); \
|
INSTANTIATE_FACTOR_GRAPH(NonlinearFactor<C>); \
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include <gtsam/geometry/Point2.h>
|
#include <gtsam/geometry/Point2.h>
|
||||||
#include <gtsam/inference/SymbolicFactorGraph.h>
|
#include <gtsam/inference/SymbolicFactorGraph.h>
|
||||||
#include <gtsam/inference/SymbolicBayesNet.h>
|
#include <gtsam/inference/SymbolicBayesNet.h>
|
||||||
#include <gtsam/inference/inference-inl.h>
|
|
||||||
#include <gtsam/nonlinear/LieValues-inl.h>
|
#include <gtsam/nonlinear/LieValues-inl.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
|
@ -30,7 +30,6 @@ using namespace boost::assign;
|
||||||
|
|
||||||
#include <gtsam/base/Matrix.h>
|
#include <gtsam/base/Matrix.h>
|
||||||
#include <gtsam/linear/GaussianConditional.h>
|
#include <gtsam/linear/GaussianConditional.h>
|
||||||
#include <gtsam/inference/inference-inl.h>
|
|
||||||
#include <gtsam/slam/smallExample.h>
|
#include <gtsam/slam/smallExample.h>
|
||||||
#include <gtsam/nonlinear/Ordering.h>
|
#include <gtsam/nonlinear/Ordering.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue