32 using namespace std::placeholders;
34 using namespace gtsam;
40 std::make_shared<GaussianConditional>(
_x_, Vector1::Constant(9), I_1x1,
_y_, I_1x1),
41 std::make_shared<GaussianConditional>(
_y_, Vector1::Constant(5), I_1x1)};
44 std::make_shared<GaussianConditional>(
_x_, Vector1::Constant(9), I_1x1,
_y_, I_1x1,
45 noiseModel::Isotropic::Sigma(1, 2.0)),
46 std::make_shared<GaussianConditional>(
_y_, Vector1::Constant(5), I_1x1,
47 noiseModel::Isotropic::Sigma(1, 3.0))};
117 {
_y_, Vector1::Constant(5)}};
137 _x_, Vector1::Constant(9), I_1x1,
_y_, I_1x1);
144 {
_y_, Vector1::Constant(5)}};
158 {
_y_, Vector1::Constant(5)} };
172 GaussianConditional::sharedMeanAndStddev(
X(0),
A1,
X(1),
b,
sigma),
173 GaussianDensity::sharedMeanAndStddev(
X(1),
mean,
sigma)};
186 std::mt19937_64
rng(4242);
201 constexpr
size_t N = 1000;
203 for (
size_t i = 0;
i <
N;
i++) {
205 sum +=
pow(X_i[
_y_].
x() - 5.0, 2.0);
229 for (
const auto&
keys :
246 {
_y_, Vector1::Constant(5)}},
247 expected{{
_x_, Vector1::Constant(2)}, {
_y_, Vector1::Constant(3)}};
265 expected{{
_x_, Vector1::Constant(4)}, {
_y_, Vector1::Constant(9)}};
282 0,
Vector2(3.0, 4.0), (Matrix2() << 1.0, 3.0, 0.0, 4.0).finished(),
283 1, (Matrix2() << 2.0, 1.0, 2.0, 3.0).finished(), noiseModel::Isotropic::Sigma(2, 2.0));
286 1,
Vector2(5.0, 6.0), (Matrix2() << 1.0, 1.0, 0.0, 3.0).finished(),
287 2, (Matrix2() << 1.0, 0.0, 5.0, 2.0).finished(), noiseModel::Isotropic::Sigma(2, 2.0));
290 3,
Vector2(7.0, 8.0), (Matrix2() << 1.0, 1.0, 0.0, 5.0).finished(), noiseModel::Isotropic::Sigma(2, 2.0));
292 double expectedDeterminant = 60.0 / 64.0;
303 return 0.5 * (
Rd.first *
values -
Rd.second).squaredNorm();
313 0,
Vector2(1.0,2.0), (Matrix2() << 3.0,4.0,0.0,6.0).finished(),
314 3, (Matrix2() << 7.0,8.0,9.0,10.0).finished(),
315 4, (Matrix2() << 11.0,12.0,13.0,14.0).finished());
317 1,
Vector2(15.0,16.0), (Matrix2() << 17.0,18.0,0.0,20.0).finished(),
318 2, (Matrix2() << 21.0,22.0,23.0,24.0).finished(),
319 4, (Matrix2() << 25.0,26.0,27.0,28.0).finished());
321 2,
Vector2(29.0,30.0), (Matrix2() << 31.0,32.0,0.0,34.0).finished(),
322 3, (Matrix2() << 35.0,36.0,37.0,38.0).finished());
324 3,
Vector2(39.0,40.0), (Matrix2() << 41.0,42.0,0.0,44.0).finished(),
325 4, (Matrix2() << 45.0,46.0,47.0,48.0).finished());
327 4,
Vector2(49.0,50.0), (Matrix2() << 51.0,52.0,0.0,54.0).finished());
330 Matrix hessian = numericalHessian<Vector10>(
331 std::bind(&computeError,
gbn, std::placeholders::_1), Vector10::Zero());
334 Vector gradient = numericalGradient<Vector10>(
335 std::bind(&computeError,
gbn, std::placeholders::_1), Vector10::Zero());
340 Vector denseMatrixGradient = -augmentedHessian.col(10).segment(0,10);
344 double step = -gradient.squaredNorm() / (gradient.transpose() * hessian * gradient)(0);
358 EXPECT(newError < origError);
377 " var11[label=\"11\", pos=\"10,20!\"];\n"
378 " var22[label=\"22\", pos=\"50,20!\"];\n"