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 #include <gtsam/inference/Symbol.h>
23 
24 #include <iostream>
25 
26 
27 namespace gtsam {
28 namespace linear {
29 namespace test {
30 namespace example {
31 
32 /* ************************************************************************* */
34  using symbol_shorthand::X;
35  // Let's make a scalar synchronization graph with 4 nodes
38  for (size_t j = 0; j < 3; j++) {
39  fg.add(X(j), -I_1x1, X(j + 1), I_1x1, Vector1::Zero(), model);
40  }
41  fg.add(X(3), -I_1x1, X(0), I_1x1, Vector1::Zero(), model); // extra row
42 
43  return fg;
44 }
45 
46 /* ************************************************************************* */
48  using symbol_shorthand::X;
49  // Let's make a scalar synchronization graph with 10 nodes
52  // Iterate over nodes
53  for (size_t j = 0; j < 10; j++) {
54  // Each node has an edge with all the others
55  for (size_t i = 1; i < 10; i++)
56  fg.add(X(j), -I_1x1, X((j + i) % 10), I_1x1, Vector1::Zero(), model);
57  }
58 
59  return fg;
60 }
61 
62 /* ************************************************************************* */
63 
64 } // namespace example
65 } // namespace test
66 } // namespace linear
67 } // namespace gtsam
GaussianFactorGraph createSparseGraph()
noiseModel::Diagonal::shared_ptr model
Definition: test.py:1
Key X(std::uint64_t j)
static shared_ptr Create(size_t dim)
Definition: NoiseModel.h:608
void add(const GaussianFactor &factor)
traits
Definition: chartTesting.h:28
GaussianFactorGraph createDenseGraph()
#define X
Definition: icosphere.cpp:20
std::ptrdiff_t j


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:43:28