Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Enumerations
a
c
d
e
f
g
i
k
l
m
n
p
q
r
s
t
u
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Classes
Class List
Class Hierarchy
Class Members
All
!
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
!
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
f
k
l
m
n
o
p
r
s
t
v
z
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Related Functions
:
a
b
c
d
e
g
h
i
l
m
n
o
p
r
s
t
u
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
x
z
Enumerations
Enumerator
b
c
e
f
g
i
l
m
n
o
p
r
s
t
u
v
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
gtsam
linear
tests
testSampler.cpp
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
#include <
CppUnitLite/TestHarness.h
>
20
21
#include <
gtsam/linear/Sampler.h
>
22
23
using namespace
gtsam
;
24
25
const
double
tol
= 1
e
-5;
26
27
static
const
Vector3
kSigmas
(1.0, 0.1, 0.0);
28
29
/* ************************************************************************* */
30
TEST
(testSampler, basic) {
31
auto
model
=
noiseModel::Diagonal::Sigmas
(
kSigmas
);
32
char
seed =
'A'
;
33
Sampler
sampler1(
model
, seed), sampler2(
model
, 1), sampler3(
model
, 1);
34
EXPECT
(
assert_equal
(
kSigmas
, sampler1.sigmas()));
35
EXPECT
(
assert_equal
(
kSigmas
, sampler2.sigmas()));
36
EXPECT_LONGS_EQUAL
(3, sampler1.dim());
37
EXPECT_LONGS_EQUAL
(3, sampler2.dim());
38
Vector
actual1 = sampler1.sample();
39
EXPECT_DOUBLES_EQUAL
(0.0, actual1(2),
tol
);
40
EXPECT
(
assert_equal
(sampler2.sample(), sampler3.
sample
(),
tol
));
41
}
42
43
/* ************************************************************************* */
44
int
main
() {
45
TestResult
tr;
46
return
TestRegistry::runAllTests
(tr);
47
}
48
/* ************************************************************************* */
TestRegistry::runAllTests
static int runAllTests(TestResult &result)
Definition:
TestRegistry.cpp:27
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
EXPECT_LONGS_EQUAL
#define EXPECT_LONGS_EQUAL(expected, actual)
Definition:
Test.h:154
EXPECT
#define EXPECT(condition)
Definition:
Test.h:150
TestHarness.h
gtsam::noiseModel::Diagonal::Sigmas
static shared_ptr Sigmas(const Vector &sigmas, bool smart=true)
Definition:
NoiseModel.cpp:283
gtsam::Vector3
Eigen::Vector3d Vector3
Definition:
Vector.h:44
gtsam::Vector
Eigen::VectorXd Vector
Definition:
Vector.h:39
kSigmas
static const Vector3 kSigmas(1.0, 0.1, 0.0)
model
noiseModel::Diagonal::shared_ptr model
Definition:
doc/Code/Pose2SLAMExample.cpp:7
EXPECT_DOUBLES_EQUAL
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
Definition:
Test.h:161
TestResult
Definition:
TestResult.h:26
gtsam::Sampler::sample
Vector sample() const
sample from distribution
Definition:
Sampler.cpp:62
gtsam
traits
Definition:
SFMdata.h:40
gtsam::TEST
TEST(SmartFactorBase, Pinhole)
Definition:
testSmartFactorBase.cpp:38
main
int main()
Definition:
testSampler.cpp:44
gtsam::assert_equal
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition:
Matrix.cpp:41
gtsam::tol
const G double tol
Definition:
Group.h:79
Sampler.h
sampling from a NoiseModel
gtsam::Sampler
Definition:
Sampler.h:31
gtsam
Author(s):
autogenerated on Wed Mar 19 2025 03:07:39