wrapped List[float] constructor
parent
6cb0fa7cd7
commit
e1802814ca
|
@ -44,14 +44,19 @@ class DiscreteFactor {
|
||||||
#include <gtsam/discrete/DecisionTreeFactor.h>
|
#include <gtsam/discrete/DecisionTreeFactor.h>
|
||||||
virtual class DecisionTreeFactor : gtsam::DiscreteFactor {
|
virtual class DecisionTreeFactor : gtsam::DiscreteFactor {
|
||||||
DecisionTreeFactor();
|
DecisionTreeFactor();
|
||||||
|
|
||||||
DecisionTreeFactor(const gtsam::DiscreteKey& key,
|
DecisionTreeFactor(const gtsam::DiscreteKey& key,
|
||||||
const std::vector<double>& spec);
|
const std::vector<double>& spec);
|
||||||
DecisionTreeFactor(const gtsam::DiscreteKey& key, string table);
|
DecisionTreeFactor(const gtsam::DiscreteKey& key, string table);
|
||||||
|
|
||||||
|
DecisionTreeFactor(const gtsam::DiscreteKeys& keys,
|
||||||
|
const std::vector<double>& table);
|
||||||
DecisionTreeFactor(const gtsam::DiscreteKeys& keys, string table);
|
DecisionTreeFactor(const gtsam::DiscreteKeys& keys, string table);
|
||||||
|
|
||||||
|
DecisionTreeFactor(const std::vector<gtsam::DiscreteKey>& keys,
|
||||||
|
const std::vector<double>& table);
|
||||||
DecisionTreeFactor(const std::vector<gtsam::DiscreteKey>& keys, string table);
|
DecisionTreeFactor(const std::vector<gtsam::DiscreteKey>& keys, string table);
|
||||||
|
|
||||||
DecisionTreeFactor(const gtsam::DiscreteConditional& c);
|
DecisionTreeFactor(const gtsam::DiscreteConditional& c);
|
||||||
|
|
||||||
void print(string s = "DecisionTreeFactor\n",
|
void print(string s = "DecisionTreeFactor\n",
|
||||||
|
|
|
@ -25,7 +25,13 @@ class TestDecisionTreeFactor(GtsamTestCase):
|
||||||
self.B = (5, 2)
|
self.B = (5, 2)
|
||||||
self.factor = DecisionTreeFactor([self.A, self.B], "1 2 3 4 5 6")
|
self.factor = DecisionTreeFactor([self.A, self.B], "1 2 3 4 5 6")
|
||||||
|
|
||||||
|
def test_from_floats(self):
|
||||||
|
"""Test whether we can construct a factor from floats."""
|
||||||
|
actual = DecisionTreeFactor([self.A, self.B], [1., 2., 3., 4., 5., 6.])
|
||||||
|
self.gtsamAssertEquals(actual, self.factor)
|
||||||
|
|
||||||
def test_enumerate(self):
|
def test_enumerate(self):
|
||||||
|
"""Test whether we can enumerate the factor."""
|
||||||
actual = self.factor.enumerate()
|
actual = self.factor.enumerate()
|
||||||
_, values = zip(*actual)
|
_, values = zip(*actual)
|
||||||
self.assertEqual(list(values), [1.0, 2.0, 3.0, 4.0, 5.0, 6.0])
|
self.assertEqual(list(values), [1.0, 2.0, 3.0, 4.0, 5.0, 6.0])
|
||||||
|
|
Loading…
Reference in New Issue