Loading...
Searching...
No Matches
DiscreteDistribution.h
Go to the documentation of this file.
/* ----------------------------------------------------------------------------
* 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
* -------------------------------------------------------------------------- */
#pragma once
#include <gtsam/discrete/DiscreteConditional.h>
#include <string>
#include <vector>
namespace gtsam {
class GTSAM_EXPORT DiscreteDistribution : public DiscreteConditional {
public:
using Base = DiscreteConditional;
DiscreteDistribution() {}
explicit DiscreteDistribution(const DecisionTreeFactor& f)
: Base(f.size(), f) {}
explicit DiscreteDistribution(const Signature& s) : Base(s) {}
DiscreteDistribution(const DiscreteKey& key, const std::vector<double>& spec)
: DiscreteDistribution(Signature(key, {}, Signature::Table{spec})) {}
DiscreteDistribution(const DiscreteKey& key, const std::string& spec)
: DiscreteDistribution(Signature(key, {}, spec)) {}
void print(
const std::string& s = "Discrete Prior: ",
const KeyFormatter& formatter = DefaultKeyFormatter) const override;
double operator()(size_t value) const;
// TODO(dellaert): does not play well with wrapper!
// using Base::operator();
std::vector<double> pmf() const;
#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V42
size_t GTSAM_DEPRECATED solve() const { return Base::solve({}); }
#endif
};
// DiscreteDistribution
// traits
template <>
struct traits<DiscreteDistribution> : public Testable<DiscreteDistribution> {};
} // namespace gtsam
DiscreteConditional.h
gtsam::DiscreteKey
std::pair< Key, size_t > DiscreteKey
Key type for discrete variables.
Definition DiscreteKey.h:36
gtsam
Global functions in a separate testing namespace.
Definition chartTesting.h:28
gtsam::traits
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition concepts.h:30
gtsam::Testable
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:151
gtsam::DecisionTreeFactor
A discrete probabilistic factor.
Definition DecisionTreeFactor.h:45
gtsam::DiscreteConditional::DiscreteConditional
DiscreteConditional()
Default constructor needed for serialization.
Definition DiscreteConditional.h:55
gtsam::DiscreteDistribution
A prior probability on a set of discrete variables.
Definition DiscreteDistribution.h:33
gtsam::DiscreteDistribution::DiscreteDistribution
DiscreteDistribution(const Signature &s)
Construct from a Signature.
Definition DiscreteDistribution.h:52
gtsam::DiscreteDistribution::DiscreteDistribution
DiscreteDistribution(const DiscreteKey &key, const std::vector< double > &spec)
Construct from key and a vector of floats specifying the probability mass function (PMF).
Definition DiscreteDistribution.h:60
gtsam::DiscreteDistribution::DiscreteDistribution
DiscreteDistribution(const DiscreteKey &key, const std::string &spec)
Construct from key and a string specifying the probability mass function (PMF).
Definition DiscreteDistribution.h:69
gtsam::DiscreteDistribution::DiscreteDistribution
DiscreteDistribution()
Default constructor needed for serialization.
Definition DiscreteDistribution.h:41
gtsam::DiscreteDistribution::DiscreteDistribution
DiscreteDistribution(const DecisionTreeFactor &f)
Constructor from factor.
Definition DiscreteDistribution.h:44
gtsam::Signature
Signature for a discrete conditional density, used to construct conditionals.
Definition Signature.h:54
gtsam::Factor::size
size_t size() const
Definition Factor.h:157