From e45b303f4cafdc8a2845e4ee0856a2696f1534e3 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Mon, 13 Sep 2010 03:25:07 +0000 Subject: [PATCH] fixed bug in dimensions --- geometry/tensorInterface.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/geometry/tensorInterface.h b/geometry/tensorInterface.h index 67c125128..a2ab58eb6 100644 --- a/geometry/tensorInterface.h +++ b/geometry/tensorInterface.h @@ -25,7 +25,7 @@ namespace gtsam { return M; } - /** Reshape 3*3 rank 2 tensor into Vector : TODO 9 ???*/ + /** Reshape rank 2 tensor into Vector */ template Vector toVector(const tensors::Tensor2Expression& T) { Vector v(I::dim * J::dim); @@ -41,7 +41,7 @@ namespace gtsam { tensors::Tensor2 reshape2(const Vector& v) { if (v.size() != N1 * N2) throw std::invalid_argument( "reshape2: incompatible dimensions"); - double data[N1][N2]; + double data[N2][N1]; int t = 0; for (int j = 0; j < N2; j++) for (int i = 0; i < N1; i++) @@ -68,7 +68,7 @@ namespace gtsam { tensors::Tensor3 reshape3(const Vector& v) { if (v.size() != N1 * N2 * N3) throw std::invalid_argument( "reshape3: incompatible dimensions"); - double data[N1][N2][N3]; + double data[N3][N2][N1]; int t = 0; for (int k = 0; k < N3; k++) for (int j = 0; j < N2; j++)