37 typedef Eigen::Matrix<double, D, 1> DVector;
38 typedef Eigen::Map<DVector> DMap;
39 typedef Eigen::Map<const DVector> ConstDMap;
51 template<
typename TERMS>
53 const SharedDiagonal& model = SharedDiagonal()) :
63 template<
typename KEYS>
85 Vector Ax = Vector::Zero(Ab_.
rows());
88 for (
size_t pos = 0; pos <
size(); ++pos)
89 Ax += Ab_(pos) * ConstDMap(x + D *
keys_[pos]);
93 model_->whitenInPlace(Ax);
94 model_->whitenInPlace(Ax);
101 for (
size_t pos = 0; pos <
size(); ++pos)
102 DMap(y + D *
keys_[pos]) += Ab_(pos).transpose() * Ax;
116 for (
size_t k = 0; k < D; ++k) {
118 Vector column_k = Ab_(j).col(k);
119 column_k = model_->whiten(column_k);
120 dj(k) =
dot(column_k, column_k);
122 dj(k) = Ab_(j).col(k).squaredNorm();
125 DMap(d + D * j) += dj;
142 b = model_->whiten(b);
143 b = model_->whiten(b);
151 for (
size_t k = 0; k < D; ++k) {
152 Vector column_k = Ab_(j).col(k);
153 dj(k) = -1.0 *
dot(b, column_k);
155 DMap(d + D * j) += dj;
164 Vector E = alpha * (model_ ? model_->whiten(e) : e);
166 for (
size_t pos = 0; pos <
size(); ++pos)
167 DMap(x + D *
keys_[pos]) += Ab_(pos).transpose() * E;
175 Vector Ax = Vector::Zero(Ab_.
rows());
180 for (
size_t pos = 0; pos <
size(); ++pos)
181 Ax += Ab_(pos) * ConstDMap(x + D *
keys_[pos]);
183 return model_ ? model_->whiten(Ax) : Ax;
virtual bool empty() const
Check if the factor is empty.
Definition: JacobianFactor.h:235
double dot(const V1 &a, const V2 &b)
Dot product.
Definition: Vector.h:162
ptrdiff_t DenseIndex
The index type for Eigen objects.
Definition: types.h:63
virtual VectorValues hessianDiagonal() const
Expose base class hessianDiagonal.
Definition: RegularJacobianFactor.h:106
const constBVector getb() const
Get a view of the r.h.s.
Definition: JacobianFactor.h:264
void multiplyHessianAdd(double alpha, const VectorValues &x, VectorValues &y) const
y += alpha * A'*A*x
Definition: JacobianFactor.cpp:581
virtual VectorValues hessianDiagonal() const
Return the diagonal of the Hessian for this factor.
Definition: JacobianFactor.cpp:469
virtual VectorValues gradientAtZero() const
Expose base class gradientAtZero.
Definition: RegularJacobianFactor.h:130
virtual void multiplyHessianAdd(double alpha, const VectorValues &x, VectorValues &y) const
y += alpha * A'*A*x
Definition: RegularJacobianFactor.h:73
void gradientAtZero(double *d) const
Raw memory access version of gradientAtZero.
Definition: RegularJacobianFactor.h:135
void transposeMultiplyAdd(double alpha, const Vector &e, double *x) const
double* Transpose Matrix-vector multiply, i.e.
Definition: RegularJacobianFactor.h:163
void hessianDiagonal(double *d) const
Raw memory access version of hessianDiagonal.
Definition: RegularJacobianFactor.h:111
Definition: VerticalBlockMatrix.h:41
Vector operator *(const double *x) const
double* Matrix-vector multiply, i.e.
Definition: RegularJacobianFactor.h:174
RegularJacobianFactor(const TERMS &terms, const Vector &b, const SharedDiagonal &model=SharedDiagonal())
Construct an n-ary factor.
Definition: RegularJacobianFactor.h:52
size_t size() const
Definition: Factor.h:129
This class represents a collection of vector-valued variables associated each with a unique integer i...
Definition: VectorValues.h:73
A Gaussian factor in the squared-error form.
Definition: JacobianFactor.h:87
void multiplyHessianAdd(double alpha, const double *x, double *y) const
double* Hessian-vector multiply, i.e.
Definition: RegularJacobianFactor.h:82
const KeyVector & keys() const
Access the factor's involved variable keys.
Definition: Factor.h:118
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
DenseIndex rows() const
Row size.
Definition: VerticalBlockMatrix.h:114
KeyVector keys_
The keys involved in this factor.
Definition: Factor.h:72
RegularJacobianFactor(const KEYS &keys, const VerticalBlockMatrix &augmentedMatrix, const SharedDiagonal &sigmas=SharedDiagonal())
Constructor with arbitrary number keys, and where the augmented matrix is given all together instead ...
Definition: RegularJacobianFactor.h:64
RegularJacobianFactor()
Default constructor.
Definition: RegularJacobianFactor.h:44
VectorValues gradientAtZero() const
A'*b for Jacobian.
Definition: JacobianFactor.cpp:633
JacobianFactor with constant sized blocks Provides raw memory access versions of linear operator.
Definition: RegularJacobianFactor.h:32