Added Gaussian elimination tree and junction tree
parent
57193a7f65
commit
41a8822469
|
|
@ -0,0 +1,53 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
|
||||
* 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 GaussianEliminationTreeUnordered.cpp
|
||||
* @date Mar 29, 2013
|
||||
* @author Frank Dellaert
|
||||
* @author Richard Roberts
|
||||
*/
|
||||
|
||||
#include <gtsam/inference/EliminationTreeUnordered-inst.h>
|
||||
#include <gtsam/linear/GaussianEliminationTreeUnordered.h>
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
/* ************************************************************************* */
|
||||
GaussianEliminationTreeUnordered::GaussianEliminationTreeUnordered(
|
||||
const GaussianFactorGraphUnordered& factorGraph, const VariableIndexUnordered& structure,
|
||||
const OrderingUnordered& order) :
|
||||
Base(factorGraph, structure, order) {}
|
||||
|
||||
/* ************************************************************************* */
|
||||
GaussianEliminationTreeUnordered::GaussianEliminationTreeUnordered(
|
||||
const GaussianFactorGraphUnordered& factorGraph, const OrderingUnordered& order) :
|
||||
Base(factorGraph, order) {}
|
||||
|
||||
/* ************************************************************************* */
|
||||
GaussianEliminationTreeUnordered::GaussianEliminationTreeUnordered(
|
||||
const This& other) :
|
||||
Base(other) {}
|
||||
|
||||
/* ************************************************************************* */
|
||||
GaussianEliminationTreeUnordered& GaussianEliminationTreeUnordered::operator=(const This& other)
|
||||
{
|
||||
(void) Base::operator=(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
bool GaussianEliminationTreeUnordered::equals(const This& other, double tol) const
|
||||
{
|
||||
return Base::equals(other, tol);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
|
||||
* 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 GaussianEliminationTreeUnordered.h
|
||||
* @date Mar 29, 2013
|
||||
* @author Frank Dellaert
|
||||
* @author Richard Roberts
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gtsam/linear/GaussianBayesNetUnordered.h>
|
||||
#include <gtsam/linear/GaussianFactorGraphUnordered.h>
|
||||
#include <gtsam/inference/EliminationTreeUnordered.h>
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
class GTSAM_EXPORT GaussianEliminationTreeUnordered :
|
||||
public EliminationTreeUnordered<GaussianBayesNetUnordered, GaussianFactorGraphUnordered>
|
||||
{
|
||||
public:
|
||||
typedef EliminationTreeUnordered<GaussianBayesNetUnordered, GaussianFactorGraphUnordered> Base; ///< Base class
|
||||
typedef GaussianEliminationTreeUnordered This; ///< This class
|
||||
typedef boost::shared_ptr<This> shared_ptr; ///< Shared pointer to this class
|
||||
|
||||
/**
|
||||
* Build the elimination tree of a factor graph using pre-computed column structure.
|
||||
* @param factorGraph The factor graph for which to build the elimination tree
|
||||
* @param structure The set of factors involving each variable. If this is not
|
||||
* precomputed, you can call the Create(const FactorGraph<DERIVEDFACTOR>&)
|
||||
* named constructor instead.
|
||||
* @return The elimination tree
|
||||
*/
|
||||
GaussianEliminationTreeUnordered(const GaussianFactorGraphUnordered& factorGraph,
|
||||
const VariableIndexUnordered& structure, const OrderingUnordered& order);
|
||||
|
||||
/** Build the elimination tree of a factor graph. Note that this has to compute the column
|
||||
* structure as a VariableIndex, so if you already have this precomputed, use the other
|
||||
* constructor instead.
|
||||
* @param factorGraph The factor graph for which to build the elimination tree
|
||||
*/
|
||||
GaussianEliminationTreeUnordered(const GaussianFactorGraphUnordered& factorGraph,
|
||||
const OrderingUnordered& order);
|
||||
|
||||
/** Copy constructor - makes a deep copy of the tree structure, but only pointers to factors are
|
||||
* copied, factors are not cloned. */
|
||||
GaussianEliminationTreeUnordered(const This& other);
|
||||
|
||||
/** Assignment operator - makes a deep copy of the tree structure, but only pointers to factors are
|
||||
* copied, factors are not cloned. */
|
||||
This& operator=(const This& other);
|
||||
|
||||
/** Test whether the tree is equal to another */
|
||||
bool equals(const This& other, double tol = 1e-9) const;
|
||||
|
||||
private:
|
||||
|
||||
friend class ::EliminationTreeUnorderedTester;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
|
||||
* 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 GaussianJunctionTreeUnordered.cpp
|
||||
* @date Mar 29, 2013
|
||||
* @author Frank Dellaert
|
||||
* @author Richard Roberts
|
||||
*/
|
||||
|
||||
#include <gtsam/inference/JunctionTreeUnordered-inst.h>
|
||||
#include <gtsam/linear/GaussianJunctionTreeUnordered.h>
|
||||
#include <gtsam/linear/GaussianEliminationTreeUnordered.h>
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
/* ************************************************************************* */
|
||||
GaussianJunctionTreeUnordered::GaussianJunctionTreeUnordered(
|
||||
const GaussianEliminationTreeUnordered& eliminationTree) :
|
||||
Base(Base::FromEliminationTree(eliminationTree)) {}
|
||||
|
||||
/* ************************************************************************* */
|
||||
GaussianJunctionTreeUnordered::GaussianJunctionTreeUnordered(const This& other) :
|
||||
Base(other) {}
|
||||
|
||||
/* ************************************************************************* */
|
||||
GaussianJunctionTreeUnordered& GaussianJunctionTreeUnordered::operator=(const This& other)
|
||||
{
|
||||
(void) Base::operator=(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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 GaussianJunctionTreeUnordered.h
|
||||
* @date Mar 29, 2013
|
||||
* @author Frank Dellaert
|
||||
* @author Richard Roberts
|
||||
*/
|
||||
|
||||
#include <gtsam/linear/GaussianFactorGraphUnordered.h>
|
||||
#include <gtsam/linear/GaussianBayesTreeUnordered.h>
|
||||
#include <gtsam/inference/JunctionTreeUnordered.h>
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
// Forward declarations
|
||||
class GaussianEliminationTreeUnordered;
|
||||
|
||||
/**
|
||||
* A ClusterTree, i.e., a set of variable clusters with factors, arranged in a tree, with
|
||||
* the additional property that it represents the clique tree associated with a Bayes net.
|
||||
*
|
||||
* In GTSAM a junction tree is an intermediate data structure in multifrontal
|
||||
* variable elimination. Each node is a cluster of factors, along with a
|
||||
* clique of variables that are eliminated all at once. In detail, every node k represents
|
||||
* a clique (maximal fully connected subset) of an associated chordal graph, such as a
|
||||
* chordal Bayes net resulting from elimination.
|
||||
*
|
||||
* The difference with the BayesTree is that a JunctionTree stores factors, whereas a
|
||||
* BayesTree stores conditionals, that are the product of eliminating the factors in the
|
||||
* corresponding JunctionTree cliques.
|
||||
*
|
||||
* The tree structure and elimination method are exactly analagous to the EliminationTree,
|
||||
* except that in the JunctionTree, at each node multiple variables are eliminated at a time.
|
||||
*
|
||||
* \addtogroup Multifrontal
|
||||
* \nosubgrouping
|
||||
*/
|
||||
class GTSAM_EXPORT GaussianJunctionTreeUnordered :
|
||||
public JunctionTreeUnordered<GaussianBayesTreeUnordered, GaussianFactorGraphUnordered> {
|
||||
public:
|
||||
typedef JunctionTreeUnordered<GaussianBayesTreeUnordered, GaussianFactorGraphUnordered> Base; ///< Base class
|
||||
typedef GaussianJunctionTreeUnordered This; ///< This class
|
||||
typedef boost::shared_ptr<This> shared_ptr; ///< Shared pointer to this class
|
||||
|
||||
/**
|
||||
* Build the elimination tree of a factor graph using pre-computed column structure.
|
||||
* @param factorGraph The factor graph for which to build the elimination tree
|
||||
* @param structure The set of factors involving each variable. If this is not
|
||||
* precomputed, you can call the Create(const FactorGraph<DERIVEDFACTOR>&)
|
||||
* named constructor instead.
|
||||
* @return The elimination tree
|
||||
*/
|
||||
GaussianJunctionTreeUnordered(const GaussianEliminationTreeUnordered& eliminationTree);
|
||||
|
||||
/** Copy constructor - makes a deep copy of the tree structure, but only pointers to factors are
|
||||
* copied, factors are not cloned. */
|
||||
GaussianJunctionTreeUnordered(const This& other);
|
||||
|
||||
/** Assignment operator - makes a deep copy of the tree structure, but only pointers to factors are
|
||||
* copied, factors are not cloned. */
|
||||
This& operator=(const This& other);
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue