28 using namespace gtsam;
    45       X & Y & Z, 
"0.2 0.5 0.3 0.6 0.4 0.7 0.25 0.55 0.35 0.65 0.45 0.75");
    64       X & Y & Z, 
"0.2 0.5 0.3 0.6 0.4 0.7 0.25 0.55 0.35 0.65 0.45 0.75");
    83   Signature signature((
C | 
B, A) = 
"4/1 1/1 1/1 1/4");
    98   EXPECT(DiscreteConditional::CheckInvariants(dc, 
values));
   112   EXPECT(DiscreteConditional::CheckInvariants(C_given_DE, given));
   127   for (
auto&& actual : {prior * conditional, conditional * prior}) {
   129     KeyVector frontals(actual.beginFrontals(), actual.endFrontals());
   131     for (
auto&& it : actual.enumerate()) {
   148   for (
auto&& actual : {A_given_B * B_given_C, B_given_C * A_given_B}) {
   151     KeyVector frontals(actual.beginFrontals(), actual.endFrontals());
   153     for (
auto&& it : actual.enumerate()) {
   168   for (
auto&& actual : {A_given_B * B_given_C, B_given_C * A_given_B}) {
   171     KeyVector frontals(actual.beginFrontals(), actual.endFrontals());
   173     for (
auto&& it : actual.enumerate()) {
   190   for (
auto&& actual : {AB_given_D * C_given_DE, C_given_DE * AB_given_D}) {
   193     KeyVector frontals(actual.beginFrontals(), actual.endFrontals());
   195     KeyVector parents(actual.beginParents(), actual.endParents());
   197     for (
auto&& it : actual.enumerate()) {
   265   auto actual1 = C_given_DE.
choose(given);
   270   auto actual2 = C_given_DE.
choose(given);
   278   auto actual3 = C_given_DE.
choose(given);
   297   string actual = conditional.
markdown();
   298   EXPECT(actual == expected);
   314   DecisionTreeFactor::Names 
names{{
x1, {
"A0", 
"A1", 
"A2"}}};
   316   EXPECT(actual == expected);
   324       A | B = 
"2/88/10 2/20/78 33/33/34 33/33/34 95/2/3");
   328       "|:-:|:-:|:-:|:-:|\n"   329       "|0|0.02|0.88|0.1|\n"   330       "|1|0.02|0.2|0.78|\n"   331       "|2|0.33|0.33|0.34|\n"   332       "|3|0.33|0.33|0.34|\n"   333       "|4|0.95|0.02|0.03|\n";
   334   string actual = conditional.
markdown();
   335   EXPECT(actual == expected);
   346       "|:-:|:-:|:-:|:-:|\n"   348       "|-|One|0.25|0.75|\n"   350       "|+|Zero|0.75|0.25|\n"   353   vector<string> keyNames{
"C", 
"B", 
"A"};
   355   DecisionTreeFactor::Names 
names{
   356       {0, {
"Zero", 
"One", 
"Two"}}, {1, {
"-", 
"+"}}, {2, {
"T", 
"F"}}};
   358   EXPECT(actual == expected);
   368       "<p>  <i>P(A|B,C):</i></p>\n"   369       "<table class='DiscreteConditional'>\n"   371       "    <tr><th><i>B</i></th><th><i>C</i></th><th>T</th><th>F</th></tr>\n"   374       "    <tr><th>-</th><th>Zero</th><td>0</td><td>1</td></tr>\n"   375       "    <tr><th>-</th><th>One</th><td>0.25</td><td>0.75</td></tr>\n"   376       "    <tr><th>-</th><th>Two</th><td>0.5</td><td>0.5</td></tr>\n"   377       "    <tr><th>+</th><th>Zero</th><td>0.75</td><td>0.25</td></tr>\n"   378       "    <tr><th>+</th><th>One</th><td>0</td><td>1</td></tr>\n"   379       "    <tr><th>+</th><th>Two</th><td>1</td><td>0</td></tr>\n"   383   vector<string> keyNames{
"C", 
"B", 
"A"};
   385   DecisionTreeFactor::Names 
names{
   386       {0, {
"Zero", 
"One", 
"Two"}}, {1, {
"-", 
"+"}}, {2, {
"T", 
"F"}}};
   388   EXPECT(actual == expected);
 std::string markdown(const KeyFormatter &keyFormatter=DefaultKeyFormatter, const Names &names={}) const override
Render as markdown table. 
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
const gtsam::Symbol key('X', 0)
static int runAllTests(TestResult &result)
double evaluate(const DiscreteValues &values) const
Evaluate, just look up in AlgebraicDecisonTree. 
Point2 prior(const Point2 &x)
Prior on a single pose. 
shared_ptr choose(const DiscreteValues &given) const
< DiscreteValues version 
FACTOR::const_iterator endFrontals() const
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
static const T & choose(int layout, const T &col, const T &row)
string markdown(const DiscreteValues &values, const KeyFormatter &keyFormatter, const DiscreteValues::Names &names)
Free version of markdown. 
FACTOR::const_iterator beginParents() const
Frontals frontals() const
double f2(const Vector2 &x)
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
DecisionTreeFactor::shared_ptr likelihood(const DiscreteValues &frontalValues) const
EIGEN_DEVICE_FUNC const LogReturnType log() const
static const KeyFormatter DefaultKeyFormatter
double error(const DiscreteValues &values) const
Calculate error for DiscreteValues x, is -log(probability). 
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
const KeyFormatter & formatter
FACTOR::const_iterator beginFrontals() const
const_iterator end() const
string html(const DiscreteValues &values, const KeyFormatter &keyFormatter, const DiscreteValues::Names &names)
Free version of html. 
double logProbability(const DiscreteValues &x) const
Log-probability is just -error(x). 
FACTOR::const_iterator endParents() const
#define EXPECT(condition)
Array< int, Dynamic, 1 > v
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
std::vector< double > Row
Matrix< Scalar, Dynamic, Dynamic > C
TEST(DiscreteConditional, constructors)
#define EXPECT_LONGS_EQUAL(expected, actual)
Point2 f1(const Point3 &p, OptionalJacobian< 2, 3 > H)
std::pair< Key, size_t > DiscreteKey
shared_ptr sum(size_t nrFrontals) const
Create new factor by summing all values with the same separator values. 
DiscreteConditional marginal(Key key) const
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers. 
std::uint64_t Key
Integer nonlinear key type. 
Marginals marginals(graph, result)