28 using namespace gtsam;
37 const vector<pair<Key, Matrix> > terms{
38 {0, 1 * I_3x3}, {1, 2 * I_3x3}, {2, 3 * I_3x3}};
42 const SharedDiagonal noise = noiseModel::Diagonal::Sigmas((
Vector(3) << 0.5,0.5,0.5).finished());
47 const vector<pair<Key, Matrix> > terms2{
48 {0, 2 * I_3x3}, {1, 4 * I_3x3}, {2, 6 * I_3x3}};
58 const size_t nrKeys,
const size_t dim) {
60 std::map<gtsam::Key, size_t> dims;
64 size_t n = nrKeys*dim;
66 for (
size_t i = 0;
i <
n;
i++){
74 const size_t nrKeys,
const size_t dim) {
76 std::map<gtsam::Key, size_t> dims;
78 dims.insert(make_pair(
i, dim));
81 size_t n = nrKeys*dim;
82 for (
size_t j = 0;
j <
n;
j++)
91 terms[1].first, terms[1].second, terms[2].first, terms[2].second,
b, noise);
107 terms[1].first, terms[1].second, terms[2].first, terms[2].second,
b, noise);
114 double actualValue[9]={0};
121 TEST(RegularJacobian, gradientAtZero)
125 terms[1].first, terms[1].second, terms[2].first, terms[2].second,
b, noise);
134 double actualValue[9]={0};
141 TEST(RegularJacobian, gradientAtZero_multiFactors)
145 terms[1].first, terms[1].second, terms[2].first, terms[2].second,
b, noise);
152 double actualValue[9]={0};
160 terms2[1].first, terms2[1].second, terms2[2].first, terms2[2].second,
b2, noise);
174 TEST(RegularJacobian, multiplyHessianAdd)
178 terms[1].first, terms[1].second, terms[2].first, terms[2].second,
b, noise);
203 double actualMHARaw[9];
210 double actualMHARaw2[9];
213 size_t accumulatedDim = 0;
215 dims.push_back(accumulatedDim);
Provides additional testing facilities for common data structures.
static const size_t fixedDim
static int runAllTests(TestResult &result)
void multiplyHessianAdd(double alpha, const VectorValues &x, VectorValues &y) const override
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
void multiplyHessianAdd(double alpha, const VectorValues &x, VectorValues &y) const override
iterator insert(const std::pair< Key, Vector > &key_value)
TEST(RegularJacobianFactor, constructorNway)
static const VectorValues vv
static const size_t nrKeys
const_iterator end() const
VectorValues gradientAtZero() const override
Expose base class gradientAtZero.
void hessianDiagonal(double *d) const override
Raw memory access version of hessianDiagonal.
#define EXPECT(condition)
const constBVector getb() const
VectorValues add(const VectorValues &c) const
JacobianFactor class with fixed sized blcoks.
Conditional Gaussian Base class.
Linear Factor Graph where all factors are Gaussians.
#define LONGS_EQUAL(expected, actual)
noiseModel::Diagonal::shared_ptr SharedDiagonal
VectorValues gradientAtZero() const override
A'*b for Jacobian.
void vv2double(const VectorValues &vv, double *y, const size_t nrKeys, const size_t dim)
const KeyVector & keys() const
Access the factor's involved variable keys.
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
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
const SharedDiagonal & get_model() const
constABlock getA(const_iterator variable) const
VectorValues double2vv(const double *x, const size_t nrKeys, const size_t dim)
void hessianDiagonal(double *d) const override
Raw memory access version of hessianDiagonal.