Go to the documentation of this file.
36 using namespace gtsam;
80 for (
size_t mode : {0, 1}) {
102 for (
size_t mode : {0, 1}) {
127 std::vector<DiscreteKey> discrete_keys = {
mode};
134 std::vector<double>
ratio(2);
135 for (
size_t mode : {0, 1}) {
161 EXPECT(continuousParentKeys.size() == 1);
162 EXPECT(continuousParentKeys[0] ==
X(0));
176 double negLogConstant0 =
conditionals[0]->negLogConstant();
177 double negLogConstant1 =
conditionals[1]->negLogConstant();
178 double minErrorConstant =
std::min(negLogConstant0, negLogConstant1);
183 std::vector<double> leaves = {
191 for (
size_t mode : {0, 1}) {
220 const auto jf1 = std::dynamic_pointer_cast<JacobianFactor>(gf1);
232 std::vector<double>
ratio(2);
233 for (
size_t mode : {0, 1}) {
247 std::vector<GaussianConditional::shared_ptr> gcs;
248 for (
size_t i = 0;
i < 4;
i++) {
252 auto empty = std::make_shared<GaussianConditional>();
257 keys.push_back({
M(3), 2});
259 for (
size_t i = 0;
i < 8;
i++) {
260 std::vector<double> potentials{0, 0, 0, 0, 0, 0, 0, 0};
264 const auto pruned =
hgc.prune(decisionTreeFactor);
270 const std::vector<double> potentials{0, 0, 0.5, 0,
274 const auto pruned =
hgc.prune(decisionTreeFactor);
280 const std::vector<double> potentials{0.2, 0, 0.3, 0,
284 const auto pruned =
hgc.prune(decisionTreeFactor);
static int runAllTests(TestResult &result)
Eigen::Matrix< double, 1, 1 > Vector1
Conditional Gaussian Base class.
A hybrid conditional in the Conditional Linear Gaussian scheme.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
AlgebraicDecisionTree< Key > errorTree(const VectorValues &continuousValues) const override
Compute error of the HybridGaussianFactor as a tree.
#define EXPECT_LONGS_EQUAL(expected, actual)
#define EXPECT(condition)
const HybridGaussianConditional hybrid_conditional(mode, conditionals)
static const DiscreteValues assignment0
DiscreteKeys is a set of keys that can be assembled using the & operator.
static const VectorValues vv
const EIGEN_DEVICE_FUNC ExpReturnType exp() const
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
A set of GaussianFactors, indexed by a set of discrete keys.
static const DiscreteValues assignment1
double evaluate(const HybridValues &values) const override
Calculate probability density for given values.
double logProbability(const HybridValues &values) const override
Compute the logProbability of this hybrid Gaussian conditional.
static const DiscreteKey mode(modeKey, 2)
Decision Tree for use in DiscreteFactors.
static bool CheckInvariants(const HybridGaussianConditional &conditional, const VALUES &x)
A conditional of gaussian conditionals indexed by discrete variables, as part of a Bayes Network....
KeyVector continuousParents() const
Returns the continuous keys among the parents.
std::shared_ptr< HybridGaussianFactor > likelihood(const VectorValues &given) const
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
specialized key for discrete variables
a decision tree is a function from assignments to values.
TEST(SmartFactorBase, Pinhole)
std::pair< Key, size_t > DiscreteKey
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size ratio
const std::vector< GaussianConditional::shared_ptr > conditionals
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
double negLogConstant() const override
Return log normalization constant in negative log space.
static const HybridValues hv0
double error(const HybridValues &values) const override
Compute the log-likelihood, including the log-normalizing constant.
std::uint64_t Key
Integer nonlinear key type.
static const HybridValues hv1
constexpr descr< N - 1 > _(char const (&text)[N])
static shared_ptr sharedMeanAndStddev(Args &&... args)
Create shared pointer by forwarding arguments to fromMeanAndStddev.
Matrix< RealScalar, Dynamic, Dynamic > M
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:40:14