31 throw std::invalid_argument(
32 "Single value operator can only be invoked on single-variable " 35 values.emplace(
keys_[0], value);
41 throw std::invalid_argument(
42 "DiscreteDistribution::pmf only defined for single-variable priors");
44 std::vector<double>
array;
45 array.reserve(nrValues);
46 for (
size_t v = 0;
v < nrValues;
v++) {
47 array.push_back(
operator()(
v));
KeyVector keys_
The keys involved in this factor.
size_t nrFrontals() const
const KeyFormatter & formatter
std::vector< double > pmf() const
We also want to keep the Base version, taking DiscreteValues:
double operator()(const DiscreteValues &values) const override
Evaluate probability distribution, sugar.
Array< int, Dynamic, 1 > v
std::map< Key, size_t > cardinalities_
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
void print(const std::string &s="Discrete Conditional: ", const KeyFormatter &formatter=DefaultKeyFormatter) const override
GTSAM-style print.
void print(const std::string &s="Discrete Prior: ", const KeyFormatter &formatter=DefaultKeyFormatter) const override
GTSAM-style print.
double operator()(size_t value) const
Evaluate given a single value.