gtsam 4.1.1
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 <random>
24
25namespace gtsam {
26
31class GTSAM_EXPORT Sampler {
32 protected:
34 noiseModel::Diagonal::shared_ptr model_;
35
37 mutable std::mt19937_64 generator_;
38
39 public:
40 typedef boost::shared_ptr<Sampler> shared_ptr;
41
44
51 explicit Sampler(const noiseModel::Diagonal::shared_ptr& model,
52 uint_fast64_t seed = 42u);
53
60 explicit Sampler(const Vector& sigmas, uint_fast64_t seed = 42u);
61
65
66 size_t dim() const {
67 assert(model_.get());
68 return model_->dim();
69 }
70
71 Vector sigmas() const {
72 assert(model_.get());
73 return model_->sigmas();
74 }
75
76 const noiseModel::Diagonal::shared_ptr& model() const { return model_; }
77
81
83 Vector sample() const;
84
86
87 protected:
89 Vector sampleDiagonal(const Vector& sigmas) const;
90};
91
92} // namespace gtsam
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
Sampling structure that keeps internal random number generators for diagonal distributions specified ...
Definition: Sampler.h:31
noiseModel::Diagonal::shared_ptr model_
noiseModel created at generation
Definition: Sampler.h:34
std::mt19937_64 generator_
generator
Definition: Sampler.h:37