Main MRPT website
>
C++ reference for MRPT 1.9.9
mrpt
bayes
CProbabilityParticle.h
Go to the documentation of this file.
1
/* +------------------------------------------------------------------------+
2
| Mobile Robot Programming Toolkit (MRPT) |
3
| http://www.mrpt.org/ |
4
| |
5
| Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6
| See: http://www.mrpt.org/Authors - All rights reserved. |
7
| Released under BSD License. See details in http://www.mrpt.org/License |
8
+------------------------------------------------------------------------+ */
9
#pragma once
10
11
#include <
mrpt/containers/deepcopy_ptr.h
>
// copy_ptr<>
12
13
namespace
mrpt
14
{
15
namespace
bayes
16
{
17
/** use for CProbabilityParticle
18
* \ingroup mrpt_bayes_grp
19
*/
20
enum class
particle_storage_mode
21
{
22
VALUE
,
23
POINTER
24
};
25
26
/** A template class for holding a the data and the weight of a particle.
27
* Particles comprise two parts: a "data payload field", and a logarithmic
28
* importance sampling weight.
29
*
30
* \tparam T The type of the payload. Must be default constructable.
31
* \tparam STORAGE If `POINTER`, a (wrapper to a) pointer is used to store
32
* the payload; if `VALUE`, the payload is stored directly as a value.
33
*
34
* \sa CParticleFilterData
35
* \ingroup mrpt_bayes_grp
36
*/
37
template
<
class
T, particle_storage_mode STORAGE>
38
struct
CProbabilityParticle
;
39
40
struct
CProbabilityParticleBase
41
{
42
CProbabilityParticleBase
(
double
logw = 0) :
log_w
(logw) {}
43
/** The (logarithmic) weight value for this particle. */
44
double
log_w
{.0};
45
};
46
47
template
<
class
T>
48
struct
CProbabilityParticle
<T,
particle_storage_mode
::
POINTER
>
49
:
public
CProbabilityParticleBase
50
{
51
/** The data associated with this particle. The use of copy_ptr<> allows
52
* relying on compiler-generated copy ctor, etc. */
53
mrpt::containers::copy_ptr<T>
d{};
54
};
55
56
template
<
class
T>
57
struct
CProbabilityParticle
<T,
particle_storage_mode
::
VALUE
>
58
:
public
CProbabilityParticleBase
59
{
60
CProbabilityParticle
() {}
61
CProbabilityParticle
(
const
T&
data
,
const
double
logw)
62
:
CProbabilityParticleBase
(logw), d(
data
)
63
{
64
}
65
/** The data associated with this particle */
66
T d{};
67
};
68
69
}
// namespace bayes
70
}
// namespace mrpt
mrpt::bayes::CProbabilityParticleBase
Definition:
CProbabilityParticle.h:40
mrpt::bayes::CProbabilityParticleBase::log_w
double log_w
The (logarithmic) weight value for this particle.
Definition:
CProbabilityParticle.h:44
deepcopy_ptr.h
mrpt::bayes::particle_storage_mode
particle_storage_mode
use for CProbabilityParticle
Definition:
CProbabilityParticle.h:20
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition:
CKalmanFilterCapable.h:30
mrpt::bayes::CProbabilityParticle
A template class for holding a the data and the weight of a particle.
Definition:
CProbabilityParticle.h:38
data
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition:
glext.h:3547
mrpt::containers::internal::generic_copier_ptr
Definition:
deepcopy_ptr.h:47
mrpt::bayes::CProbabilityParticleBase::CProbabilityParticleBase
CProbabilityParticleBase(double logw=0)
Definition:
CProbabilityParticle.h:42
mrpt::bayes::CProbabilityParticle< T, particle_storage_mode::VALUE >::CProbabilityParticle
CProbabilityParticle(const T &data, const double logw)
Definition:
CProbabilityParticle.h:61
mrpt::bayes::particle_storage_mode::VALUE
@ VALUE
mrpt::bayes::particle_storage_mode::POINTER
@ POINTER
mrpt::bayes::CProbabilityParticle< T, particle_storage_mode::VALUE >::CProbabilityParticle
CProbabilityParticle()
Definition:
CProbabilityParticle.h:60
Page generated by
Doxygen 1.8.17
for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST