gaussian_distribution.h
Go to the documentation of this file.
1 /*
2  * Copyright 2016 The Cartographer Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef CARTOGRAPHER_KALMAN_FILTER_GAUSSIAN_DISTRIBUTION_H_
18 #define CARTOGRAPHER_KALMAN_FILTER_GAUSSIAN_DISTRIBUTION_H_
19 
20 #include "Eigen/Cholesky"
21 #include "Eigen/Core"
22 #include "Eigen/Geometry"
23 
24 namespace cartographer {
25 namespace kalman_filter {
26 
27 template <typename T, int N>
29  public:
30  GaussianDistribution(const Eigen::Matrix<T, N, 1>& mean,
31  const Eigen::Matrix<T, N, N>& covariance)
32  : mean_(mean), covariance_(covariance) {}
33 
34  const Eigen::Matrix<T, N, 1>& GetMean() const { return mean_; }
35 
36  const Eigen::Matrix<T, N, N>& GetCovariance() const { return covariance_; }
37 
38  private:
39  Eigen::Matrix<T, N, 1> mean_;
40  Eigen::Matrix<T, N, N> covariance_;
41 };
42 
43 template <typename T, int N>
45  const GaussianDistribution<T, N>& rhs) {
46  return GaussianDistribution<T, N>(lhs.GetMean() + rhs.GetMean(),
47  lhs.GetCovariance() + rhs.GetCovariance());
48 }
49 
50 template <typename T, int N, int M>
51 GaussianDistribution<T, N> operator*(const Eigen::Matrix<T, N, M>& lhs,
52  const GaussianDistribution<T, M>& rhs) {
54  lhs * rhs.GetMean(), lhs * rhs.GetCovariance() * lhs.transpose());
55 }
56 
57 } // namespace kalman_filter
58 } // namespace cartographer
59 
60 #endif // CARTOGRAPHER_KALMAN_FILTER_GAUSSIAN_DISTRIBUTION_H_
const Eigen::Matrix< T, N, 1 > & GetMean() const
GaussianDistribution< T, N > operator+(const GaussianDistribution< T, N > &lhs, const GaussianDistribution< T, N > &rhs)
GaussianDistribution(const Eigen::Matrix< T, N, 1 > &mean, const Eigen::Matrix< T, N, N > &covariance)
const Eigen::Matrix< T, N, N > & GetCovariance() const
GaussianDistribution< T, N > operator*(const Eigen::Matrix< T, N, M > &lhs, const GaussianDistribution< T, M > &rhs)


cartographer
Author(s):
autogenerated on Mon Jun 10 2019 12:51:38