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 /* ************************************************************************* */
36  using symbol_shorthand::X;
37  // Let's make a scalar synchronization graph with 4 nodes
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 /* ************************************************************************* */
50  using symbol_shorthand::X;
51  // Let's make a scalar synchronization graph with 10 nodes
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
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:610
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 Tue Jul 4 2023 02:35:15