Bayes Filters Library
Gaussian.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2019 Istituto Italiano di Tecnologia (IIT)
3  *
4  * This software may be modified and distributed under the terms of the
5  * BSD 3-Clause license. See the accompanying LICENSE file for details.
6  */
7 
9 
10 #include <exception>
11 
12 using namespace bfl;
13 using namespace Eigen;
14 
15 Gaussian::Gaussian() noexcept :
16  GaussianMixture(1, 1, 0, false)
17 { }
18 
19 
20 Gaussian::Gaussian(const std::size_t dim_linear) noexcept :
21  GaussianMixture(1, dim_linear, 0, false)
22 { }
23 
24 
26 (
27  const std::size_t dim_linear,
28  const std::size_t dim_circular,
29  const bool use_quaternion
30 ) noexcept :
31  GaussianMixture(1, dim_linear, dim_circular, use_quaternion)
32 { }
33 
34 
35 void Gaussian::resize(const std::size_t dim_linear, const std::size_t dim_circular)
36 {
37  GaussianMixture::resize(1, dim_linear, dim_circular);
38 }
39 
40 
41 Ref<VectorXd> Gaussian::mean()
42 {
43  return mean_.col(0);
44 }
45 
46 
47 const Ref<const VectorXd> Gaussian::mean() const
48 {
49  return mean_.col(0);
50 }
51 
52 
53 double& Gaussian::mean(const std::size_t i)
54 {
55  return mean_(i, 0);
56 }
57 
58 
59 const double& Gaussian::mean(const std::size_t i) const
60 {
61  return mean_(i, 0);
62 }
63 
64 
65 Ref<MatrixXd> Gaussian::covariance()
66 {
67  return covariance_;
68 }
69 
70 
71 const Ref<const MatrixXd> Gaussian::covariance() const
72 {
73  return covariance_;
74 }
75 
76 
77 double& Gaussian::covariance(const std::size_t i, const std::size_t j)
78 {
79 
80  return covariance_(i, j);
81 }
82 
83 
84 const double& Gaussian::covariance(const std::size_t i, const std::size_t j) const
85 {
86  return covariance_(i, j);
87 }
88 
89 
91 {
92  return weight_(0);
93 }
94 
95 
96 const double& Gaussian::weight() const
97 {
98  return weight_(0);
99 }
bfl::Gaussian::mean
Eigen::Ref< Eigen::VectorXd > mean()
Non-virtual methods of GaussianMixture are overriden here since a Gaussian is a 1-component GaussianM...
Definition: Gaussian.cpp:41
bfl::Gaussian::resize
void resize(const std::size_t dim_linear, const std::size_t dim_circular=0)
Definition: Gaussian.cpp:35
bfl
Port of boost::any for C++11 compilers.
Definition: AdditiveMeasurementModel.h:13
bfl::Gaussian::Gaussian
Gaussian() noexcept
Definition: Gaussian.cpp:15
bfl::GaussianMixture::resize
virtual void resize(const std::size_t components, const std::size_t dim_linear, const std::size_t dim_circular=0)
Definition: GaussianMixture.cpp:64
Gaussian.h
bfl::Gaussian::weight
double & weight()
Definition: Gaussian.cpp:90
bfl::Gaussian::covariance
Eigen::Ref< Eigen::MatrixXd > covariance()
Definition: Gaussian.cpp:65
bfl::GaussianMixture
Definition: GaussianMixture.h:20