25 #include <boost/algorithm/string.hpp> 38 os <<
"PCGSolverParameters:" << endl;
39 preconditioner_->print(os);
48 void PCGSolverParameters::setPreconditionerParams(
const boost::shared_ptr<PreconditionerParameters> preconditioner) {
49 preconditioner_ = preconditioner;
53 std::cout << s << std::endl;;
54 std::ostringstream
os;
56 std::cout << os.str() << std::endl;
64 preconditioner_->build(gfg, keyInfo, lambda);
75 GaussianFactorGraphSystem::GaussianFactorGraphSystem(
77 const KeyInfo &keyInfo,
const std::map<Key, Vector> &
lambda) :
78 gfg_(gfg), preconditioner_(preconditioner), keyInfo_(keyInfo), lambda_(
90 Vector Ax = Vector::Zero(r.rows(), 1);
145 for (
size_t i = 0;
i < ordering.size(); ++
i) {
147 map<Key, size_t>::const_iterator it = dimensions.find(key);
148 if (it == dimensions.end()) {
149 throw invalid_argument(
150 "buildVectorValues: inconsistent ordering and dimensions");
152 const size_t dim = it->second;
153 result.
emplace(key, v.segment(offset, dim));
163 for (
const KeyInfo::value_type &item: keyInfo ) {
164 result.
emplace(item.first, v.segment(item.second.start, item.second.dim));
void print(const Matrix &A, const string &s, ostream &stream)
static enum @843 ordering
const Preconditioner & preconditioner_
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 y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate offset
boost::shared_ptr< PreconditionerParameters > preconditioner_
const Ordering & ordering() const
Return the ordering.
void leftPrecondition(const Vector &x, Vector &y) const
vector< size_t > dimensions(L.begin(), L.end())
ptrdiff_t DenseIndex
The index type for Eigen objects.
VectorValues buildVectorValues(const Vector &v, const KeyInfo &keyInfo)
Create VectorValues from a Vector and a KeyInfo class.
void residual(const Vector &x, Vector &r) const
VectorValues x0() const
Return VectorValues with zeros, of correct dimension.
boost::shared_ptr< Preconditioner > createPreconditioner(const boost::shared_ptr< PreconditionerParameters > params)
V preconditionedConjugateGradient(const S &system, const V &initial, const ConjugateGradientParameters ¶meters)
virtual void solve(const Vector &y, Vector &x) const =0
implement x = L^{-1} y
virtual void transposeSolve(const Vector &y, Vector &x) const =0
implement x = L^{-T} y
Linear Factor Graph where all factors are Gaussians.
void multiply(const Vector &x, Vector &y) const
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
const mpreal dim(const mpreal &a, const mpreal &b, mp_rnd_t r=mpreal::get_default_rnd())
void getb(Vector &b) const
void multiplyHessianAdd(double alpha, const VectorValues &x, VectorValues &y) const
ofstream os("timeSchurFactors.csv")
int optimize(const SfmData &db, const NonlinearFactorGraph &graph, const Values &initial, bool separateCalibration=false)
const GaussianFactorGraph & gfg_
std::pair< VectorValues::iterator, bool > emplace(Key j, Args &&...args)
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
void rightPrecondition(const Vector &x, Vector &y) const
std::uint64_t Key
Integer nonlinear key type.
VectorValues buildVectorValues(const Vector &v, const Ordering &ordering, const map< Key, size_t > &dimensions)
Create VectorValues from a Vector.
virtual VectorValues gradientAtZero() const