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
gtsam::SubgraphBuilderParameters
Definition: SubgraphBuilder.h:102
VectorValues
gtsam::Preconditioner
Definition: Preconditioner.h:64
gtsam::operator^
Vector operator^(const Matrix &A, const Vector &v)
Definition: Matrix.cpp:128
GaussianFactorGraph.h
Linear Factor Graph where all factors are Gaussians.
alpha
RealScalar alpha
Definition: level1_cplx_impl.h:147
s
RealScalar s
Definition: level1_cplx_impl.h:126
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
x
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
Definition: gnuplot_common_settings.hh:12
gtsam::SubgraphPreconditioner::b2bar_
Errors b2bar_
A2*xbar - b2.
Definition: SubgraphPreconditioner.h:63
gtsam::SubgraphPreconditioner
Definition: SubgraphPreconditioner.h:54
noxfile.build
None build(nox.Session session)
Definition: noxfile.py:96
GaussianBayesNet.h
Chordal Bayes Net, the result of eliminating a factor graph.
gtsam::Vector
Eigen::VectorXd Vector
Definition: Vector.h:38
gtsam::PreconditionerParameters
Definition: Preconditioner.h:24
gtsam::KeyInfo
Definition: IterativeSolver.h:127
gtsam::operator*
Point2 operator*(double s, const Point2 &p)
multiply with scalar
Definition: Point2.h:52
gtsam::GaussianFactorGraph
Definition: GaussianFactorGraph.h:73
gtsam::print
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:155
gtsam::SubgraphPreconditioner::Rc1_
GaussianBayesNet Rc1_
Definition: SubgraphPreconditioner.h:61
gtsam::VectorValues
Definition: VectorValues.h:74
gtsam::SubgraphPreconditioner::Ab2_
GaussianFactorGraph Ab2_
Definition: SubgraphPreconditioner.h:60
IterativeSolver.h
Some support classes for iterative solvers.
gtsam::SubgraphPreconditioner::Rc1
const GaussianBayesNet & Rc1() const
Definition: SubgraphPreconditioner.h:90
gtsam::VectorValues::Zero
static VectorValues Zero(const VectorValues &other)
Definition: VectorValues.cpp:77
gtsam::SubgraphPreconditioner::keyInfo_
KeyInfo keyInfo_
Definition: SubgraphPreconditioner.h:65
info
else if n * info
Definition: 3rdparty/Eigen/lapack/cholesky.cpp:18
Errors.h
vector of errors
VectorValues.h
Factor Graph Values.
gtsam::FastList< Vector >
gtsam::SubgraphPreconditionerParameters::builderParams
SubgraphBuilderParameters builderParams
Definition: SubgraphPreconditioner.h:44
lambda
static double lambda[]
Definition: jv.c:524
y
Scalar * y
Definition: level1_cplx_impl.h:124
gtsam::SubgraphPreconditionerParameters::SubgraphPreconditionerParameters
SubgraphPreconditionerParameters(const SubgraphBuilderParameters &p=SubgraphBuilderParameters())
Definition: SubgraphPreconditioner.h:42
gtsam::SubgraphPreconditionerParameters
Definition: SubgraphPreconditioner.h:40
gtsam
traits
Definition: SFMdata.h:40
error
static double error
Definition: testRot3.cpp:37
p
float * p
Definition: Tutorial_Map_using.cpp:9
Preconditioner.h
SubgraphBuilder.h
gtsam::SubgraphPreconditionerParameters::shared_ptr
std::shared_ptr< SubgraphPreconditionerParameters > shared_ptr
Definition: SubgraphPreconditioner.h:41
gtsam::SubgraphPreconditioner::parameters_
SubgraphPreconditionerParameters parameters_
Definition: SubgraphPreconditioner.h:66
gtsam::SubgraphPreconditioner::~SubgraphPreconditioner
~SubgraphPreconditioner() override
Definition: SubgraphPreconditioner.h:81
Eigen::placeholders::end
static const EIGEN_DEPRECATED end_t end
Definition: IndexedViewHelper.h:181
gtsam::SubgraphPreconditioner::b2bar
const Errors b2bar() const
Definition: SubgraphPreconditioner.h:93
gtsam::SubgraphPreconditioner::xbar_
VectorValues xbar_
A1 \ b1.
Definition: SubgraphPreconditioner.h:62
gtsam::SubgraphPreconditioner::Ab2
const GaussianFactorGraph & Ab2() const
Definition: SubgraphPreconditioner.h:87
gtsam::GaussianBayesNet
Definition: GaussianBayesNet.h:35
gtsam::SubgraphPreconditioner::shared_ptr
std::shared_ptr< SubgraphPreconditioner > shared_ptr
Definition: SubgraphPreconditioner.h:57
gtsam::SubgraphPreconditioner::zero
VectorValues zero() const
Definition: SubgraphPreconditioner.h:104


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:05:01