From 170128770a2c934e9af8cda3642e3fbd44048668 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 26 Feb 2009 10:09:23 +0000 Subject: [PATCH] compilation fix + test orho methods for complex --- Eigen/src/Geometry/OrthoMethods.h | 2 +- test/geo_orthomethods.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Eigen/src/Geometry/OrthoMethods.h b/Eigen/src/Geometry/OrthoMethods.h index 4676474db..ab8c25ed5 100644 --- a/Eigen/src/Geometry/OrthoMethods.h +++ b/Eigen/src/Geometry/OrthoMethods.h @@ -101,7 +101,7 @@ struct ei_unitOrthogonal_selector src.cwise().abs().maxCoeff(&maxi); if (maxi==0) sndi = 1; - RealScalar invnm = RealScalar(1)/Vector2(src.coeff(sndi),src.coeff(maxi)).norm(); + RealScalar invnm = RealScalar(1)/(Vector2() << src.coeff(sndi),src.coeff(maxi)).finished().norm(); perp.coeffRef(maxi) = -ei_conj(src.coeff(sndi)) * invnm; perp.coeffRef(sndi) = ei_conj(src.coeff(maxi)) * invnm; diff --git a/test/geo_orthomethods.cpp b/test/geo_orthomethods.cpp index 1485877d0..ae9f73518 100644 --- a/test/geo_orthomethods.cpp +++ b/test/geo_orthomethods.cpp @@ -63,6 +63,7 @@ template void orthomethods_3() template void orthomethods(int size=Size) { + typedef typename NumTraits::Real RealScalar; typedef Matrix VectorType; typedef Matrix Matrix3N; typedef Matrix MatrixN3; @@ -74,7 +75,7 @@ template void orthomethods(int size=Size) // unitOrthogonal VERIFY_IS_MUCH_SMALLER_THAN(v0.unitOrthogonal().dot(v0), Scalar(1)); - VERIFY_IS_APPROX(v0.unitOrthogonal().norm(), Scalar(1)); + VERIFY_IS_APPROX(v0.unitOrthogonal().norm(), RealScalar(1)); if (size>3) { @@ -82,7 +83,7 @@ template void orthomethods(int size=Size) v0.end(size-3).setRandom(); VERIFY_IS_MUCH_SMALLER_THAN(v0.unitOrthogonal().dot(v0), Scalar(1)); - VERIFY_IS_APPROX(v0.unitOrthogonal().norm(), Scalar(1)); + VERIFY_IS_APPROX(v0.unitOrthogonal().norm(), RealScalar(1)); } // colwise/rowwise cross product @@ -110,7 +111,7 @@ void test_geo_orthomethods() CALL_SUBTEST( (orthomethods()) ); CALL_SUBTEST( (orthomethods()) ); CALL_SUBTEST( (orthomethods()) ); - CALL_SUBTEST( (orthomethods()) ); + CALL_SUBTEST( (orthomethods,8>()) ); CALL_SUBTEST( (orthomethods(36)) ); CALL_SUBTEST( (orthomethods(35)) ); }