diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2011-11-18 11:10:27 -0500 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2011-11-18 11:10:27 -0500 |
commit | bc6d78982fb2b8d07827246e682acdf47d0e8944 (patch) | |
tree | be84292862f0c1fc54743a273c7c6e139a8a44c9 /Eigen/src/Core/util/StaticAssert.h | |
parent | de22ad117cb5324e3e1d0700dde7466921fdf9ca (diff) |
Bugs 157 and 377 - General tightening/testing of vectorwise ops:
* add lots of static assertions making it very explicit when all these ops
are supposed to work:
** all ops require the rhs vector to go in the right direction
** all ops already require that the lhs and rhs are of the same kind
(matrix vs vector) otherwise we'd have to do complex work
** multiplicative ops (introduced Kibeom's patch) are restricted to arrays, if only because for matrices they could be ambiguous.
* add a new test, vectorwiseop.cpp.
* these compound-assign operators used to be implemented with for loops:
for(Index j=0; j<subVectors(); ++j)
subVector(j).array() += other.derived().array();
This didn't seem to be needed; replaced by using expressions like operator+ and operator- did.
Diffstat (limited to 'Eigen/src/Core/util/StaticAssert.h')
-rw-r--r-- | Eigen/src/Core/util/StaticAssert.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Eigen/src/Core/util/StaticAssert.h b/Eigen/src/Core/util/StaticAssert.h index d14c87c7c..672c6ae96 100644 --- a/Eigen/src/Core/util/StaticAssert.h +++ b/Eigen/src/Core/util/StaticAssert.h @@ -97,7 +97,10 @@ THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY, YOU_ARE_TRYING_TO_USE_AN_INDEX_BASED_ACCESSOR_ON_AN_EXPRESSION_THAT_DOES_NOT_SUPPORT_THAT, THIS_METHOD_IS_ONLY_FOR_1x1_EXPRESSIONS, - THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL + THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL, + THIS_METHOD_IS_ONLY_FOR_ARRAYS_NOT_MATRICES, + YOU_PASSED_A_ROW_VECTOR_BUT_A_COLUMN_VECTOR_WAS_EXPECTED, + YOU_PASSED_A_COLUMN_VECTOR_BUT_A_ROW_VECTOR_WAS_EXPECTED }; }; @@ -197,4 +200,15 @@ EIGEN_STATIC_ASSERT(internal::is_lvalue<Derived>::value, \ THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY) +#define EIGEN_STATIC_ASSERT_ARRAYXPR(Derived) \ + EIGEN_STATIC_ASSERT((internal::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value), \ + THIS_METHOD_IS_ONLY_FOR_ARRAYS_NOT_MATRICES) + +#define EIGEN_STATIC_ASSERT_SAME_XPR_KIND(Derived1, Derived2) \ + EIGEN_STATIC_ASSERT((internal::is_same<typename internal::traits<Derived1>::XprKind, \ + typename internal::traits<Derived2>::XprKind \ + >::value), \ + YOU_CANNOT_MIX_ARRAYS_AND_MATRICES) + + #endif // EIGEN_STATIC_ASSERT_H |