From d7c67532bf59c4f46c66a816e7e50e06ef69b287 Mon Sep 17 00:00:00 2001 From: Alex Cunningham Date: Tue, 8 Dec 2009 21:10:38 +0000 Subject: [PATCH] Changed format of Matrix::vector_scale() to switch arguments --- cpp/GaussianFactor.cpp | 2 +- cpp/Matrix.cpp | 4 ++-- cpp/Matrix.h | 8 ++++---- cpp/NonlinearConstraint-inl.h | 6 +++--- cpp/testMatrix.cpp | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cpp/GaussianFactor.cpp b/cpp/GaussianFactor.cpp index 66add2def..6881104a5 100644 --- a/cpp/GaussianFactor.cpp +++ b/cpp/GaussianFactor.cpp @@ -181,7 +181,7 @@ pair GaussianFactor::matrix(const Ordering& ordering, bool weight // divide in sigma so error is indeed 0.5*|Ax-b| if (weight) { Vector t = ediv(ones(sigmas_.size()),sigmas_); - A = vector_scale(A, t); + A = vector_scale(t, A); for (int i=0; i::linearize(const Config& config, const VectorConfig Matrix grad = gradG_(config, this->keys()); // construct probabilistic factor - Matrix A1 = vector_scale(grad, lambda); + Matrix A1 = vector_scale(lambda, grad); GaussianFactor::shared_ptr factor(new GaussianFactor(key_, A1, this->lagrange_key_, eye(this->p_), zero(this->p_), 1.0)); @@ -218,8 +218,8 @@ NonlinearConstraint2::linearize(const Config& config, const VectorConfig Matrix grad2 = gradG2_(config, this->keys()); // construct probabilistic factor - Matrix A1 = vector_scale(grad1, lambda); - Matrix A2 = vector_scale(grad2, lambda); + Matrix A1 = vector_scale(lambda, grad1); + Matrix A2 = vector_scale(lambda, grad2); GaussianFactor::shared_ptr factor(new GaussianFactor(key1_, A1, key2_, A2, this->lagrange_key_, eye(this->p_), zero(this->p_), 1.0)); diff --git a/cpp/testMatrix.cpp b/cpp/testMatrix.cpp index ec6165e5e..b3926fbfa 100644 --- a/cpp/testMatrix.cpp +++ b/cpp/testMatrix.cpp @@ -167,7 +167,7 @@ TEST( matrix, scale_columns ) Vector v = Vector_(4, 2., 3., 4., 5.); - Matrix actual = vector_scale(v,A); + Matrix actual = vector_scale(A,v); Matrix expected(3,4); expected(0,0) = 2.; expected(0,1) = 3.; expected(0,2)= 4.; expected(0,3)= 5.; @@ -187,7 +187,7 @@ TEST( matrix, scale_rows ) Vector v = Vector_(3, 2., 3., 4.); - Matrix actual = vector_scale(A,v); + Matrix actual = vector_scale(v,A); Matrix expected(3,4); expected(0,0) = 2.; expected(0,1) = 2.; expected(0,2)= 2.; expected(0,3)= 2.;