|
gtsam
|
Sampling structure that keeps internal random number generators for diagonal distributions specified by NoiseModel.
basic functionality | |
| Vector | sample () const |
| sample from distribution | |
| template<typename T> | |
| T | perturb (const T &value) const |
| Perturb a value by sampling in its tangent space and applying retract. | |
| static Vector | sampleDiagonal (const Vector &sigmas, std::mt19937_64 *rng) |
| sample with given random number generator | |
Public Member Functions | |
constructors | |
| Sampler (const noiseModel::Diagonal::shared_ptr &model, uint_fast64_t seed=42u) | |
| Create a sampler for the distribution specified by a diagonal NoiseModel with a manually specified seed. | |
| Sampler (const noiseModel::Diagonal::shared_ptr &model, std::mt19937_64 &rng) | |
| Create a sampler that draws from a caller-supplied RNG (stateful). | |
| Sampler (const Vector &sigmas, uint_fast64_t seed=42u) | |
| Create a sampler for a distribution specified by a vector of sigmas directly. | |
| Sampler (const Vector &sigmas, std::mt19937_64 &rng) | |
| Create a sampler for sigmas that draws from a caller-supplied RNG (stateful). | |
access functions | |
| size_t | dim () const |
| Vector | sigmas () const |
| const noiseModel::Diagonal::shared_ptr & | model () const |
Public Types | |
| typedef std::shared_ptr< Sampler > | shared_ptr |
Protected Member Functions | |
| Vector | sampleDiagonal (const Vector &sigmas) const |
| Given sigmas for a diagonal model, returns a sample. | |
Protected Attributes | |
| noiseModel::Diagonal::shared_ptr | model_ |
| noiseModel created at generation | |
| std::mt19937_64 | generator_ |
| generator | |
| std::mt19937_64 * | externalGenerator_ = nullptr |
| Non-owning optional external generator. If non-null, sampling uses this. | |
|
explicit |
Create a sampler for the distribution specified by a diagonal NoiseModel with a manually specified seed.
This constructor is convenient for deterministic, throw-away sampling. If you need stateful sampling across calls or across multiple Sampler instances, prefer the RNG-based constructor and manage the RNG yourself.
NOTE: do not use zero as a seed, it will break the generator.
|
explicit |
Create a sampler that draws from a caller-supplied RNG (stateful).
The RNG is non-owning and must outlive this Sampler.
|
explicit |
Create a sampler for a distribution specified by a vector of sigmas directly.
This constructor is convenient for deterministic, throw-away sampling. If you need stateful sampling across calls or across multiple Sampler instances, prefer the RNG-based constructor and manage the RNG yourself.
NOTE: do not use zero as a seed, it will break the generator.
|
explicit |
Create a sampler for sigmas that draws from a caller-supplied RNG (stateful).
The RNG is non-owning and must outlive this Sampler.
|
inline |
Perturb a value by sampling in its tangent space and applying retract.
The supplied noise model must match the dimensionality expected by T.
|
protected |
Given sigmas for a diagonal model, returns a sample.
Uses external RNG if available.