22 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATTSMATMULTEXPR_H_
23 #define _BLAZE_MATH_EXPRESSIONS_DMATTSMATMULTEXPR_H_
84 template<
typename MT1
92 typedef typename MT1::ResultType
RT1;
93 typedef typename MT2::ResultType
RT2;
94 typedef typename MT1::CompositeType
CT1;
95 typedef typename MT2::CompositeType
CT2;
123 enum { vectorizable = 0 };
156 if(
lhs_.columns() == 0UL )
164 const ConstIterator end( B.end(j) );
165 ConstIterator element( B.begin(j) );
172 tmp =
lhs_(i,element->index()) * element->value();
174 for( ; element!=end; ++element )
175 tmp +=
lhs_(i,element->index()) * element->value();
181 for(
size_t k=1UL; k<
lhs_.columns(); ++k ) {
206 return rhs_.columns();
236 template<
typename T >
238 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
248 template<
typename T >
250 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
272 template<
typename MT
290 for(
size_t i=0UL; i<(~lhs).
rows(); ++i ) {
291 for(
size_t j=0UL; j<(~lhs).
columns(); ++j )
293 ConstIterator element( B.begin(j) );
294 const ConstIterator end( B.end(j) );
296 if( element == end ) {
297 reset( (~lhs)(i,j) );
301 (~lhs)(i,j) = A(i,element->index()) * element->value();
303 for( ; element!=end; ++element )
304 (~lhs)(i,j) += A(i,element->index()) * element->value();
324 template<
typename MT
342 const TmpType tmp( rhs );
361 template<
typename MT
370 typedef typename RemoveReference<RT>::Type::ConstIterator ConstIterator;
379 for(
size_t i=0UL; i<(~lhs).
rows(); ++i ) {
380 for(
size_t j=0UL; j<(~lhs).
columns(); ++j )
382 ConstIterator element( B.begin(j) );
383 const ConstIterator end( B.end(j) );
385 for( ; element!=end; ++element )
386 (~lhs)(i,j) += A(i,element->index()) * element->value();
410 template<
typename MT
419 typedef typename RemoveReference<RT>::Type::ConstIterator ConstIterator;
428 for(
size_t i=0UL; i<(~lhs).
rows(); ++i ) {
429 for(
size_t j=0UL; j<(~lhs).
columns(); ++j )
431 ConstIterator element( B.begin(j) );
432 const ConstIterator end( B.end(j) );
434 for( ; element!=end; ++element )
435 (~lhs)(i,j) -= A(i,element->index()) * element->value();
504 template<
typename T1
506 inline const DMatTSMatMultExpr<T1,T2>
512 throw std::invalid_argument(
"Matrix sizes do not match" );
529 template<
typename MT1,
typename MT2,
typename VT >
530 struct DMatDVecMultExprTrait< DMatTSMatMultExpr<MT1,MT2>, VT >
534 typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
535 IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
536 IsDenseVector<VT>::value && !IsTransposeVector<VT>::value
537 ,
typename DMatDVecMultExprTrait< MT1, typename TSMatDVecMultExprTrait<MT2,VT>::Type >::Type
538 , INVALID_TYPE >::Type Type;
547 template<
typename MT1,
typename MT2,
typename VT >
548 struct DMatSVecMultExprTrait< DMatTSMatMultExpr<MT1,MT2>, VT >
552 typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
553 IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
554 IsSparseVector<VT>::value && !IsTransposeVector<VT>::value
555 ,
typename DMatSVecMultExprTrait< MT1, typename TSMatSVecMultExprTrait<MT2,VT>::Type >::Type
556 , INVALID_TYPE >::Type Type;
565 template<
typename VT,
typename MT1,
typename MT2 >
566 struct TDVecDMatMultExprTrait< VT, DMatTSMatMultExpr<MT1,MT2> >
570 typedef typename SelectType< IsDenseVector<VT>::value && IsTransposeVector<VT>::value &&
571 IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
572 IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value
573 ,
typename TDVecTSMatMultExprTrait< typename TDVecDMatMultExprTrait<VT,MT1>::Type, MT2 >::Type
574 , INVALID_TYPE >::Type Type;
583 template<
typename VT,
typename MT1,
typename MT2 >
584 struct TSVecDMatMultExprTrait< VT, DMatTSMatMultExpr<MT1,MT2> >
588 typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
589 IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
590 IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value
591 ,
typename TDVecTSMatMultExprTrait< typename TSVecDMatMultExprTrait<VT,MT1>::Type, MT2 >::Type
592 , INVALID_TYPE >::Type Type;
601 template<
typename MT1,
typename MT2 >
602 struct RowExprTrait< DMatTSMatMultExpr<MT1,MT2> >
606 typedef typename MultExprTrait< typename RowExprTrait<const MT1>::Type, MT2 >::Type Type;
615 template<
typename MT1,
typename MT2 >
616 struct ColumnExprTrait< DMatTSMatMultExpr<MT1,MT2> >
620 typedef typename MultExprTrait< MT1, typename ColumnExprTrait<const MT2>::Type >::Type Type;