bug #1005: fix regression regarding sparse coeff-wise binary operator that did not trigger a static assertion for mismatched storage

This commit is contained in:
Gael Guennebaud
2015-06-08 10:14:08 +02:00
parent 0a9b5d1396
commit a7ae628c9f
3 changed files with 36 additions and 0 deletions

View File

@@ -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,