MRPT
1.9.9
mrpt
bayes
CProbabilityParticle.h
Go to the documentation of this file.
1
/* +------------------------------------------------------------------------+
2
| Mobile Robot Programming Toolkit (MRPT) |
3
| https://www.mrpt.org/ |
4
| |
5
| Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6
| See: https://www.mrpt.org/Authors - All rights reserved. |
7
| Released under BSD License. See: https://www.mrpt.org/License |
8
+------------------------------------------------------------------------+ */
9
#pragma once
10
11
#include <
mrpt/containers/deepcopy_ptr.h
>
// copy_ptr<>
12
13
namespace
mrpt::bayes
14
{
15
/** use for CProbabilityParticle
16
* \ingroup mrpt_bayes_grp
17
*/
18
enum class
particle_storage_mode
19
{
20
VALUE
,
21
POINTER
22
};
23
24
/** A template class for holding a the data and the weight of a particle.
25
* Particles comprise two parts: a "data payload field", and a logarithmic
26
* importance sampling weight.
27
*
28
* \tparam T The type of the payload. Must be default constructable.
29
* \tparam STORAGE If `POINTER`, a (wrapper to a) pointer is used to store
30
* the payload; if `VALUE`, the payload is stored directly as a value.
31
*
32
* \sa CParticleFilterData
33
* \ingroup mrpt_bayes_grp
34
*/
35
template
<
class
T, particle_storage_mode STORAGE>
36
struct
CProbabilityParticle
;
37
38
struct
CProbabilityParticleBase
39
{
40
CProbabilityParticleBase
(
double
logw = 0) :
log_w
(logw) {}
41
/** The (logarithmic) weight value for this particle. */
42
double
log_w
{.0};
43
};
44
45
template
<
class
T>
46
struct
CProbabilityParticle
<T,
particle_storage_mode
::
POINTER
>
47
:
public
CProbabilityParticleBase
48
{
49
/** The data associated with this particle. The use of copy_ptr<> allows
50
* relying on compiler-generated copy ctor, etc. */
51
mrpt::containers::copy_ptr<T>
d{};
52
};
53
54
template
<
class
T>
55
struct
CProbabilityParticle
<T,
particle_storage_mode
::
VALUE
>
56
:
public
CProbabilityParticleBase
57
{
58
CProbabilityParticle
() =
default
;
59
CProbabilityParticle
(
const
T&
data
,
const
double
logw)
60
:
CProbabilityParticleBase
(logw), d(
data
)
61
{
62
}
63
/** The data associated with this particle */
64
T d{};
65
};
66
67
}
// namespace mrpt::bayes
mrpt::bayes::CProbabilityParticleBase
Definition:
CProbabilityParticle.h:38
mrpt::bayes
The namespace for Bayesian filtering algorithm: different particle filters and Kalman filter algorith...
Definition:
CKalmanFilterCapable.h:30
mrpt::containers::internal::generic_copier_ptr
Definition:
deepcopy_ptr.h:47
mrpt::bayes::particle_storage_mode::POINTER
mrpt::bayes::CProbabilityParticleBase::log_w
double log_w
The (logarithmic) weight value for this particle.
Definition:
CProbabilityParticle.h:42
mrpt::bayes::particle_storage_mode::VALUE
mrpt::bayes::CProbabilityParticle
A template class for holding a the data and the weight of a particle.
Definition:
CProbabilityParticle.h:36
mrpt::bayes::CProbabilityParticleBase::CProbabilityParticleBase
CProbabilityParticleBase(double logw=0)
Definition:
CProbabilityParticle.h:40
mrpt::bayes::CProbabilityParticle< T, particle_storage_mode::VALUE >::CProbabilityParticle
CProbabilityParticle(const T &data, const double logw)
Definition:
CProbabilityParticle.h:59
mrpt::bayes::particle_storage_mode
particle_storage_mode
use for CProbabilityParticle
Definition:
CProbabilityParticle.h:18
deepcopy_ptr.h
mrpt::opengl::internal::data
static struct FontData data
Definition:
gltext.cpp:144
Page generated by
Doxygen 1.8.14
for MRPT 1.9.9 Git: c7a3bec24 Sun Mar 29 18:33:13 2020 +0200 at dom mar 29 18:50:38 CEST 2020