SubgraphPreconditioner.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 
18 #pragma once
19 
21 #include <gtsam/linear/Errors.h>
27 #include <gtsam/dllexport.h>
28 
29 #include <memory>
30 
31 #include <map>
32 
33 namespace gtsam {
34 
35  // Forward declarations
36  class GaussianBayesNet;
37  class GaussianFactorGraph;
38  class VectorValues;
39 
41  typedef std::shared_ptr<SubgraphPreconditionerParameters> shared_ptr;
43  : builderParams(p) {}
45  };
46 
54  class GTSAM_EXPORT SubgraphPreconditioner : public Preconditioner {
55 
56  public:
57  typedef std::shared_ptr<SubgraphPreconditioner> shared_ptr;
58 
59  private:
64 
67 
68  public:
69 
71 
78  SubgraphPreconditioner(const GaussianFactorGraph& Ab2, const GaussianBayesNet& Rc1, const VectorValues& xbar,
80 
82 
84  void print(const std::string& s = "SubgraphPreconditioner") const;
85 
87  const GaussianFactorGraph& Ab2() const { return Ab2_; }
88 
90  const GaussianBayesNet& Rc1() const { return Rc1_; }
91 
93  const Errors b2bar() const { return b2bar_; }
94 
100  /* x = xbar + inv(R1)*y */
101  VectorValues x(const VectorValues& y) const;
102 
103  /* A zero VectorValues with the structure of xbar */
104  VectorValues zero() const {
105  return VectorValues::Zero(xbar_);
106  }
107 
113  void transposeMultiplyAdd2(double alpha, Errors::const_iterator begin,
114  Errors::const_iterator end, VectorValues& y) const;
115 
116  /* error, given y */
117  double error(const VectorValues& y) const;
118 
120  VectorValues gradient(const VectorValues& y) const;
121 
123  Errors operator*(const VectorValues& y) const;
124 
126  void multiplyInPlace(const VectorValues& y, Errors& e) const;
127 
129  VectorValues operator^(const Errors& e) const;
130 
135  void transposeMultiplyAdd(double alpha, const Errors& e, VectorValues& y) const;
136 
137  /*****************************************************************************/
138  /* implement virtual functions of Preconditioner */
139 
141  void solve(const Vector& y, Vector &x) const override;
142 
144  void transposeSolve(const Vector& y, Vector& x) const override;
145 
147  void build(
148  const GaussianFactorGraph &gfg,
149  const KeyInfo &info,
150  const std::map<Key,Vector> &lambda
151  ) override;
152  /*****************************************************************************/
153  };
154 
155 } // namespace gtsam
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:155
std::shared_ptr< SubgraphPreconditioner > shared_ptr
vector of errors
Scalar * y
def build
Definition: noxfile.py:86
SubgraphPreconditionerParameters(const SubgraphBuilderParameters &p=SubgraphBuilderParameters())
Point2 operator*(double s, const Point2 &p)
multiply with scalar
Definition: Point2.h:52
std::shared_ptr< SubgraphPreconditionerParameters > shared_ptr
const GaussianBayesNet & Rc1() const
else if n * info
Factor Graph Values.
SubgraphPreconditionerParameters parameters_
Eigen::VectorXd Vector
Definition: Vector.h:38
Vector operator^(const Matrix &A, const Vector &v)
Definition: Matrix.cpp:128
static VectorValues Zero(const VectorValues &other)
RealScalar alpha
Array< double, 1, 3 > e(1./3., 0.5, 2.)
RealScalar s
Linear Factor Graph where all factors are Gaussians.
Some support classes for iterative solvers.
cout<< "The eigenvalues of A are:"<< endl<< ces.eigenvalues()<< endl;cout<< "The matrix of eigenvectors, V, is:"<< endl<< ces.eigenvectors()<< endl<< endl;complex< float > lambda
traits
Definition: chartTesting.h:28
static EIGEN_DEPRECATED const end_t end
float * p
Chordal Bayes Net, the result of eliminating a factor graph.
static double error
Definition: testRot3.cpp:37
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
const GaussianFactorGraph & Ab2() const


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:36:21