diff options
author | 2011-12-15 19:23:20 +0100 | |
---|---|---|
committer | 2011-12-15 19:23:20 +0100 | |
commit | 40c0f3af57519756eb87279f89230c684abae4c0 (patch) | |
tree | 8a63e4290f3b7bb941e0efe9942baf081b691495 /Eigen/src | |
parent | 3db64558968507aff9b1e3739b4c32f733903e0a (diff) |
fig bug #396: add a static assertion on the storage order of a sparse-sparse coeff-wise binary op
Diffstat (limited to 'Eigen/src')
-rw-r--r-- | Eigen/src/Core/util/StaticAssert.h | 3 | ||||
-rw-r--r-- | Eigen/src/SparseCore/SparseCwiseBinaryOp.h | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/Eigen/src/Core/util/StaticAssert.h b/Eigen/src/Core/util/StaticAssert.h index 6ff2e1b4a..5bb526803 100644 --- a/Eigen/src/Core/util/StaticAssert.h +++ b/Eigen/src/Core/util/StaticAssert.h @@ -101,7 +101,8 @@ 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, - THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE + THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE, + THE_STORAGE_ORDER_OF_BOTH_SIDES_MUST_MATCH }; }; diff --git a/Eigen/src/SparseCore/SparseCwiseBinaryOp.h b/Eigen/src/SparseCore/SparseCwiseBinaryOp.h index 187ff6e4c..aae13b2e8 100644 --- a/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +++ b/Eigen/src/SparseCore/SparseCwiseBinaryOp.h @@ -65,6 +65,15 @@ class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Sparse> class InnerIterator; typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived; EIGEN_SPARSE_PUBLIC_INTERFACE(Derived) + CwiseBinaryOpImpl() + { + typedef typename internal::traits<Lhs>::StorageKind LhsStorageKind; + typedef typename internal::traits<Rhs>::StorageKind RhsStorageKind; + EIGEN_STATIC_ASSERT(( + (!internal::is_same<LhsStorageKind,RhsStorageKind>::value) + || ((Lhs::Flags&RowMajorBit) == (Rhs::Flags&RowMajorBit))), + THE_STORAGE_ORDER_OF_BOTH_SIDES_MUST_MATCH); + } }; template<typename BinaryOp, typename Lhs, typename Rhs> |