diff --git a/.cproject b/.cproject index 40360ea59..95f915001 100644 --- a/.cproject +++ b/.cproject @@ -1,17 +1,19 @@ - + + + + + - - @@ -60,13 +62,13 @@ + + - - @@ -116,13 +118,13 @@ + + - - @@ -540,6 +542,14 @@ true true + + make + -j2 + testGaussianFactor.run + true + true + true + make -j2 @@ -566,7 +576,6 @@ make - tests/testBayesTree.run true false @@ -574,7 +583,6 @@ make - testBinaryBayesNet.run true false @@ -622,7 +630,6 @@ make - testSymbolicBayesNet.run true false @@ -630,7 +637,6 @@ make - tests/testSymbolicFactor.run true false @@ -638,7 +644,6 @@ make - testSymbolicFactorGraph.run true false @@ -654,20 +659,11 @@ make - tests/testBayesTree true false true - - make - -j2 - testGaussianFactor.run - true - true - true - make -j5 @@ -764,22 +760,6 @@ false true - - make - -j2 - tests/testPose2.run - true - true - true - - - make - -j2 - tests/testPose3.run - true - true - true - make -j2 @@ -796,6 +776,22 @@ true true + + make + -j2 + tests/testPose2.run + true + true + true + + + make + -j2 + tests/testPose3.run + true + true + true + make -j2 @@ -820,6 +816,70 @@ true true + + make + -j2 + all + true + true + true + + + make + -j2 + check + true + true + true + + + make + -j2 + clean + true + true + true + + + make + -j5 + testValues.run + true + true + true + + + make + -j5 + testOrdering.run + true + true + true + + + make + -j5 + testKey.run + true + true + true + + + make + -j5 + testLinearContainerFactor.run + true + true + true + + + make + -j6 -j8 + testWhiteNoiseFactor.run + true + true + true + make -j5 @@ -884,70 +944,6 @@ true true - - make - -j5 - testValues.run - true - true - true - - - make - -j5 - testOrdering.run - true - true - true - - - make - -j5 - testKey.run - true - true - true - - - make - -j5 - testLinearContainerFactor.run - true - true - true - - - make - -j6 -j8 - testWhiteNoiseFactor.run - true - true - true - - - make - -j2 - all - true - true - true - - - make - -j2 - check - true - true - true - - - make - -j2 - clean - true - true - true - make -j5 @@ -1334,7 +1330,6 @@ make - testGraph.run true false @@ -1342,7 +1337,6 @@ make - testJunctionTree.run true false @@ -1350,7 +1344,6 @@ make - testSymbolicBayesNetB.run true false @@ -1518,7 +1511,6 @@ make - testErrors.run true false @@ -1564,6 +1556,22 @@ true true + + make + -j5 + testParticleFactor.run + true + true + true + + + make + -j2 + testGaussianFactor.run + true + true + true + make -j2 @@ -1644,22 +1652,6 @@ true true - - make - -j2 - testGaussianFactor.run - true - true - true - - - make - -j5 - testParticleFactor.run - true - true - true - make -j2 @@ -2022,6 +2014,7 @@ make + testSimulated2DOriented.run true false @@ -2061,6 +2054,7 @@ make + testSimulated2D.run true false @@ -2068,6 +2062,7 @@ make + testSimulated3D.run true false @@ -2113,10 +2108,10 @@ true true - + make -j5 - testHessianFactor.run + testHessianFactorUnordered.run true true true @@ -2355,6 +2350,7 @@ make + tests/testGaussianISAM2 true false @@ -2376,6 +2372,102 @@ true true + + make + -j2 + testRot3.run + true + true + true + + + make + -j2 + testRot2.run + true + true + true + + + make + -j2 + testPose3.run + true + true + true + + + make + -j2 + timeRot3.run + true + true + true + + + make + -j2 + testPose2.run + true + true + true + + + make + -j2 + testCal3_S2.run + true + true + true + + + make + -j2 + testSimpleCamera.run + true + true + true + + + make + -j2 + testHomography2.run + true + true + true + + + make + -j2 + testCalibratedCamera.run + true + true + true + + + make + -j2 + check + true + true + true + + + make + -j2 + clean + true + true + true + + + make + -j2 + testPoint2.run + true + true + true + make -j3 @@ -2577,7 +2669,6 @@ cpack - -G DEB true false @@ -2585,7 +2676,6 @@ cpack - -G RPM true false @@ -2593,7 +2683,6 @@ cpack - -G TGZ true false @@ -2601,7 +2690,6 @@ cpack - --config CPackSourceConfig.cmake true false @@ -2767,98 +2855,34 @@ true true - + make - -j2 - testRot3.run + -j5 + testSpirit.run true true true - + make - -j2 - testRot2.run + -j5 + testWrap.run true true true - + make - -j2 - testPose3.run + -j5 + check.wrap true true true - + make - -j2 - timeRot3.run - true - true - true - - - make - -j2 - testPose2.run - true - true - true - - - make - -j2 - testCal3_S2.run - true - true - true - - - make - -j2 - testSimpleCamera.run - true - true - true - - - make - -j2 - testHomography2.run - true - true - true - - - make - -j2 - testCalibratedCamera.run - true - true - true - - - make - -j2 - check - true - true - true - - - make - -j2 - clean - true - true - true - - - make - -j2 - testPoint2.run + -j5 + wrap true true true @@ -2902,38 +2926,6 @@ false true - - make - -j5 - testSpirit.run - true - true - true - - - make - -j5 - testWrap.run - true - true - true - - - make - -j5 - check.wrap - true - true - true - - - make - -j5 - wrap - true - true - true - diff --git a/gtsam/linear/HessianFactor.cpp b/gtsam/linear/HessianFactor.cpp index 9811c4051..c93035d42 100644 --- a/gtsam/linear/HessianFactor.cpp +++ b/gtsam/linear/HessianFactor.cpp @@ -354,6 +354,12 @@ Matrix HessianFactor::information() const /* ************************************************************************* */ VectorValues HessianFactor::hessianDiagonal() const { VectorValues d; + // Loop over all variables + for (DenseIndex j = 0; j < (DenseIndex)size(); ++j) { + // Get the diagonal block, and insert its diagonal + Matrix B = info_(j, j).selfadjointView(); + d.insert(keys_[j],B.diagonal()); + } return d; } diff --git a/gtsam/linear/tests/testHessianFactorUnordered.cpp b/gtsam/linear/tests/testHessianFactorUnordered.cpp index 383604c76..bd35a4c6d 100644 --- a/gtsam/linear/tests/testHessianFactorUnordered.cpp +++ b/gtsam/linear/tests/testHessianFactorUnordered.cpp @@ -430,11 +430,11 @@ TEST(HessianFactor, combine) { /* ************************************************************************* */ TEST(HessianFactor, gradientAtZero) { - Matrix G11 = (Matrix(1, 1) << 1.0); - Matrix G12 = (Matrix(1, 2) << 0.0, 0.0); - Matrix G22 = (Matrix(2, 2) << 1.0, 0.0, 0.0, 1.0); - Vector g1 = (Vector(1) << -7.0); - Vector g2 = (Vector(2) << -8.0, -9.0); + Matrix G11 = (Matrix(1, 1) << 1); + Matrix G12 = (Matrix(1, 2) << 0, 0); + Matrix G22 = (Matrix(2, 2) << 1, 0, 0, 1); + Vector g1 = (Vector(1) << -7); + Vector g2 = (Vector(2) << -8, -9); double f = 194; HessianFactor factor(0, 1, G11, G12, g1, G22, g2, f); @@ -448,6 +448,24 @@ TEST(HessianFactor, gradientAtZero) EXPECT(assert_equal(expectedG, actualG)); } +/* ************************************************************************* */ +TEST(HessianFactor, hessianDiagonal) +{ + Matrix G11 = (Matrix(1, 1) << 1); + Matrix G12 = (Matrix(1, 2) << 0, 0); + Matrix G22 = (Matrix(2, 2) << 1, 0, 0, 1); + Vector g1 = (Vector(1) << -7); + Vector g2 = (Vector(2) << -8, -9); + double f = 194; + + HessianFactor factor(0, 1, G11, G12, g1, G22, g2, f); + + VectorValues expectLdiagonal; // Make explicit that diagonal is sum-squares of columns + expectLdiagonal.insert(0, (Vector(1) << 1)); + expectLdiagonal.insert(1, (Vector(2) << 1,1)); + EXPECT(assert_equal(expectLdiagonal, factor.hessianDiagonal())); +} + /* ************************************************************************* */ int main() { TestResult tr; return TestRegistry::runAllTests(tr);} /* ************************************************************************* */