aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/SparseCore/SparseCwiseBinaryOp.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-06-08 10:14:08 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-06-08 10:14:08 +0200
commita7ae628c9f8a83973e899866ecd344bbfde6e844 (patch)
treeda400d0bb3ff1fd3853b783a90a41ad121486eb2 /Eigen/src/SparseCore/SparseCwiseBinaryOp.h
parent0a9b5d13965aa2294ed657ffef327287df99cfd3 (diff)
bug #1005: fix regression regarding sparse coeff-wise binary operator that did not trigger a static assertion for mismatched storage
Diffstat (limited to 'Eigen/src/SparseCore/SparseCwiseBinaryOp.h')
-rw-r--r--Eigen/src/SparseCore/SparseCwiseBinaryOp.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/Eigen/src/SparseCore/SparseCwiseBinaryOp.h b/Eigen/src/SparseCore/SparseCwiseBinaryOp.h
index f53427abf..096af7fb0 100644
--- a/Eigen/src/SparseCore/SparseCwiseBinaryOp.h
+++ b/Eigen/src/SparseCore/SparseCwiseBinaryOp.h
@@ -29,6 +29,24 @@ namespace Eigen {
// 4 - dense op dense product dense
// generic dense
+template<typename BinaryOp, typename Lhs, typename Rhs>
+class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Sparse>
+ : public SparseMatrixBase<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
+{
+ public:
+ 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);
+ }
+};
+
namespace internal {
template<typename BinaryOp, typename Lhs, typename Rhs, typename Derived,