gtsam
linear
tests
powerMethodExample.h
Go to the documentation of this file.
1
/* ----------------------------------------------------------------------------
2
3
* GTSAM Copyright 2010-2019, 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
22
#pragma once
23
24
#include <
gtsam/inference/Symbol.h
>
25
26
#include <iostream>
27
28
29
namespace
gtsam
{
30
namespace
linear {
31
namespace
test
{
32
namespace
example
{
33
34
/* ************************************************************************* */
35
inline
GaussianFactorGraph
createSparseGraph
() {
36
using
symbol_shorthand::X
;
37
// Let's make a scalar synchronization graph with 4 nodes
38
GaussianFactorGraph
fg;
39
auto
model
=
noiseModel::Unit::Create
(1);
40
for
(
size_t
j
= 0;
j
< 3;
j
++) {
41
fg.
add
(
X
(
j
), -
I_1x1
,
X
(
j
+ 1),
I_1x1
, Vector1::Zero(),
model
);
42
}
43
fg.
add
(
X
(3), -
I_1x1
,
X
(0),
I_1x1
, Vector1::Zero(),
model
);
// extra row
44
45
return
fg;
46
}
47
48
/* ************************************************************************* */
49
inline
GaussianFactorGraph
createDenseGraph
() {
50
using
symbol_shorthand::X
;
51
// Let's make a scalar synchronization graph with 10 nodes
52
GaussianFactorGraph
fg;
53
auto
model
=
noiseModel::Unit::Create
(1);
54
// Iterate over nodes
55
for
(
size_t
j
= 0;
j
< 10;
j
++) {
56
// Each node has an edge with all the others
57
for
(
size_t
i
= 1;
i
< 10;
i
++)
58
fg.
add
(
X
(
j
), -
I_1x1
,
X
((
j
+
i
) % 10),
I_1x1
, Vector1::Zero(),
model
);
59
}
60
61
return
fg;
62
}
63
64
/* ************************************************************************* */
65
66
}
// namespace example
67
}
// namespace test
68
}
// namespace linear
69
}
// namespace gtsam
gtsam::linear::test::example::createDenseGraph
GaussianFactorGraph createDenseGraph()
Definition:
powerMethodExample.h:49
X
#define X
Definition:
icosphere.cpp:20
gtsam::linear::test::example::createSparseGraph
GaussianFactorGraph createSparseGraph()
Definition:
powerMethodExample.h:35
test
Definition:
test.py:1
example
Definition:
testOrdering.cpp:28
gtsam::GaussianFactorGraph
Definition:
GaussianFactorGraph.h:73
gtsam::symbol_shorthand::X
Key X(std::uint64_t j)
Definition:
inference/Symbol.h:171
j
std::ptrdiff_t j
Definition:
tut_arithmetic_redux_minmax.cpp:2
gtsam::noiseModel::Unit::Create
static shared_ptr Create(size_t dim)
Definition:
NoiseModel.h:631
Symbol.h
model
noiseModel::Diagonal::shared_ptr model
Definition:
doc/Code/Pose2SLAMExample.cpp:7
gtsam
traits
Definition:
ABC.h:17
test_GaussianBayesNet.I_1x1
I_1x1
Definition:
test_GaussianBayesNet.py:26
i
int i
Definition:
BiCGSTAB_step_by_step.cpp:9
gtsam::GaussianFactorGraph::add
void add(const GaussianFactor &factor)
Definition:
GaussianFactorGraph.h:125
gtsam
Author(s):
autogenerated on Wed May 28 2025 03:02:36