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;
114 for (
size_t k = 0; k < D; ++k) {
116 Vector column_k = Ab_(j).col(k);
117 column_k = model_->whiten(column_k);
118 dj(k) =
dot(column_k, column_k);
120 dj(k) = Ab_(j).col(k).squaredNorm();
123 DMap(d + D * j) += dj;
140 b = model_->whiten(b);
141 b = model_->whiten(b);
149 for (
size_t k = 0; k < D; ++k) {
150 Vector column_k = Ab_(j).col(k);
151 dj(k) = -1.0 *
dot(b, column_k);
153 DMap(d + D * j) += dj;
162 Vector E = alpha * (model_ ? model_->whiten(e) : e);
164 for (
size_t pos = 0; pos <
size(); ++pos)
165 DMap(x + D *
keys_[pos]) += Ab_(pos).transpose() * E;
173 Vector Ax = Vector::Zero(Ab_.
rows());
178 for (
size_t pos = 0; pos <
size(); ++pos)
179 Ax += Ab_(pos) * ConstDMap(x + D *
keys_[pos]);
181 return model_ ? model_->whiten(Ax) : Ax;
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
ptrdiff_t DenseIndex
The index type for Eigen objects.
Definition: types.h:75
double dot(const V1 &a, const V2 &b)
Dot product.
Definition: Vector.h:194
Definition: VerticalBlockMatrix.h:42
DenseIndex rows() const
Row size.
Definition: VerticalBlockMatrix.h:114
const KeyVector & keys() const
Access the factor's involved variable keys.
Definition: Factor.h:125
KeyVector keys_
The keys involved in this factor.
Definition: Factor.h:73
size_t size() const
Definition: Factor.h:136
VectorValues hessianDiagonal() const
Return the diagonal of the Hessian for this factor.
Definition: GaussianFactor.cpp:27
A Gaussian factor in the squared-error form.
Definition: JacobianFactor.h:91
const constBVector getb() const
Get a view of the r.h.s.
Definition: JacobianFactor.h:295
bool empty() const override
Check if the factor is empty.
Definition: JacobianFactor.h:264
VectorValues gradientAtZero() const override
A'*b for Jacobian.
Definition: JacobianFactor.cpp:701
void multiplyHessianAdd(double alpha, const VectorValues &x, VectorValues &y) const override
y += alpha * A'*A*x
Definition: JacobianFactor.cpp:649
JacobianFactor with constant sized blocks Provides raw memory access versions of linear operator.
Definition: RegularJacobianFactor.h:32
Vector operator*(const double *x) const
double* Matrix-vector multiply, i.e.
Definition: RegularJacobianFactor.h:172
void hessianDiagonal(double *d) const override
Raw memory access version of hessianDiagonal.
Definition: RegularJacobianFactor.h:109
void gradientAtZero(double *d) const override
Raw memory access version of gradientAtZero.
Definition: RegularJacobianFactor.h:133
void transposeMultiplyAdd(double alpha, const Vector &e, double *x) const
double* Transpose Matrix-vector multiply, i.e.
Definition: RegularJacobianFactor.h:161
VectorValues gradientAtZero() const override
Expose base class gradientAtZero.
Definition: RegularJacobianFactor.h:128
RegularJacobianFactor(const TERMS &terms, const Vector &b, const SharedDiagonal &model=SharedDiagonal())
Construct an n-ary factor.
Definition: RegularJacobianFactor.h:52
void multiplyHessianAdd(double alpha, const VectorValues &x, VectorValues &y) const override
y += alpha * A'*A*x
Definition: RegularJacobianFactor.h:73
RegularJacobianFactor()
Default constructor.
Definition: RegularJacobianFactor.h:44
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
void multiplyHessianAdd(double alpha, const double *x, double *y) const
double* Hessian-vector multiply, i.e.
Definition: RegularJacobianFactor.h:82
This class represents a collection of vector-valued variables associated each with a unique integer i...
Definition: VectorValues.h:74