22 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATTSMATMULTEXPR_H_
23 #define _BLAZE_MATH_EXPRESSIONS_DMATTSMATMULTEXPR_H_
31 #include <boost/type_traits/remove_reference.hpp>
80 template<
typename MT1
88 typedef typename MT1::ResultType
RT1;
89 typedef typename MT2::ResultType
RT2;
90 typedef typename MT1::CompositeType
CT1;
91 typedef typename MT2::CompositeType
CT2;
119 enum { vectorizable = 0 };
150 typedef typename boost::remove_reference<CT2>::type::ConstIterator ConstIterator;
155 if(
lhs_.columns() == 0UL )
163 const ConstIterator end( B.end(j) );
164 ConstIterator element( B.begin(j) );
171 tmp =
lhs_(i,element->index()) * element->value();
173 for( ; element!=end; ++element )
174 tmp +=
lhs_(i,element->index()) * element->value();
180 for(
size_t k=1UL; k<
lhs_.columns(); ++k ) {
205 return rhs_.columns();
235 template<
typename T >
259 template<
typename MT
266 typedef typename boost::remove_reference<RT>::type::ConstIterator ConstIterator;
275 for(
size_t i=0UL; i<(~lhs).
rows(); ++i ) {
276 for(
size_t j=0UL; j<(~lhs).
columns(); ++j )
278 ConstIterator element( B.begin(j) );
279 const ConstIterator end( B.end(j) );
281 if( element == end ) {
282 reset( (~lhs)(i,j) );
286 (~lhs)(i,j) = A(i,element->index()) * element->value();
288 for( ; element!=end; ++element )
289 (~lhs)(i,j) += A(i,element->index()) * element->value();
309 template<
typename MT
325 const TmpType tmp( rhs );
344 template<
typename MT
351 typedef typename boost::remove_reference<RT>::type::ConstIterator ConstIterator;
360 for(
size_t i=0UL; i<(~lhs).
rows(); ++i ) {
361 for(
size_t j=0UL; j<(~lhs).
columns(); ++j )
363 ConstIterator element( B.begin(j) );
364 const ConstIterator end( B.end(j) );
366 for( ; element!=end; ++element )
367 (~lhs)(i,j) += A(i,element->index()) * element->value();
391 template<
typename MT
398 typedef typename boost::remove_reference<RT>::type::ConstIterator ConstIterator;
407 for(
size_t i=0UL; i<(~lhs).
rows(); ++i ) {
408 for(
size_t j=0UL; j<(~lhs).
columns(); ++j )
410 ConstIterator element( B.begin(j) );
411 const ConstIterator end( B.end(j) );
413 for( ; element!=end; ++element )
414 (~lhs)(i,j) -= A(i,element->index()) * element->value();
483 template<
typename T1
485 inline const DMatTSMatMultExpr<T1,T2>
489 throw std::invalid_argument(
"Matrix sizes do not match" );
506 template<
typename MT1,
typename MT2,
typename VT >
507 struct DMatDVecMultExprTrait< DMatTSMatMultExpr<MT1,MT2>, VT >
511 typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
512 IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
513 IsDenseVector<VT>::value && !IsTransposeVector<VT>::value
514 ,
typename DMatDVecMultExprTrait< MT1, typename TSMatDVecMultExprTrait<MT2,VT>::Type >::Type
515 , INVALID_TYPE >::Type Type;
524 template<
typename MT1,
typename MT2,
typename VT >
525 struct DMatSVecMultExprTrait< DMatTSMatMultExpr<MT1,MT2>, VT >
529 typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
530 IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
531 IsSparseVector<VT>::value && !IsTransposeVector<VT>::value
532 ,
typename DMatSVecMultExprTrait< MT1, typename TSMatSVecMultExprTrait<MT2,VT>::Type >::Type
533 , INVALID_TYPE >::Type Type;
542 template<
typename VT,
typename MT1,
typename MT2 >
543 struct TDVecDMatMultExprTrait< VT, DMatTSMatMultExpr<MT1,MT2> >
547 typedef typename SelectType< IsDenseVector<VT>::value && IsTransposeVector<VT>::value &&
548 IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
549 IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value
550 ,
typename TDVecTSMatMultExprTrait< typename TDVecDMatMultExprTrait<VT,MT1>::Type, MT2 >::Type
551 , INVALID_TYPE >::Type Type;
560 template<
typename VT,
typename MT1,
typename MT2 >
561 struct TSVecDMatMultExprTrait< VT, DMatTSMatMultExpr<MT1,MT2> >
565 typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
566 IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
567 IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value
568 ,
typename TDVecTSMatMultExprTrait< typename TSVecDMatMultExprTrait<VT,MT1>::Type, MT2 >::Type
569 , INVALID_TYPE >::Type Type;