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);
191 #if __APPLE__ || _WIN32
207 constexpr
size_t N = 1000;
209 for (
size_t i = 0;
i <
N;
i++) {
211 sum +=
pow(X_i[
_y_].
x() - 5.0, 2.0);
235 for (
const auto&
keys :
252 {
_y_, Vector1::Constant(5)}},
253 expected{{
_x_, Vector1::Constant(2)}, {
_y_, Vector1::Constant(3)}};
271 expected{{
_x_, Vector1::Constant(4)}, {
_y_, Vector1::Constant(9)}};
288 0,
Vector2(3.0, 4.0), (Matrix2() << 1.0, 3.0, 0.0, 4.0).finished(),
289 1, (Matrix2() << 2.0, 1.0, 2.0, 3.0).finished(), noiseModel::Isotropic::Sigma(2, 2.0));
292 1,
Vector2(5.0, 6.0), (Matrix2() << 1.0, 1.0, 0.0, 3.0).finished(),
293 2, (Matrix2() << 1.0, 0.0, 5.0, 2.0).finished(), noiseModel::Isotropic::Sigma(2, 2.0));
296 3,
Vector2(7.0, 8.0), (Matrix2() << 1.0, 1.0, 0.0, 5.0).finished(), noiseModel::Isotropic::Sigma(2, 2.0));
298 double expectedDeterminant = 60.0 / 64.0;
309 return 0.5 * (
Rd.first *
values -
Rd.second).squaredNorm();
319 0,
Vector2(1.0,2.0), (Matrix2() << 3.0,4.0,0.0,6.0).finished(),
320 3, (Matrix2() << 7.0,8.0,9.0,10.0).finished(),
321 4, (Matrix2() << 11.0,12.0,13.0,14.0).finished());
323 1,
Vector2(15.0,16.0), (Matrix2() << 17.0,18.0,0.0,20.0).finished(),
324 2, (Matrix2() << 21.0,22.0,23.0,24.0).finished(),
325 4, (Matrix2() << 25.0,26.0,27.0,28.0).finished());
327 2,
Vector2(29.0,30.0), (Matrix2() << 31.0,32.0,0.0,34.0).finished(),
328 3, (Matrix2() << 35.0,36.0,37.0,38.0).finished());
330 3,
Vector2(39.0,40.0), (Matrix2() << 41.0,42.0,0.0,44.0).finished(),
331 4, (Matrix2() << 45.0,46.0,47.0,48.0).finished());
333 4,
Vector2(49.0,50.0), (Matrix2() << 51.0,52.0,0.0,54.0).finished());
336 Matrix hessian = numericalHessian<Vector10>(
337 std::bind(&computeError,
gbn, std::placeholders::_1), Vector10::Zero());
340 Vector gradient = numericalGradient<Vector10>(
341 std::bind(&computeError,
gbn, std::placeholders::_1), Vector10::Zero());
346 Vector denseMatrixGradient = -augmentedHessian.col(10).segment(0,10);
350 double step = -gradient.squaredNorm() / (gradient.transpose() * hessian * gradient)(0);
364 EXPECT(newError < origError);
383 " var11[label=\"11\", pos=\"10,20!\"];\n"
384 " var22[label=\"22\", pos=\"50,20!\"];\n"