DiscreteDistribution.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
18 #pragma once
19 
21 
22 #include <string>
23 #include <vector>
24 
25 namespace gtsam {
26 
33 class GTSAM_EXPORT DiscreteDistribution : public DiscreteConditional {
34  public:
36 
39 
42 
45  : Base(f.size(), f) {}
46 
52  explicit DiscreteDistribution(const Signature& s) : Base(s) {}
53 
60  DiscreteDistribution(const DiscreteKey& key, const std::vector<double>& spec)
62 
69  DiscreteDistribution(const DiscreteKey& key, const std::string& spec)
70  : DiscreteDistribution(Signature(key, {}, spec)) {}
71 
75 
77  void print(
78  const std::string& s = "Discrete Prior: ",
79  const KeyFormatter& formatter = DefaultKeyFormatter) const override;
80 
84 
86  double operator()(size_t value) const;
87 
89  // TODO(dellaert): does not play well with wrapper!
90  // using Base::operator();
91 
93  std::vector<double> pmf() const;
94 
96 };
97 // DiscreteDistribution
98 
99 // traits
100 template <>
101 struct traits<DiscreteDistribution> : public Testable<DiscreteDistribution> {};
102 
103 } // namespace gtsam
gtsam::Signature::Table
std::vector< Row > Table
Definition: Signature.h:60
gtsam::DecisionTreeFactor
Definition: DecisionTreeFactor.h:44
s
RealScalar s
Definition: level1_cplx_impl.h:126
gtsam::DiscreteDistribution
Definition: DiscreteDistribution.h:33
formatter
const KeyFormatter & formatter
Definition: treeTraversal-inst.h:204
DiscreteConditional.h
gtsam::DefaultKeyFormatter
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition: Key.cpp:30
size
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
gtsam::print
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:155
gtsam::DiscreteDistribution::DiscreteDistribution
DiscreteDistribution(const DiscreteKey &key, const std::vector< double > &spec)
Definition: DiscreteDistribution.h:60
operator()
internal::enable_if< internal::valid_indexed_view_overload< RowIndices, ColIndices >::value &&internal::traits< typename EIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::ReturnAsIndexedView, typename EIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::type operator()(const RowIndices &rowIndices, const ColIndices &colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
Definition: IndexedViewMethods.h:73
gtsam::KeyFormatter
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:35
gtsam::DiscreteDistribution::DiscreteDistribution
DiscreteDistribution(const DiscreteKey &key, const std::string &spec)
Definition: DiscreteDistribution.h:69
gtsam::DiscreteDistribution::DiscreteDistribution
DiscreteDistribution()
Default constructor needed for serialization.
Definition: DiscreteDistribution.h:41
gtsam::DiscreteDistribution::DiscreteDistribution
DiscreteDistribution(const Signature &s)
Definition: DiscreteDistribution.h:52
key
const gtsam::Symbol key('X', 0)
tree::f
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Definition: testExpression.cpp:218
gtsam::DiscreteConditional
Definition: DiscreteConditional.h:37
gtsam
traits
Definition: SFMdata.h:40
gtsam::DiscreteDistribution::DiscreteDistribution
DiscreteDistribution(const DecisionTreeFactor &f)
Constructor from factor.
Definition: DiscreteDistribution.h:44
gtsam::Testable
Definition: Testable.h:152
gtsam::traits
Definition: Group.h:36
gtsam::DiscreteKey
std::pair< Key, size_t > DiscreteKey
Definition: DiscreteKey.h:38
gtsam::DiscreteFactor
Definition: DiscreteFactor.h:39
test_callbacks.value
value
Definition: test_callbacks.py:160
gtsam::Signature
Definition: Signature.h:54


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:32:26