gtsam  4.0.0 gtsam
gtsam::Sampler Class Reference

## Detailed Description

Sampling structure that keeps internal random number generators for diagonal distributions specified by NoiseModel.

This is primarily to allow for variable seeds, and does roughly the same thing as sample() in NoiseModel.

## Public Member Functions

Sampler (const noiseModel::Diagonal::shared_ptr &model, int32_t seed=42u)
Create a sampler for the distribution specified by a diagonal NoiseModel with a manually specified seed. More...

Sampler (const Vector &sigmas, int32_t seed=42u)
Create a sampler for a distribution specified by a vector of sigmas directly. More...

Sampler (int32_t seed=42u)
Create a sampler without a given noisemodel - pass in to sample. More...

size_t dim () const
access functions

Vector sigmas () const

const noiseModel::Diagonal::shared_ptr & model () const

Vector sample ()
sample from distribution NOTE: not const due to need to update the underlying generator

Vector sampleNewModel (const noiseModel::Diagonal::shared_ptr &model)
Sample from noisemodel passed in as an argument, can be used without having initialized a model for the system. More...

## Public Types

typedef boost::shared_ptr< Samplershared_ptr

## Protected Member Functions

Vector sampleDiagonal (const Vector &sigmas)
given sigmas for a diagonal model, returns a sample

## Protected Attributes

noiseModel::Diagonal::shared_ptr model_
noiseModel created at generation

boost::mt19937_64 generator_
generator

## ◆ Sampler() [1/3]

 gtsam::Sampler::Sampler ( const noiseModel::Diagonal::shared_ptr & model, int32_t seed = 42u )

Create a sampler for the distribution specified by a diagonal NoiseModel with a manually specified seed.

NOTE: do not use zero as a seed, it will break the generator

## ◆ Sampler() [2/3]

 gtsam::Sampler::Sampler ( const Vector & sigmas, int32_t seed = 42u )

Create a sampler for a distribution specified by a vector of sigmas directly.

NOTE: do not use zero as a seed, it will break the generator

## ◆ Sampler() [3/3]

 gtsam::Sampler::Sampler ( int32_t seed = 42u )

Create a sampler without a given noisemodel - pass in to sample.

NOTE: do not use zero as a seed, it will break the generator

## ◆ sampleNewModel()

 Vector gtsam::Sampler::sampleNewModel ( const noiseModel::Diagonal::shared_ptr & model )

Sample from noisemodel passed in as an argument, can be used without having initialized a model for the system.

NOTE: not const due to need to update the underlying generator

The documentation for this class was generated from the following files:
• /Users/dellaert/git/gtsam/gtsam/linear/Sampler.h
• /Users/dellaert/git/gtsam/gtsam/linear/Sampler.cpp