OpenKalman
OpenKalman
distributions
MixtureOfContinuousDistributions.hpp
1
/* This file is part of OpenKalman, a header-only C++ library for
2
* Kalman filters and other recursive filters.
3
*
4
* Copyright (c) 2017-2021 Christopher Lee Ogden <ogden@gatech.edu>
5
*
6
* This Source Code Form is subject to the terms of the Mozilla Public
7
* License, v. 2.0. If a copy of the MPL was not distributed with this
8
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
9
*/
10
11
#ifndef OPENKALMAN_MIXTUREOFCONTINUOUSDISTRIBUTIONS_HPP
12
#define OPENKALMAN_MIXTUREOFCONTINUOUSDISTRIBUTIONS_HPP
13
14
#include <vector>
15
#include <tuple>
16
#include "distributions/ParticleDistribution.hpp"
17
18
namespace
OpenKalman
{
19
27
template
<
template
<
int
,
bool
,
typename
>
typename
ContinuousDistribution,
28
int
continuous_dimensions,
29
typename
Scalar = double,
30
typename
... OtherProperties>
31
struct
MixtureOfContinuousDistributions
:
32
ParticleDistribution
<
33
ContinuousDistribution<continuous_dimensions, false, Scalar>,
34
Scalar,
// weights
35
OtherProperties...>
36
{
37
public
:
38
MixtureOfContinuousDistributions
()
39
{
40
;
41
}
42
43
const
Mean
mean()
const
44
{
45
ContinuousDistribution<continuous_dimensions, false, Scalar> dist;
46
for
(
auto
& n :
this
) {
47
s
48
}
49
return
x;
50
}
51
52
53
const
Covariance
covariance()
const
54
{
55
return
P_xx;
56
}
57
58
59
const
Covariance
sqrt_covariance()
const
60
{
61
auto
S_xx = P_xx.llt();
62
if
(S_xx.info() != Eigen::Success) {
63
throw
(std::runtime_error(
"GaussianDistribution: covariance is not positive definite"
));
64
}
65
return
S_xx.matrixL().toDenseMatrix();
66
}
67
68
};
69
70
}
71
72
#endif //OPENKALMAN_MIXTUREOFCONTINUOUSDISTRIBUTIONS_HPP
OpenKalman::ParticleDistribution
Distribution of particles.
Definition:
ParticleDistribution.hpp:27
OpenKalman::Mean
A set of one or more column vectors, each representing a statistical mean.
Definition:
forward-class-declarations.hpp:477
OpenKalman
The root namespace for OpenKalman.
Definition:
basics.hpp:34
OpenKalman::Covariance
A self-adjoint Covariance matrix.
Definition:
Covariance.hpp:30
OpenKalman::MixtureOfContinuousDistributions
Weighted mixture of continuous (e.g., Gaussian) distributions.
Definition:
MixtureOfContinuousDistributions.hpp:31
Generated by
1.8.13