gtsam  4.0.0
gtsam
Sampler.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
19 #pragma once
20 
22 
23 #include <boost/random.hpp>
24 
25 namespace gtsam {
26 
34 class GTSAM_EXPORT Sampler {
35 protected:
37  noiseModel::Diagonal::shared_ptr model_;
38 
40  boost::mt19937_64 generator_;
41 
42 public:
43  typedef boost::shared_ptr<Sampler> shared_ptr;
44 
51  Sampler(const noiseModel::Diagonal::shared_ptr& model, int32_t seed = 42u);
52 
58  Sampler(const Vector& sigmas, int32_t seed = 42u);
59 
65  Sampler(int32_t seed = 42u);
66 
68  size_t dim() const { assert(model_.get()); return model_->dim(); }
69  Vector sigmas() const { assert(model_.get()); return model_->sigmas(); }
70  const noiseModel::Diagonal::shared_ptr& model() const { return model_; }
71 
76  Vector sample();
77 
84  Vector sampleNewModel(const noiseModel::Diagonal::shared_ptr& model);
85 
86 protected:
87 
89  Vector sampleDiagonal(const Vector& sigmas);
90 
91 };
92 
93 } // \namespace gtsam
boost::mt19937_64 generator_
generator
Definition: Sampler.h:40
Sampling structure that keeps internal random number generators for diagonal distributions specified ...
Definition: Sampler.h:34
noiseModel::Diagonal::shared_ptr model_
noiseModel created at generation
Definition: Sampler.h:37
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
size_t dim() const
access functions
Definition: Sampler.h:68