22 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATSMATADDEXPR_H_
23 #define _BLAZE_MATH_EXPRESSIONS_DMATSMATADDEXPR_H_
71 template<
typename MT1
80 typedef typename MT1::ResultType
RT1;
81 typedef typename MT2::ResultType
RT2;
82 typedef typename MT1::ReturnType
RN1;
83 typedef typename MT2::ReturnType
RN2;
122 enum { vectorizable = 0 };
170 return lhs_.columns();
200 template<
typename T >
203 (
rhs_.canAlias( alias ) );
213 template<
typename T >
215 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
237 template<
typename MT
269 template<
typename MT
287 const TmpType tmp( rhs );
305 template<
typename MT
336 template<
typename MT
408 template<
typename T1
411 inline const DMatSMatAddExpr<T1,T2,SO>
417 throw std::invalid_argument(
"Matrix sizes do not match" );
450 template<
typename T1
453 inline const DMatSMatAddExpr<T2,T1,SO>
459 throw std::invalid_argument(
"Matrix sizes do not match" );
487 template<
typename T1
492 inline const typename AddExprTrait< DMatSMatAddExpr<T1,T2,SO1>, T3 >::Type
493 operator+(
const DMatSMatAddExpr<T1,T2,SO1>& lhs,
const DenseMatrix<T3,SO2>& rhs )
497 return ( lhs.leftOperand() + (~rhs) ) + lhs.rightOperand();
516 template<
typename T1
521 inline const typename SubExprTrait< DMatSMatAddExpr<T1,T2,SO1>, T3 >::Type
522 operator-(
const DMatSMatAddExpr<T1,T2,SO1>& lhs,
const DenseMatrix<T3,SO2>& rhs )
526 return ( lhs.leftOperand() - (~rhs) ) + lhs.rightOperand();
552 template<
typename MT1
555 inline typename RowExprTrait< DMatSMatAddExpr<MT1,MT2,SO> >::Type
556 row(
const DMatSMatAddExpr<MT1,MT2,SO>& dm,
size_t index )
560 return row( dm.leftOperand(), index ) +
row( dm.rightOperand(), index );
578 template<
typename MT1
581 inline typename ColumnExprTrait< DMatDMatAddExpr<MT1,MT2,SO> >::Type
582 column(
const DMatSMatAddExpr<MT1,MT2,SO>& dm,
size_t index )
586 return column( dm.leftOperand(), index ) +
column( dm.rightOperand(), index );
602 template<
typename MT1,
typename MT2,
typename MT3 >
603 struct DMatDMatAddExprTrait< DMatSMatAddExpr<MT1,MT2,false>, MT3 >
608 typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
609 IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
610 IsDenseMatrix<MT3>::value && IsRowMajorMatrix<MT3>::value
611 ,
typename DMatSMatAddExprTrait< typename DMatDMatAddExprTrait<MT1,MT3>::Type, MT2 >::Type
612 , INVALID_TYPE >::Type Type;
622 template<
typename MT1,
typename MT2,
typename MT3 >
623 struct DMatTDMatAddExprTrait< DMatSMatAddExpr<MT1,MT2,false>, MT3 >
628 typedef typename SelectType< IsDenseMatrix <MT1>::value && IsRowMajorMatrix<MT1>::value &&
629 IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
630 IsDenseMatrix <MT3>::value && IsColumnMajorMatrix<MT3>::value
631 ,
typename DMatSMatAddExprTrait< typename DMatTDMatAddExprTrait<MT1,MT3>::Type, MT2 >::Type
632 , INVALID_TYPE >::Type Type;
642 template<
typename MT1,
typename MT2,
typename MT3 >
643 struct TDMatDMatAddExprTrait< DMatSMatAddExpr<MT1,MT2,true>, MT3 >
648 typedef typename SelectType< IsDenseMatrix <MT1>::value && IsColumnMajorMatrix<MT1>::value &&
649 IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
650 IsDenseMatrix <MT3>::value && IsRowMajorMatrix<MT3>::value
651 ,
typename DMatTSMatAddExprTrait< typename TDMatDMatAddExprTrait<MT1,MT3>::Type, MT2 >::Type
652 , INVALID_TYPE >::Type Type;
662 template<
typename MT1,
typename MT2,
typename MT3 >
663 struct TDMatTDMatAddExprTrait< DMatSMatAddExpr<MT1,MT2,true>, MT3 >
668 typedef typename SelectType< IsDenseMatrix <MT1>::value && IsColumnMajorMatrix<MT1>::value &&
669 IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
670 IsDenseMatrix <MT3>::value && IsColumnMajorMatrix<MT3>::value
671 ,
typename TDMatTSMatAddExprTrait< typename TDMatTDMatAddExprTrait<MT1,MT3>::Type, MT2 >::Type
672 , INVALID_TYPE >::Type Type;
682 template<
typename MT1,
typename MT2,
typename MT3 >
683 struct DMatDMatSubExprTrait< DMatSMatAddExpr<MT1,MT2,false>, MT3 >
688 typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
689 IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
690 IsDenseMatrix<MT3>::value && IsRowMajorMatrix<MT3>::value
691 ,
typename DMatSMatAddExprTrait< typename DMatDMatSubExprTrait<MT1,MT3>::Type, MT2 >::Type
692 , INVALID_TYPE >::Type Type;
702 template<
typename MT1,
typename MT2,
typename MT3 >
703 struct DMatTDMatSubExprTrait< DMatSMatAddExpr<MT1,MT2,false>, MT3 >
708 typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
709 IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
710 IsDenseMatrix<MT3>::value && IsColumnMajorMatrix<MT3>::value
711 ,
typename DMatSMatAddExprTrait< typename DMatTDMatSubExprTrait<MT1,MT3>::Type, MT2 >::Type
712 , INVALID_TYPE >::Type Type;
722 template<
typename MT1,
typename MT2,
typename MT3 >
723 struct TDMatDMatSubExprTrait< DMatSMatAddExpr<MT1,MT2,true>, MT3 >
728 typedef typename SelectType< IsDenseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
729 IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
730 IsDenseMatrix<MT3>::value && IsRowMajorMatrix<MT3>::value
731 ,
typename DMatTSMatAddExprTrait< typename TDMatDMatSubExprTrait<MT1,MT3>::Type, MT2 >::Type
732 , INVALID_TYPE >::Type Type;
742 template<
typename MT1,
typename MT2,
typename MT3 >
743 struct TDMatTDMatSubExprTrait< DMatSMatAddExpr<MT1,MT2,true>, MT3 >
748 typedef typename SelectType< IsDenseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
749 IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
750 IsDenseMatrix<MT3>::value && IsColumnMajorMatrix<MT3>::value
751 ,
typename TDMatTSMatAddExprTrait< typename TDMatTDMatSubExprTrait<MT1,MT3>::Type, MT2 >::Type
752 , INVALID_TYPE >::Type Type;
762 template<
typename MT1,
typename MT2,
bool SO >
763 struct RowExprTrait< DMatSMatAddExpr<MT1,MT2,SO> >
767 typedef typename AddExprTrait< typename RowExprTrait<const MT1>::Type
768 ,
typename RowExprTrait<const MT2>::Type >::Type Type;
777 template<
typename MT1,
typename MT2,
bool SO >
778 struct ColumnExprTrait< DMatSMatAddExpr<MT1,MT2,SO> >
782 typedef typename AddExprTrait< typename ColumnExprTrait<const MT1>::Type
783 ,
typename ColumnExprTrait<const MT2>::Type >::Type Type;