Clean up
parent
f6dd14126d
commit
0a1e844ae5
|
|
@ -355,14 +355,6 @@ namespace gtsam {
|
||||||
f->multiplyHessianAdd(alpha, x, y);
|
f->multiplyHessianAdd(alpha, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
///* ************************************************************************* */
|
|
||||||
//void GaussianFactorGraph::multiplyHessianAdd(double alpha,
|
|
||||||
// const double* x, double* y) const {
|
|
||||||
//vector<size_t> FactorKeys = getkeydim();
|
|
||||||
//BOOST_FOREACH(const GaussianFactor::shared_ptr& f, *this)
|
|
||||||
// f->multiplyHessianAdd(alpha, x, y, FactorKeys);
|
|
||||||
//}
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void GaussianFactorGraph::multiplyInPlace(const VectorValues& x, Errors& e) const {
|
void GaussianFactorGraph::multiplyInPlace(const VectorValues& x, Errors& e) const {
|
||||||
multiplyInPlace(x, e.begin());
|
multiplyInPlace(x, e.begin());
|
||||||
|
|
@ -402,33 +394,6 @@ void GaussianFactorGraph::transposeMultiplyAdd(double alpha, const Errors& e,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///* ************************************************************************* */
|
|
||||||
//void residual(const GaussianFactorGraph& fg, const VectorValues &x, VectorValues &r) {
|
|
||||||
// Key i = 0 ;
|
|
||||||
// BOOST_FOREACH(const GaussianFactor::shared_ptr& Ai_G, fg) {
|
|
||||||
// JacobianFactor::shared_ptr Ai = convertToJacobianFactorPtr(Ai_G);
|
|
||||||
// r[i] = Ai->getb();
|
|
||||||
// i++;
|
|
||||||
// }
|
|
||||||
// VectorValues Ax = VectorValues::SameStructure(r);
|
|
||||||
// multiply(fg,x,Ax);
|
|
||||||
// axpy(-1.0,Ax,r);
|
|
||||||
//}
|
|
||||||
|
|
||||||
///* ************************************************************************* */
|
|
||||||
//void multiply(const GaussianFactorGraph& fg, const VectorValues &x, VectorValues &r) {
|
|
||||||
// r.setZero();
|
|
||||||
// Key i = 0;
|
|
||||||
// BOOST_FOREACH(const GaussianFactor::shared_ptr& Ai_G, fg) {
|
|
||||||
// JacobianFactor::shared_ptr Ai = convertToJacobianFactorPtr(Ai_G);
|
|
||||||
// Vector &y = r[i];
|
|
||||||
// for(JacobianFactor::const_iterator j = Ai->begin(); j != Ai->end(); ++j) {
|
|
||||||
// y += Ai->getA(j) * x[*j];
|
|
||||||
// }
|
|
||||||
// ++i;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
VectorValues GaussianFactorGraph::transposeMultiply(const Errors& e) const
|
VectorValues GaussianFactorGraph::transposeMultiply(const Errors& e) const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -310,10 +310,6 @@ namespace gtsam {
|
||||||
void multiplyHessianAdd(double alpha, const VectorValues& x,
|
void multiplyHessianAdd(double alpha, const VectorValues& x,
|
||||||
VectorValues& y) const;
|
VectorValues& y) const;
|
||||||
|
|
||||||
///** y += alpha*A'A*x */
|
|
||||||
//void multiplyHessianAdd(double alpha, const double* x,
|
|
||||||
// double* y) const;
|
|
||||||
|
|
||||||
///** In-place version e <- A*x that overwrites e. */
|
///** In-place version e <- A*x that overwrites e. */
|
||||||
void multiplyInPlace(const VectorValues& x, Errors& e) const;
|
void multiplyInPlace(const VectorValues& x, Errors& e) const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -315,31 +315,6 @@ TEST( GaussianFactorGraph, multiplyHessianAdd2 )
|
||||||
EXPECT(assert_equal(2*expected, actual));
|
EXPECT(assert_equal(2*expected, actual));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
|
||||||
// Raw memory access
|
|
||||||
//TEST( GaussianFactorGraph, multiplyHessianAdd3 )
|
|
||||||
//{
|
|
||||||
// GaussianFactorGraph gfg = createGaussianFactorGraphWithHessianFactor();
|
|
||||||
|
|
||||||
// // brute force
|
|
||||||
// Matrix AtA; Vector eta; boost::tie(AtA,eta) = gfg.hessian();
|
|
||||||
// Vector X(6); X<<1,2,3,4,5,6;
|
|
||||||
// Vector Y(6); Y<<-450, -450, 300, 400, 2950, 3450;
|
|
||||||
// EXPECT(assert_equal(Y,AtA*X));
|
|
||||||
|
|
||||||
// double* x = &X[0];
|
|
||||||
|
|
||||||
// Vector fast_y = gtsam::zero(6);
|
|
||||||
// gfg.multiplyHessianAdd(1.0, x, fast_y.data());
|
|
||||||
// EXPECT(assert_equal(Y, fast_y));
|
|
||||||
|
|
||||||
// // now, do it with non-zero y
|
|
||||||
// gfg.multiplyHessianAdd(1.0, x, fast_y.data());
|
|
||||||
// EXPECT(assert_equal(2*Y, fast_y));
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
TEST( GaussianFactorGraph, matricesMixed )
|
TEST( GaussianFactorGraph, matricesMixed )
|
||||||
{
|
{
|
||||||
|
|
@ -352,7 +327,6 @@ TEST( GaussianFactorGraph, matricesMixed )
|
||||||
EXPECT(assert_equal(A.transpose()*b, eta));
|
EXPECT(assert_equal(A.transpose()*b, eta));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
TEST( GaussianFactorGraph, gradientAtZero )
|
TEST( GaussianFactorGraph, gradientAtZero )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue