From 7612e3ac4322b61bff7e77256f6425b986342c94 Mon Sep 17 00:00:00 2001 From: Jing Dong Date: Wed, 13 Nov 2013 05:30:40 +0000 Subject: [PATCH] Fix Matrix_(...) to Mat() <<... in gtsam/nonlinear --- gtsam/nonlinear/WhiteNoiseFactor.h | 6 ++--- .../tests/testLinearContainerFactor.cpp | 26 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/gtsam/nonlinear/WhiteNoiseFactor.h b/gtsam/nonlinear/WhiteNoiseFactor.h index a8196b870..3d8e5b804 100644 --- a/gtsam/nonlinear/WhiteNoiseFactor.h +++ b/gtsam/nonlinear/WhiteNoiseFactor.h @@ -77,9 +77,9 @@ namespace gtsam { double c = 2 * logSqrt2PI - log(p) + e2 * p; Vector g1 = (Vec(1) << -e * p); Vector g2 = (Vec(1) << 0.5 / p - 0.5 * e2); - Matrix G11 = Matrix_(1, 1, p); - Matrix G12 = Matrix_(1, 1, e); - Matrix G22 = Matrix_(1, 1, 0.5 / (p * p)); + Matrix G11 = (Mat(1, 1) << p); + Matrix G12 = (Mat(1, 1) << e); + Matrix G22 = (Mat(1, 1) << 0.5 / (p * p)); return HessianFactor::shared_ptr( new HessianFactor(j1, j2, G11, G12, g1, G22, g2, c)); } diff --git a/gtsam/nonlinear/tests/testLinearContainerFactor.cpp b/gtsam/nonlinear/tests/testLinearContainerFactor.cpp index c1cd73b85..e239b4ba5 100644 --- a/gtsam/nonlinear/tests/testLinearContainerFactor.cpp +++ b/gtsam/nonlinear/tests/testLinearContainerFactor.cpp @@ -30,10 +30,10 @@ Pose2 poseA1(0.0, 0.0, 0.0), poseA2(2.0, 0.0, 0.0); /* ************************************************************************* */ TEST( testLinearContainerFactor, generic_jacobian_factor ) { - Matrix A1 = Matrix_(2,2, + Matrix A1 = (Mat(2, 2) << 2.74222, -0.0067457, 0.0, 2.63624); - Matrix A2 = Matrix_(2,2, + Matrix A2 = (Mat(2, 2) << -0.0455167, -0.0443573, -0.0222154, -0.102489); Vector b = (Vec(2) << 0.0277052, @@ -64,10 +64,10 @@ TEST( testLinearContainerFactor, generic_jacobian_factor ) { /* ************************************************************************* */ TEST( testLinearContainerFactor, jacobian_factor_withlinpoints ) { - Matrix A1 = Matrix_(2,2, + Matrix A1 = (Mat(2, 2) << 2.74222, -0.0067457, 0.0, 2.63624); - Matrix A2 = Matrix_(2,2, + Matrix A2 = (Mat(2, 2) << -0.0455167, -0.0443573, -0.0222154, -0.102489); Vector b = (Vec(2) << 0.0277052, @@ -117,16 +117,16 @@ TEST( testLinearContainerFactor, jacobian_factor_withlinpoints ) { /* ************************************************************************* */ TEST( testLinearContainerFactor, generic_hessian_factor ) { - Matrix G11 = Matrix_(1,1, 1.0); - Matrix G12 = Matrix_(1,2, 2.0, 4.0); - Matrix G13 = Matrix_(1,3, 3.0, 6.0, 9.0); + Matrix G11 = (Mat(1, 1) << 1.0); + Matrix G12 = (Mat(1, 2) << 2.0, 4.0); + Matrix G13 = (Mat(1, 3) << 3.0, 6.0, 9.0); - Matrix G22 = Matrix_(2,2, 3.0, 5.0, + Matrix G22 = (Mat(2, 2) << 3.0, 5.0, 0.0, 6.0); - Matrix G23 = Matrix_(2,3, 4.0, 6.0, 8.0, + Matrix G23 = (Mat(2, 3) << 4.0, 6.0, 8.0, 1.0, 2.0, 4.0); - Matrix G33 = Matrix_(3,3, 1.0, 2.0, 3.0, + Matrix G33 = (Mat(3, 3) << 1.0, 2.0, 3.0, 0.0, 5.0, 6.0, 0.0, 0.0, 9.0); @@ -158,17 +158,17 @@ TEST( testLinearContainerFactor, hessian_factor_withlinpoints ) { // 2 variable example, one pose, one landmark (planar) // Initial ordering: x1, l1 - Matrix G11 = Matrix_(3,3, + Matrix G11 = (Mat(3, 3) << 1.0, 2.0, 3.0, 0.0, 5.0, 6.0, 0.0, 0.0, 9.0); - Matrix G12 = Matrix_(3,2, + Matrix G12 = (Mat(3, 2) << 1.0, 2.0, 3.0, 5.0, 4.0, 6.0); Vector g1 = (Vec(3) << 1.0, 2.0, 3.0); - Matrix G22 = Matrix_(2,2, + Matrix G22 = (Mat(2, 2) << 0.5, 0.2, 0.0, 0.6);