Added comments, removed cruft

release/4.3a0
Frank Dellaert 2019-04-04 22:57:27 -04:00
parent 9581e4939b
commit a7826ab417
2 changed files with 21 additions and 28 deletions

View File

@ -70,21 +70,20 @@ public:
Preconditioner() {} Preconditioner() {}
virtual ~Preconditioner() {} virtual ~Preconditioner() {}
/* Computation Interfaces */ /*
* Abstract interface for raw vectors. VectorValues is a speed bottleneck
* and Yong-Dian has profiled preconditioners (outside GTSAM) with the the
* three methods below. In GTSAM, unfortunately, we are still using the
* VectorValues methods called in iterative-inl.h
*/
/* implement x = L^{-1} y */ /// implement x = L^{-1} y
virtual void solve(const Vector& y, Vector &x) const = 0; virtual void solve(const Vector& y, Vector &x) const = 0;
// virtual void solve(const VectorValues& y, VectorValues &x) const = 0;
/* implement x = L^{-T} y */ /// implement x = L^{-T} y
virtual void transposeSolve(const Vector& y, Vector& x) const = 0; virtual void transposeSolve(const Vector& y, Vector& x) const = 0;
// virtual void transposeSolve(const VectorValues& y, VectorValues &x) const = 0;
// /* implement x = L^{-1} L^{-T} y */ /// build/factorize the preconditioner
// virtual void fullSolve(const Vector& y, Vector &x) const = 0;
// virtual void fullSolve(const VectorValues& y, VectorValues &x) const = 0;
/* build/factorize the preconditioner */
virtual void build( virtual void build(
const GaussianFactorGraph &gfg, const GaussianFactorGraph &gfg,
const KeyInfo &info, const KeyInfo &info,
@ -113,14 +112,7 @@ public:
/* Computation Interfaces for raw vector */ /* Computation Interfaces for raw vector */
virtual void solve(const Vector& y, Vector &x) const { x = y; } virtual void solve(const Vector& y, Vector &x) const { x = y; }
// virtual void solve(const VectorValues& y, VectorValues& x) const { x = y; }
virtual void transposeSolve(const Vector& y, Vector& x) const { x = y; } virtual void transposeSolve(const Vector& y, Vector& x) const { x = y; }
// virtual void transposeSolve(const VectorValues& y, VectorValues& x) const { x = y; }
// virtual void fullSolve(const Vector& y, Vector &x) const { x = y; }
// virtual void fullSolve(const VectorValues& y, VectorValues& x) const { x = y; }
virtual void build( virtual void build(
const GaussianFactorGraph &gfg, const GaussianFactorGraph &gfg,
const KeyInfo &info, const KeyInfo &info,
@ -145,8 +137,6 @@ public:
/* Computation Interfaces for raw vector */ /* Computation Interfaces for raw vector */
virtual void solve(const Vector& y, Vector &x) const; virtual void solve(const Vector& y, Vector &x) const;
virtual void transposeSolve(const Vector& y, Vector& x) const ; virtual void transposeSolve(const Vector& y, Vector& x) const ;
// virtual void fullSolve(const Vector& y, Vector &x) const ;
virtual void build( virtual void build(
const GaussianFactorGraph &gfg, const GaussianFactorGraph &gfg,
const KeyInfo &info, const KeyInfo &info,

View File

@ -285,15 +285,18 @@ namespace gtsam {
/*****************************************************************************/ /*****************************************************************************/
/* implement virtual functions of Preconditioner */ /* implement virtual functions of Preconditioner */
/* Computation Interfaces for Vector */ /// implement x = R^{-1} y
virtual void solve(const Vector& y, Vector &x) const; void solve(const Vector& y, Vector &x) const override;
virtual void transposeSolve(const Vector& y, Vector& x) const ;
virtual void build( /// implement x = R^{-T} y
void transposeSolve(const Vector& y, Vector& x) const override;
/// build/factorize the preconditioner
void build(
const GaussianFactorGraph &gfg, const GaussianFactorGraph &gfg,
const KeyInfo &info, const KeyInfo &info,
const std::map<Key,Vector> &lambda const std::map<Key,Vector> &lambda
) ; ) override;
/*****************************************************************************/ /*****************************************************************************/
}; };
@ -310,9 +313,9 @@ namespace gtsam {
/* sort the container and return permutation index with default comparator */ /* sort the container and return permutation index with default comparator */
template <typename Container> template <typename Container>
std::vector<size_t> sort_idx(const Container &src) std::vector<size_t> sort_idx(const Container &src)
{ {
typedef typename Container::value_type T; typedef typename Container::value_type T;
const size_t n = src.size() ; const size_t n = src.size() ;
std::vector<std::pair<size_t,T> > tmp; std::vector<std::pair<size_t,T> > tmp;
@ -329,6 +332,6 @@ namespace gtsam {
idx.push_back(tmp[i].first) ; idx.push_back(tmp[i].first) ;
} }
return idx; return idx;
} }
} // namespace gtsam } // namespace gtsam