GTSAM
4.0.2
C++ library for smoothing and mapping (SAM)
|
#include <SubgraphPreconditioner.h>
Public Types | |
typedef std::shared_ptr< SubgraphPreconditioner > | shared_ptr |
typedef std::vector< size_t > | Dimensions |
Public Member Functions | |
SubgraphPreconditioner (const SubgraphPreconditionerParameters &p=SubgraphPreconditionerParameters()) | |
SubgraphPreconditioner (const GaussianFactorGraph &Ab2, const GaussianBayesNet &Rc1, const VectorValues &xbar, const SubgraphPreconditionerParameters &p=SubgraphPreconditionerParameters()) | |
void | print (const std::string &s="SubgraphPreconditioner") const |
const GaussianFactorGraph & | Ab2 () const |
const GaussianBayesNet & | Rc1 () const |
const Errors | b2bar () const |
VectorValues | x (const VectorValues &y) const |
VectorValues | zero () const |
void | transposeMultiplyAdd2 (double alpha, Errors::const_iterator begin, Errors::const_iterator end, VectorValues &y) const |
double | error (const VectorValues &y) const |
VectorValues | gradient (const VectorValues &y) const |
Errors | operator* (const VectorValues &y) const |
void | multiplyInPlace (const VectorValues &y, Errors &e) const |
VectorValues | operator^ (const Errors &e) const |
void | transposeMultiplyAdd (double alpha, const Errors &e, VectorValues &y) const |
void | solve (const Vector &y, Vector &x) const override |
implement x = R^{-1} y | |
void | transposeSolve (const Vector &y, Vector &x) const override |
implement x = R^{-T} y | |
void | build (const GaussianFactorGraph &gfg, const KeyInfo &info, const std::map< Key, Vector > &lambda) override |
build/factorize the preconditioner | |
Subgraph conditioner class, as explained in the RSS 2010 submission. Starting with a graph A*x=b, we split it in two systems A1*x=b1 and A2*x=b2 We solve R1*x=c1, and make the substitution y=R1*x-c1. To use the class, give the Bayes Net R1*x=c1 and Graph A2*x=b2. Then solve for yhat using CG, and solve for xhat = system.x(yhat).
gtsam::SubgraphPreconditioner::SubgraphPreconditioner | ( | const GaussianFactorGraph & | Ab2, |
const GaussianBayesNet & | Rc1, | ||
const VectorValues & | xbar, | ||
const SubgraphPreconditionerParameters & | p = SubgraphPreconditionerParameters() |
||
) |
Constructor
Ab2 | the Graph A2*x=b2 |
Rc1 | the Bayes Net R1*x=c1 |
xbar | the solution to R1*x=c1 |
|
inline |
Access Ab2
|
inline |
Access b2bar
VectorValues gtsam::SubgraphPreconditioner::gradient | ( | const VectorValues & | y | ) | const |
gradient = y + inv(R1')*A2'*(A2*inv(R1)*y-b2bar)
void gtsam::SubgraphPreconditioner::multiplyInPlace | ( | const VectorValues & | y, |
Errors & | e | ||
) | const |
Apply operator A in place: needs e allocated already
Errors gtsam::SubgraphPreconditioner::operator* | ( | const VectorValues & | y | ) | const |
Apply operator A
VectorValues gtsam::SubgraphPreconditioner::operator^ | ( | const Errors & | e | ) | const |
Apply operator A'
void gtsam::SubgraphPreconditioner::print | ( | const std::string & | s = "SubgraphPreconditioner" | ) | const |
print the object
|
inline |
Access Rc1
void gtsam::SubgraphPreconditioner::transposeMultiplyAdd | ( | double | alpha, |
const Errors & | e, | ||
VectorValues & | y | ||
) | const |
Add A'e to y y += alpha*A'[e1;e2] = [alpha*e1; alpha*inv(R1')*A2'*e2]
void gtsam::SubgraphPreconditioner::transposeMultiplyAdd2 | ( | double | alpha, |
Errors::const_iterator | begin, | ||
Errors::const_iterator | end, | ||
VectorValues & | y | ||
) | const |
Add constraint part of the error only y += alpha*inv(R1')*A2'*e2 Takes a range indicating e2 !!!!
VectorValues gtsam::SubgraphPreconditioner::x | ( | const VectorValues & | y | ) | const |
Add zero-mean i.i.d. Gaussian prior terms to each variable
sigma | Standard deviation of Gaussian |