diff options
author | 2008-12-03 21:01:55 +0000 | |
---|---|---|
committer | 2008-12-03 21:01:55 +0000 | |
commit | c1e2156d8a45e28a07474c483af7580e055feb70 (patch) | |
tree | 9898a7e039393908fd99b68f13d433ec02567794 /Eigen/src/Geometry/Transform.h | |
parent | 84cc69f0f3fb0e232435d2318006500f47277e4d (diff) |
* Much better, consistent error msgs when mixing different scalar types:
- in matrix-matrix product, static assert on the two scalar types to be the same.
- Similarly in CwiseBinaryOp. POTENTIALLY CONTROVERSIAL: we don't allow anymore binary
ops to take two different scalar types. The functors that we defined take two args
of the same type anyway; also we still allow the return type to be different.
Again the reason is that different scalar types are incompatible with vectorization.
Better have the user realize explicitly what mixing different numeric types costs him
in terms of performance.
See comment in CwiseBinaryOp constructor.
- This allowed to fix a little mistake in test/regression.cpp, mixing float and double
- Remove redundant semicolon (;) after static asserts
Diffstat (limited to 'Eigen/src/Geometry/Transform.h')
-rw-r--r-- | Eigen/src/Geometry/Transform.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h index a0c07e405..00cc8e47a 100644 --- a/Eigen/src/Geometry/Transform.h +++ b/Eigen/src/Geometry/Transform.h @@ -302,7 +302,7 @@ Transform<Scalar,Dim>::Transform(const QMatrix& other) template<typename Scalar, int Dim> Transform<Scalar,Dim>& Transform<Scalar,Dim>::operator=(const QMatrix& other) { - EIGEN_STATIC_ASSERT(Dim==2, you_did_a_programming_error); + EIGEN_STATIC_ASSERT(Dim==2, you_made_a_programming_mistake) m_matrix << other.m11(), other.m21(), other.dx(), other.m12(), other.m22(), other.dy(), 0, 0, 1; @@ -318,7 +318,7 @@ Transform<Scalar,Dim>& Transform<Scalar,Dim>::operator=(const QMatrix& other) template<typename Scalar, int Dim> QMatrix Transform<Scalar,Dim>::toQMatrix(void) const { - EIGEN_STATIC_ASSERT(Dim==2, you_did_a_programming_error); + EIGEN_STATIC_ASSERT(Dim==2, you_made_a_programming_mistake) return QMatrix(other.coeffRef(0,0), other.coeffRef(1,0), other.coeffRef(0,1), other.coeffRef(1,1), other.coeffRef(0,2), other.coeffRef(1,2)); @@ -341,7 +341,7 @@ Transform<Scalar,Dim>::Transform(const QTransform& other) template<typename Scalar, int Dim> Transform<Scalar,Dim>& Transform<Scalar,Dim>::operator=(const QTransform& other) { - EIGEN_STATIC_ASSERT(Dim==2, you_did_a_programming_error); + EIGEN_STATIC_ASSERT(Dim==2, you_made_a_programming_mistake) m_matrix << other.m11(), other.m21(), other.dx(), other.m12(), other.m22(), other.dy(), other.m13(), other.m23(), other.m33(); @@ -355,7 +355,7 @@ Transform<Scalar,Dim>& Transform<Scalar,Dim>::operator=(const QTransform& other) template<typename Scalar, int Dim> QMatrix Transform<Scalar,Dim>::toQTransform(void) const { - EIGEN_STATIC_ASSERT(Dim==2, you_did_a_programming_error); + EIGEN_STATIC_ASSERT(Dim==2, you_made_a_programming_mistake) return QTransform(other.coeffRef(0,0), other.coeffRef(1,0), other.coeffRef(2,0) other.coeffRef(0,1), other.coeffRef(1,1), other.coeffRef(2,1) other.coeffRef(0,2), other.coeffRef(1,2), other.coeffRef(2,2); @@ -375,7 +375,7 @@ template<typename OtherDerived> Transform<Scalar,Dim>& Transform<Scalar,Dim>::scale(const MatrixBase<OtherDerived> &other) { - EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim)); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim)) linear() = (linear() * other.asDiagonal()).lazy(); return *this; } @@ -400,7 +400,7 @@ template<typename OtherDerived> Transform<Scalar,Dim>& Transform<Scalar,Dim>::prescale(const MatrixBase<OtherDerived> &other) { - EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim)); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim)) m_matrix.template block<Dim,HDim>(0,0) = (other.asDiagonal() * m_matrix.template block<Dim,HDim>(0,0)).lazy(); return *this; } @@ -425,7 +425,7 @@ template<typename OtherDerived> Transform<Scalar,Dim>& Transform<Scalar,Dim>::translate(const MatrixBase<OtherDerived> &other) { - EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim)); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim)) translation() += linear() * other; return *this; } @@ -439,7 +439,7 @@ template<typename OtherDerived> Transform<Scalar,Dim>& Transform<Scalar,Dim>::pretranslate(const MatrixBase<OtherDerived> &other) { - EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim)); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim)) translation() += other; return *this; } @@ -496,7 +496,7 @@ template<typename Scalar, int Dim> Transform<Scalar,Dim>& Transform<Scalar,Dim>::shear(Scalar sx, Scalar sy) { - EIGEN_STATIC_ASSERT(int(Dim)==2, you_did_a_programming_error); + EIGEN_STATIC_ASSERT(int(Dim)==2, you_made_a_programming_mistake) VectorType tmp = linear().col(0)*sy + linear().col(1); linear() << linear().col(0) + linear().col(1)*sx, tmp; return *this; @@ -511,7 +511,7 @@ template<typename Scalar, int Dim> Transform<Scalar,Dim>& Transform<Scalar,Dim>::preshear(Scalar sx, Scalar sy) { - EIGEN_STATIC_ASSERT(int(Dim)==2, you_did_a_programming_error); + EIGEN_STATIC_ASSERT(int(Dim)==2, you_made_a_programming_mistake) m_matrix.template block<Dim,HDim>(0,0) = LinearMatrixType(1, sx, sy, 1) * m_matrix.template block<Dim,HDim>(0,0); return *this; } |