g2o
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
g2o::GaussianSampler< SampleType, CovarianceType > Class Template Reference

#include <sampler.h>

Public Member Functions

 GaussianSampler (GaussianSampler const &)=delete
 
GaussianSampleroperator= (const GaussianSampler &)=delete
 
 GaussianSampler (bool hasGenerator=true)
 
void setDistribution (const CovarianceType &cov)
 
SampleType generateSample ()
 return a sample of the Gaussian distribution
 
bool seed (int s)
 

Protected Attributes

CovarianceType _cholesky
 
std::unique_ptr< std::mt19937 > _generator
 

Detailed Description

template<class SampleType, class CovarianceType>
class g2o::GaussianSampler< SampleType, CovarianceType >

Definition at line 47 of file sampler.h.

Constructor & Destructor Documentation

◆ GaussianSampler() [1/2]

template<class SampleType , class CovarianceType >
g2o::GaussianSampler< SampleType, CovarianceType >::GaussianSampler ( GaussianSampler< SampleType, CovarianceType > const &  )
delete

◆ GaussianSampler() [2/2]

template<class SampleType , class CovarianceType >
g2o::GaussianSampler< SampleType, CovarianceType >::GaussianSampler ( bool  hasGenerator = true)
inline

Definition at line 51 of file sampler.h.

52 : _generator(hasGenerator ? new std::mt19937 : nullptr) {}
std::unique_ptr< std::mt19937 > _generator
Definition sampler.h:80

Member Function Documentation

◆ generateSample()

template<class SampleType , class CovarianceType >
SampleType g2o::GaussianSampler< SampleType, CovarianceType >::generateSample ( )
inline

◆ operator=()

template<class SampleType , class CovarianceType >
GaussianSampler & g2o::GaussianSampler< SampleType, CovarianceType >::operator= ( const GaussianSampler< SampleType, CovarianceType > &  )
delete

◆ seed()

template<class SampleType , class CovarianceType >
bool g2o::GaussianSampler< SampleType, CovarianceType >::seed ( int  s)
inline

seed the random number generator, returns false if not having an own generator.

Definition at line 72 of file sampler.h.

72 {
73 if (!_generator) return false;
74 _generator->seed(s);
75 return true;
76 }

References g2o::GaussianSampler< SampleType, CovarianceType >::_generator.

Referenced by main().

◆ setDistribution()

template<class SampleType , class CovarianceType >
void g2o::GaussianSampler< SampleType, CovarianceType >::setDistribution ( const CovarianceType &  cov)
inline

Definition at line 53 of file sampler.h.

53 {
54 Eigen::LLT<CovarianceType> cholDecomp;
55 cholDecomp.compute(cov);
56 if (cholDecomp.info() == Eigen::NumericalIssue) {
57 assert(false && "Cholesky decomposition on the covariance matrix failed");
58 return;
59 }
60 _cholesky = cholDecomp.matrixL();
61 }

References g2o::GaussianSampler< SampleType, CovarianceType >::_cholesky.

Referenced by main(), g2o::UnarySensor< RobotType_, EdgeType_ >::setInformation(), and g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::setInformation().

Member Data Documentation

◆ _cholesky

template<class SampleType , class CovarianceType >
CovarianceType g2o::GaussianSampler< SampleType, CovarianceType >::_cholesky
protected

◆ _generator

template<class SampleType , class CovarianceType >
std::unique_ptr<std::mt19937> g2o::GaussianSampler< SampleType, CovarianceType >::_generator
protected

The documentation for this class was generated from the following file: