35 #ifndef _BLAZE_MATH_EXPRESSIONS_TDMATSMATMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_TDMATSMATMULTEXPR_H_
126 template<
typename MT1
128 class TDMatSMatMultExpr :
public DenseMatrix< TDMatSMatMultExpr<MT1,MT2>, true >
129 ,
private MatMatMultExpr
130 ,
private Computation
159 template<
typename T1,
typename T2,
typename T3 >
160 struct CanExploitSymmetry {
161 enum :
bool { value = IsSymmetric<T3>::value };
172 template<
typename T1,
typename T2,
typename T3 >
173 struct IsEvaluationRequired {
174 enum :
bool { value = ( evaluateLeft || evaluateRight ) &&
175 !CanExploitSymmetry<T1,T2,T3>::value };
186 template<
typename T1,
typename T2,
typename T3 >
187 struct UseOptimizedKernel {
189 !IsDiagonal<T2>::value &&
190 !IsResizable< ElementType_<T1> >::value &&
191 !( IsColumnMajorMatrix<T1>::value && IsResizable<ET2>::value ) };
201 template<
typename T1,
typename T2,
typename T3 >
202 struct UseDefaultKernel {
203 enum :
bool { value = !UseOptimizedKernel<T1,T2,T3>::value };
233 enum :
bool { simdEnabled =
false };
236 enum :
bool { smpAssignable = !evaluateLeft && MT1::smpAssignable &&
237 !evaluateRight && MT2::smpAssignable };
287 :(
lhs_.columns() ) ) );
291 const size_t n(
end - begin );
309 inline ReturnType
at(
size_t i,
size_t j )
const {
310 if( i >=
lhs_.rows() ) {
313 if( j >=
rhs_.columns() ) {
325 inline size_t rows() const noexcept {
336 return rhs_.columns();
366 template<
typename T >
367 inline bool canAlias(
const T* alias )
const noexcept {
368 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
378 template<
typename T >
380 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
390 return lhs_.isAligned();
400 return (
rows() *
columns() >= SMP_TDMATSMATMULT_THRESHOLD );
423 template<
typename MT
433 LT A(
serial( rhs.lhs_ ) );
434 RT B(
serial( rhs.rhs_ ) );
443 TDMatSMatMultExpr::selectAssignKernel( ~lhs, A, B );
459 template<
typename MT3
462 static inline void selectAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
464 if( C.rows() * C.columns() < TDMATSMATMULT_THRESHOLD )
465 selectSmallAssignKernel( C, A, B );
467 selectLargeAssignKernel( C, A, B );
487 template<
typename MT3
490 static inline void selectDefaultAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
496 for(
size_t j=0UL; j<B.rows(); ++j )
498 ConstIterator element( B.begin(j) );
499 const ConstIterator
end( B.end(j) );
501 if( IsDiagonal<MT4>::value )
503 for( ; element!=
end; ++element ) {
504 C(j,element->index()) = A(j,j) * element->value();
509 const size_t ibegin( ( IsLower<MT4>::value )
510 ?( IsStrictlyLower<MT4>::value ? j+1UL : j )
512 const size_t iend( ( IsUpper<MT4>::value )
513 ?( IsStrictlyUpper<MT4>::value ? j : j+1UL )
517 for( ; element!=
end; ++element ) {
518 for(
size_t i=ibegin; i<iend; ++i ) {
520 C(i,element->index()) = A(i,j) * element->value();
522 C(i,element->index()) += A(i,j) * element->value();
545 template<
typename MT3
548 static inline EnableIf_< UseDefaultKernel<MT3,MT4,MT5> >
549 selectSmallAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
551 selectDefaultAssignKernel( C, A, B );
571 template<
typename MT3
574 static inline EnableIf_< UseOptimizedKernel<MT3,MT4,MT5> >
575 selectSmallAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
583 for(
size_t j=0UL; j<B.rows(); ++j )
585 ConstIterator element( B.begin(j) );
586 const ConstIterator
end( B.end(j) );
588 const size_t nonzeros( B.nonZeros(j) );
589 const size_t kpos( nonzeros &
size_t(-4) );
592 const size_t ibegin( ( IsLower<MT4>::value )
593 ?( IsStrictlyLower<MT4>::value ? j+1UL : j )
595 const size_t iend( ( IsUpper<MT4>::value )
596 ?( IsStrictlyUpper<MT4>::value ? j : j+1UL )
600 const size_t inum( iend - ibegin );
601 const size_t ipos( ibegin + ( inum &
size_t(-4) ) );
604 for(
size_t k=0UL; k<kpos; k+=4UL )
606 const size_t j1( element->index() );
607 const ET2 v1( element->value() );
609 const size_t j2( element->index() );
610 const ET2 v2( element->value() );
612 const size_t j3( element->index() );
613 const ET2 v3( element->value() );
615 const size_t j4( element->index() );
616 const ET2 v4( element->value() );
621 for( i=ibegin; i<ipos; i+=4UL ) {
622 C(i ,j1) += A(i ,j) * v1;
623 C(i+1UL,j1) += A(i+1UL,j) * v1;
624 C(i+2UL,j1) += A(i+2UL,j) * v1;
625 C(i+3UL,j1) += A(i+3UL,j) * v1;
626 C(i ,j2) += A(i ,j) * v2;
627 C(i+1UL,j2) += A(i+1UL,j) * v2;
628 C(i+2UL,j2) += A(i+2UL,j) * v2;
629 C(i+3UL,j2) += A(i+3UL,j) * v2;
630 C(i ,j3) += A(i ,j) * v3;
631 C(i+1UL,j3) += A(i+1UL,j) * v3;
632 C(i+2UL,j3) += A(i+2UL,j) * v3;
633 C(i+3UL,j3) += A(i+3UL,j) * v3;
634 C(i ,j4) += A(i ,j) * v4;
635 C(i+1UL,j4) += A(i+1UL,j) * v4;
636 C(i+2UL,j4) += A(i+2UL,j) * v4;
637 C(i+3UL,j4) += A(i+3UL,j) * v4;
639 for( ; i<iend; ++i ) {
640 C(i,j1) += A(i,j) * v1;
641 C(i,j2) += A(i,j) * v2;
642 C(i,j3) += A(i,j) * v3;
643 C(i,j4) += A(i,j) * v4;
647 for( ; element!=
end; ++element )
649 const size_t j1( element->index() );
650 const ET2 v1( element->value() );
652 for( i=ibegin; i<ipos; i+=4UL ) {
653 C(i ,j1) += A(i ,j) * v1;
654 C(i+1UL,j1) += A(i+1UL,j) * v1;
655 C(i+2UL,j1) += A(i+2UL,j) * v1;
656 C(i+3UL,j1) += A(i+3UL,j) * v1;
658 for( ; i<iend; ++i ) {
659 C(i,j1) += A(i,j) * v1;
681 template<
typename MT3
684 static inline EnableIf_< UseDefaultKernel<MT3,MT4,MT5> >
685 selectLargeAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
687 selectDefaultAssignKernel( C, A, B );
707 template<
typename MT3
710 static inline EnableIf_< UseOptimizedKernel<MT3,MT4,MT5> >
711 selectLargeAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
715 const OppositeType_<MT5> tmp(
serial( B ) );
716 assign( C, A * tmp );
734 template<
typename MT
736 friend inline DisableIf_< CanExploitSymmetry<MT,MT1,MT2> >
741 typedef IfTrue_< SO, ResultType, OppositeType > TmpType;
753 const TmpType tmp(
serial( rhs ) );
774 template<
typename MT
776 friend inline EnableIf_< CanExploitSymmetry<MT,MT1,MT2> >
786 assign( ~lhs, rhs.lhs_ *
trans( rhs.rhs_ ) );
804 template<
typename MT
806 friend inline DisableIf_< CanExploitSymmetry<MT,MT1,MT2> >
814 LT A(
serial( rhs.lhs_ ) );
815 RT B(
serial( rhs.rhs_ ) );
824 TDMatSMatMultExpr::selectAddAssignKernel( ~lhs, A, B );
840 template<
typename MT3
843 static inline void selectAddAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
845 if( C.rows() * C.columns() < TDMATSMATMULT_THRESHOLD )
846 selectSmallAddAssignKernel( C, A, B );
848 selectLargeAddAssignKernel( C, A, B );
868 template<
typename MT3
871 static inline void selectDefaultAddAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
877 for(
size_t j=0UL; j<B.rows(); ++j )
879 ConstIterator element( B.begin(j) );
880 const ConstIterator
end( B.end(j) );
882 if( IsDiagonal<MT4>::value )
884 for( ; element!=
end; ++element ) {
885 C(j,element->index()) += A(j,j) * element->value();
890 const size_t ibegin( ( IsLower<MT4>::value )
891 ?( IsStrictlyLower<MT4>::value ? j+1UL : j )
893 const size_t iend( ( IsUpper<MT4>::value )
894 ?( IsStrictlyUpper<MT4>::value ? j : j+1UL )
898 const size_t inum( iend - ibegin );
899 const size_t ipos( ibegin + ( inum &
size_t(-4) ) );
902 for( ; element!=
end; ++element ) {
903 for( i=ibegin; i<ipos; i+=4UL ) {
904 C(i ,element->index()) += A(i ,j) * element->value();
905 C(i+1UL,element->index()) += A(i+1UL,j) * element->value();
906 C(i+2UL,element->index()) += A(i+2UL,j) * element->value();
907 C(i+3UL,element->index()) += A(i+3UL,j) * element->value();
909 for( ; i<iend; ++i ) {
910 C(i,element->index()) += A(i,j) * element->value();
933 template<
typename MT3
936 static inline EnableIf_< UseDefaultKernel<MT3,MT4,MT5> >
937 selectSmallAddAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
939 selectDefaultAddAssignKernel( C, A, B );
959 template<
typename MT3
962 static inline EnableIf_< UseOptimizedKernel<MT3,MT4,MT5> >
963 selectSmallAddAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
969 for(
size_t j=0UL; j<B.rows(); ++j )
971 ConstIterator element( B.begin(j) );
972 const ConstIterator
end( B.end(j) );
974 const size_t nonzeros( B.nonZeros(j) );
975 const size_t kpos( nonzeros &
size_t(-4) );
978 const size_t ibegin( ( IsLower<MT4>::value )
979 ?( IsStrictlyLower<MT4>::value ? j+1UL : j )
981 const size_t iend( ( IsUpper<MT4>::value )
982 ?( IsStrictlyUpper<MT4>::value ? j : j+1UL )
986 const size_t inum( iend - ibegin );
987 const size_t ipos( ibegin + ( inum &
size_t(-4) ) );
990 for(
size_t k=0UL; k<kpos; k+=4UL )
992 const size_t j1( element->index() );
993 const ET2 v1( element->value() );
995 const size_t j2( element->index() );
996 const ET2 v2( element->value() );
998 const size_t j3( element->index() );
999 const ET2 v3( element->value() );
1001 const size_t j4( element->index() );
1002 const ET2 v4( element->value() );
1007 for( i=ibegin; i<ipos; i+=4UL ) {
1008 C(i ,j1) += A(i ,j) * v1;
1009 C(i+1UL,j1) += A(i+1UL,j) * v1;
1010 C(i+2UL,j1) += A(i+2UL,j) * v1;
1011 C(i+3UL,j1) += A(i+3UL,j) * v1;
1012 C(i ,j2) += A(i ,j) * v2;
1013 C(i+1UL,j2) += A(i+1UL,j) * v2;
1014 C(i+2UL,j2) += A(i+2UL,j) * v2;
1015 C(i+3UL,j2) += A(i+3UL,j) * v2;
1016 C(i ,j3) += A(i ,j) * v3;
1017 C(i+1UL,j3) += A(i+1UL,j) * v3;
1018 C(i+2UL,j3) += A(i+2UL,j) * v3;
1019 C(i+3UL,j3) += A(i+3UL,j) * v3;
1020 C(i ,j4) += A(i ,j) * v4;
1021 C(i+1UL,j4) += A(i+1UL,j) * v4;
1022 C(i+2UL,j4) += A(i+2UL,j) * v4;
1023 C(i+3UL,j4) += A(i+3UL,j) * v4;
1025 for( ; i<iend; ++i ) {
1026 C(i,j1) += A(i,j) * v1;
1027 C(i,j2) += A(i,j) * v2;
1028 C(i,j3) += A(i,j) * v3;
1029 C(i,j4) += A(i,j) * v4;
1033 for( ; element!=
end; ++element )
1035 const size_t j1( element->index() );
1036 const ET2 v1( element->value() );
1038 for( i=ibegin; i<ipos; i+=4UL ) {
1039 C(i ,j1) += A(i ,j) * v1;
1040 C(i+1UL,j1) += A(i+1UL,j) * v1;
1041 C(i+2UL,j1) += A(i+2UL,j) * v1;
1042 C(i+3UL,j1) += A(i+3UL,j) * v1;
1044 for( ; i<iend; ++i ) {
1045 C(i,j1) += A(i,j) * v1;
1067 template<
typename MT3
1070 static inline EnableIf_< UseDefaultKernel<MT3,MT4,MT5> >
1071 selectLargeAddAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
1073 selectDefaultAddAssignKernel( C, A, B );
1093 template<
typename MT3
1096 static inline EnableIf_< UseOptimizedKernel<MT3,MT4,MT5> >
1097 selectLargeAddAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
1101 const OppositeType_<MT5> tmp(
serial( B ) );
1102 addAssign( C, A * tmp );
1122 template<
typename MT
1124 friend inline EnableIf_< CanExploitSymmetry<MT,MT1,MT2> >
1132 addAssign( ~lhs, rhs.lhs_ *
trans( rhs.rhs_ ) );
1154 template<
typename MT
1156 friend inline DisableIf_< CanExploitSymmetry<MT,MT1,MT2> >
1164 LT A(
serial( rhs.lhs_ ) );
1165 RT B(
serial( rhs.rhs_ ) );
1174 TDMatSMatMultExpr::selectSubAssignKernel( ~lhs, A, B );
1190 template<
typename MT3
1193 static inline void selectSubAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
1195 if( C.rows() * C.columns() < TDMATSMATMULT_THRESHOLD )
1196 selectSmallSubAssignKernel( C, A, B );
1198 selectLargeSubAssignKernel( C, A, B );
1218 template<
typename MT3
1221 static inline void selectDefaultSubAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
1227 for(
size_t j=0UL; j<B.rows(); ++j )
1229 ConstIterator element( B.begin(j) );
1230 const ConstIterator
end( B.end(j) );
1232 if( IsDiagonal<MT4>::value )
1234 for( ; element!=
end; ++element ) {
1235 C(j,element->index()) -= A(j,j) * element->value();
1240 const size_t ibegin( ( IsLower<MT4>::value )
1241 ?( IsStrictlyLower<MT4>::value ? j+1UL : j )
1243 const size_t iend( ( IsUpper<MT4>::value )
1244 ?( IsStrictlyUpper<MT4>::value ? j : j+1UL )
1248 const size_t inum( iend - ibegin );
1249 const size_t ipos( ibegin + ( inum &
size_t(-4) ) );
1252 for( ; element!=
end; ++element ) {
1253 for( i=ibegin; i<ipos; i+=4UL ) {
1254 C(i ,element->index()) -= A(i ,j) * element->value();
1255 C(i+1UL,element->index()) -= A(i+1UL,j) * element->value();
1256 C(i+2UL,element->index()) -= A(i+2UL,j) * element->value();
1257 C(i+3UL,element->index()) -= A(i+3UL,j) * element->value();
1259 for( ; i<iend; ++i ) {
1260 C(i,element->index()) -= A(i,j) * element->value();
1283 template<
typename MT3
1286 static inline EnableIf_< UseDefaultKernel<MT3,MT4,MT5> >
1287 selectSmallSubAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
1289 selectDefaultSubAssignKernel( C, A, B );
1309 template<
typename MT3
1312 static inline EnableIf_< UseOptimizedKernel<MT3,MT4,MT5> >
1313 selectSmallSubAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
1319 for(
size_t j=0UL; j<B.rows(); ++j )
1321 ConstIterator element( B.begin(j) );
1322 const ConstIterator
end( B.end(j) );
1324 const size_t nonzeros( B.nonZeros(j) );
1325 const size_t kpos( nonzeros &
size_t(-4) );
1328 const size_t ibegin( ( IsLower<MT4>::value )
1329 ?( IsStrictlyLower<MT4>::value ? j+1UL : j )
1331 const size_t iend( ( IsUpper<MT4>::value )
1332 ?( IsStrictlyUpper<MT4>::value ? j : j+1UL )
1336 const size_t inum( iend - ibegin );
1337 const size_t ipos( ibegin + ( inum &
size_t(-4) ) );
1340 for(
size_t k=0UL; k<kpos; k+=4UL )
1342 const size_t j1( element->index() );
1343 const ET2 v1( element->value() );
1345 const size_t j2( element->index() );
1346 const ET2 v2( element->value() );
1348 const size_t j3( element->index() );
1349 const ET2 v3( element->value() );
1351 const size_t j4( element->index() );
1352 const ET2 v4( element->value() );
1357 for( i=ibegin; i<ipos; i+=4UL ) {
1358 C(i ,j1) -= A(i ,j) * v1;
1359 C(i+1UL,j1) -= A(i+1UL,j) * v1;
1360 C(i+2UL,j1) -= A(i+2UL,j) * v1;
1361 C(i+3UL,j1) -= A(i+3UL,j) * v1;
1362 C(i ,j2) -= A(i ,j) * v2;
1363 C(i+1UL,j2) -= A(i+1UL,j) * v2;
1364 C(i+2UL,j2) -= A(i+2UL,j) * v2;
1365 C(i+3UL,j2) -= A(i+3UL,j) * v2;
1366 C(i ,j3) -= A(i ,j) * v3;
1367 C(i+1UL,j3) -= A(i+1UL,j) * v3;
1368 C(i+2UL,j3) -= A(i+2UL,j) * v3;
1369 C(i+3UL,j3) -= A(i+3UL,j) * v3;
1370 C(i ,j4) -= A(i ,j) * v4;
1371 C(i+1UL,j4) -= A(i+1UL,j) * v4;
1372 C(i+2UL,j4) -= A(i+2UL,j) * v4;
1373 C(i+3UL,j4) -= A(i+3UL,j) * v4;
1375 for( ; i<iend; ++i ) {
1376 C(i,j1) -= A(i,j) * v1;
1377 C(i,j2) -= A(i,j) * v2;
1378 C(i,j3) -= A(i,j) * v3;
1379 C(i,j4) -= A(i,j) * v4;
1383 for( ; element!=
end; ++element )
1385 const size_t j1( element->index() );
1386 const ET2 v1( element->value() );
1388 for( i=ibegin; i<ipos; i+=4UL ) {
1389 C(i ,j1) -= A(i ,j) * v1;
1390 C(i+1UL,j1) -= A(i+1UL,j) * v1;
1391 C(i+2UL,j1) -= A(i+2UL,j) * v1;
1392 C(i+3UL,j1) -= A(i+3UL,j) * v1;
1394 for( ; i<iend; ++i ) {
1395 C(i,j1) -= A(i,j) * v1;
1417 template<
typename MT3
1420 static inline EnableIf_< UseDefaultKernel<MT3,MT4,MT5> >
1421 selectLargeSubAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
1423 selectDefaultSubAssignKernel( C, A, B );
1443 template<
typename MT3
1446 static inline EnableIf_< UseOptimizedKernel<MT3,MT4,MT5> >
1447 selectLargeSubAssignKernel( MT3& C,
const MT4& A,
const MT5& B )
1451 const OppositeType_<MT5> tmp(
serial( B ) );
1452 subAssign( C, A * tmp );
1472 template<
typename MT
1474 friend inline EnableIf_< CanExploitSymmetry<MT,MT1,MT2> >
1484 subAssign( ~lhs, rhs.lhs_ *
trans( rhs.rhs_ ) );
1517 template<
typename MT
1519 friend inline EnableIf_< IsEvaluationRequired<MT,MT1,MT2> >
1558 template<
typename MT
1560 friend inline EnableIf_< IsEvaluationRequired<MT,MT1,MT2> >
1565 typedef IfTrue_< SO, ResultType, OppositeType > TmpType;
1577 const TmpType tmp( rhs );
1598 template<
typename MT
1600 friend inline EnableIf_< CanExploitSymmetry<MT,MT1,MT2> >
1629 template<
typename MT
1631 friend inline EnableIf_< IsEvaluationRequired<MT,MT1,MT2> >
1669 template<
typename MT
1671 friend inline EnableIf_< CanExploitSymmetry<MT,MT1,MT2> >
1706 template<
typename MT
1708 friend inline EnableIf_< IsEvaluationRequired<MT,MT1,MT2> >
1746 template<
typename MT
1748 friend inline EnableIf_< CanExploitSymmetry<MT,MT1,MT2> >
1826 template<
typename T1
1828 inline const TDMatSMatMultExpr<T1,T2>
1852 template<
typename MT1,
typename MT2 >
1869 template<
typename MT1,
typename MT2 >
1886 template<
typename MT1,
typename MT2 >
1904 template<
typename MT1,
typename MT2 >
1906 :
public BoolConstant< And< IsLower<MT1>, IsLower<MT2> >::value >
1922 template<
typename MT1,
typename MT2 >
1924 :
public BoolConstant< And< IsUniLower<MT1>, IsUniLower<MT2> >::value >
1940 template<
typename MT1,
typename MT2 >
1942 :
public BoolConstant< Or< And< IsStrictlyLower<MT1>, IsLower<MT2> >
1943 , And< IsStrictlyLower<MT2>, IsLower<MT1> > >::value >
1959 template<
typename MT1,
typename MT2 >
1961 :
public BoolConstant< And< IsUpper<MT1>, IsUpper<MT2> >::value >
1977 template<
typename MT1,
typename MT2 >
1979 :
public BoolConstant< And< IsUniUpper<MT1>, IsUniUpper<MT2> >::value >
1995 template<
typename MT1,
typename MT2 >
1997 :
public BoolConstant< Or< And< IsStrictlyUpper<MT1>, IsUpper<MT2> >
1998 , And< IsStrictlyUpper<MT2>, IsUpper<MT1> > >::value >
2014 template<
typename MT1,
typename MT2,
typename VT >
2019 using Type = If_< And< IsDenseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2020 , IsSparseMatrix<MT2>, IsRowMajorMatrix<MT2>
2021 , IsDenseVector<VT>, IsColumnVector<VT> >
2022 , TDMatDVecMultExprTrait_< MT1, SMatDVecMultExprTrait_<MT2,VT> >
2032 template<
typename MT1,
typename MT2,
typename VT >
2037 using Type = If_< And< IsDenseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2038 , IsSparseMatrix<MT2>, IsRowMajorMatrix<MT2>
2039 , IsSparseVector<VT>, IsColumnVector<VT> >
2040 , TDMatSVecMultExprTrait_< MT1, SMatSVecMultExprTrait_<MT2,VT> >
2050 template<
typename VT,
typename MT1,
typename MT2 >
2055 using Type = If_< And< IsDenseVector<VT>, IsRowVector<VT>
2056 , IsDenseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2057 , IsSparseMatrix<MT2>, IsRowMajorMatrix<MT2> >
2058 , TDMatDVecMultExprTrait_< MT1, SMatDVecMultExprTrait_<MT2,VT> >
2068 template<
typename VT,
typename MT1,
typename MT2 >
2073 using Type = If_< And< IsSparseVector<VT>, IsRowVector<VT>
2074 , IsDenseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2075 , IsSparseMatrix<MT2>, IsRowMajorMatrix<MT2> >
2076 , TDVecSMatMultExprTrait_< TSVecTDMatMultExprTrait_<VT,MT1>, MT2 >
2086 template<
typename MT1,
typename MT2,
bool AF >
2091 using Type = MultExprTrait_< SubmatrixExprTrait_<const MT1,AF>
2092 , SubmatrixExprTrait_<const MT2,AF> >;
2101 template<
typename MT1,
typename MT2 >
2106 using Type = MultExprTrait_< RowExprTrait_<const MT1>, MT2 >;
2115 template<
typename MT1,
typename MT2 >
2120 using Type = MultExprTrait_< MT1, ColumnExprTrait_<const MT2> >;
CompositeType_< MT1 > CT1
Composite type of the left-hand side dense matrix expression.
Definition: TDMatSMatMultExpr.h:138
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:72
Header file for mathematical functions.
constexpr bool useOptimizedKernels
Configuration switch for optimized kernels.This configuration switch enables/disables all optimized c...
Definition: Optimizations.h:84
Header file for the SMatDVecMultExprTrait class template.
const ResultType CompositeType
Data type for composite expression templates.
Definition: TDMatSMatMultExpr.h:216
Header file for the Rows type trait.
Header file for the IsUniUpper type trait.
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7800
If_< IsExpression< MT2 >, const MT2, const MT2 & > RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: TDMatSMatMultExpr.h:222
Compile time check for triangular matrix types.This type trait tests whether or not the given templat...
Definition: IsTriangular.h:87
Header file for basic type definitions.
RightOperand rightOperand() const noexcept
Returns the right-hand side sparse matrix operand.
Definition: TDMatSMatMultExpr.h:355
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
Header file for the IsSparseMatrix type trait.
Header file for the serial shim.
Header file for the IsDiagonal type trait.
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
Header file for the ColumnExprTrait class template.
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:188
Header file for the IsColumnMajorMatrix type trait.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
ResultType_< MT2 > RT2
Result type of the right-hand side sparse matrix expression.
Definition: TDMatSMatMultExpr.h:135
Header file for the IsRowVector type trait.
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
Header file for the And class template.
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1669
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:88
Header file for the TDVecSMatMultExprTrait class template.
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:723
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:245
Header file for the Computation base class.
Header file for the MatMatMultExpr base class.
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:88
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TDMatSMatMultExpr.h:215
Constraints on the storage order of matrix types.
Header file for the RequiresEvaluation type trait.
System settings for performance optimizations.
Expression object for transpose dense matrix-sparse matrix multiplications.The TDMatSMatMultExpr clas...
Definition: Forward.h:131
Header file for the IsUniLower type trait.
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1716
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT > >, ColumnExprTrait_< MT > > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:126
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:109
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Constraint on the data type.
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
Constraint on the data type.
Constraint on the data type.
Header file for the MultExprTrait class template.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:72
SubvectorExprTrait_< VT, unaligned > subvector(Vector< VT, TF > &vector, size_t index, size_t size)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:152
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: TDMatSMatMultExpr.h:335
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: TDMatSMatMultExpr.h:389
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: ColumnMajorMatrix.h:61
MultTrait_< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: TDMatSMatMultExpr.h:211
Header file for the TSVecTDMatMultExprTrait class template.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
IfTrue_< evaluateLeft, const RT1, CT1 > LT
Type for the assignment of the left-hand side dense matrix operand.
Definition: TDMatSMatMultExpr.h:225
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
Header file for the Or class template.
Header file for the TDMatSVecMultExprTrait class template.
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
Header file for the Columns type trait.
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
ElementType_< RT1 > ET1
Element type of the left-hand side dense matrix expression.
Definition: TDMatSMatMultExpr.h:136
Header file for the IsLower type trait.
Header file for the IsAligned type trait.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TDMatSMatMultExpr.h:367
Compile time check for diagonal matrices.This type trait tests whether or not the given template para...
Definition: IsDiagonal.h:90
RightOperand rhs_
Right-hand side sparse matrix of the multiplication expression.
Definition: TDMatSMatMultExpr.h:407
LeftOperand lhs_
Left-hand side dense matrix of the multiplication expression.
Definition: TDMatSMatMultExpr.h:406
Header file for the SMatSVecMultExprTrait class template.
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:60
Header file for the IsTriangular type trait.
Constraints on the storage order of matrix types.
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: TDMatSMatMultExpr.h:379
Header file for the exception macros of the math module.
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
ElementType_< ResultType > ElementType
Resulting element type.
Definition: TDMatSMatMultExpr.h:214
OppositeType_< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: TDMatSMatMultExpr.h:212
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:254
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: TDMatSMatMultExpr.h:261
Header file for the RowExprTrait class template.
Header file for all forward declarations for expression class templates.
Header file for the IsDenseMatrix type trait.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
ElementType_< RT2 > ET2
Element type of the right-hand side sparse matrix expression.
Definition: TDMatSMatMultExpr.h:137
CompositeType_< MT2 > CT2
Composite type of the right-hand side sparse matrix expression.
Definition: TDMatSMatMultExpr.h:139
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_MATMATMULTEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid matrix/matrix ...
Definition: MatMatMultExpr.h:109
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: TDMatSMatMultExpr.h:309
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT > >, RowExprTrait_< MT > > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:126
Header file for the IsSparseVector type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
Header file for the SubmatrixExprTrait class template.
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: RowMajorMatrix.h:61
Header file for run time assertion macros.
Utility type for generic codes.
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:160
Header file for the reset shim.
Header file for the isDefault shim.
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TDMatSMatMultExpr.h:213
Constraint on the data type.
Constraints on the storage order of matrix types.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: TDMatSMatMultExpr.h:399
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: TDMatSMatMultExpr.h:325
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
typename T::OppositeType OppositeType_
Alias declaration for nested OppositeType type definitions.The OppositeType_ alias declaration provid...
Definition: Aliases.h:243
#define BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER(T1, T2)
Constraint on the data type.In case either of the two given data types T1 or T2 is not a matrix type ...
Definition: StorageOrder.h:84
Header file for the IsDenseVector type trait.
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
Header file for the IsRowMajorMatrix type trait.
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:950
TDMatSMatMultExpr< MT1, MT2 > This
Type of this TDMatSMatMultExpr instance.
Definition: TDMatSMatMultExpr.h:210
Header file for the IsComputation type trait class.
Header file for the TDMatDVecMultExprTrait class template.
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
Header file for the IntegralConstant class template.
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
Header file for the IsUpper type trait.
Header file for the IsColumnVector type trait.
Constraint on the data type.
LeftOperand leftOperand() const noexcept
Returns the left-hand side transpose dense matrix operand.
Definition: TDMatSMatMultExpr.h:345
IfTrue_< evaluateRight, const RT2, CT2 > RT
Type for the assignment of the right-hand side sparse matrix operand.
Definition: TDMatSMatMultExpr.h:228
Header file for the IsResizable type trait.
TDMatSMatMultExpr(const MT1 &lhs, const MT2 &rhs) noexcept
Constructor for the TDMatSMatMultExpr class.
Definition: TDMatSMatMultExpr.h:246
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the TDVecTDMatMultExprTrait class template.
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:61
If_< IsExpression< MT1 >, const MT1, const MT1 & > LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: TDMatSMatMultExpr.h:219
ResultType_< MT1 > RT1
Result type of the left-hand side dense matrix expression.
Definition: TDMatSMatMultExpr.h:134
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.