35 #ifndef _BLAZE_MATH_EXPRESSIONS_TDMATSVECMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_TDMATSVECMULTEXPR_H_
108 template<
typename MT
110 class TDMatSVecMultExpr :
public DenseVector< TDMatSVecMultExpr<MT,VT>, false >
111 ,
private MatVecMultExpr
112 ,
private Computation
140 template<
typename T1 >
141 struct UseSMPAssign {
142 enum :
bool { value = ( evaluateMatrix || evaluateVector ) };
153 template<
typename T1,
typename T2,
typename T3 >
154 struct UseVectorizedKernel {
156 !IsDiagonal<T2>::value &&
157 T1::simdEnabled && T2::simdEnabled &&
158 AreSIMDCombinable< ElementType_<T1>
160 , ElementType_<T3> >::value &&
161 HasSIMDAdd< ElementType_<T2>, ElementType_<T3> >::value &&
162 HasSIMDMult< ElementType_<T2>, ElementType_<T3> >::value };
173 template<
typename T1,
typename T2,
typename T3 >
174 struct UseOptimizedKernel {
175 enum :
bool { value = !UseVectorizedKernel<T1,T2,T3>::value &&
176 !IsDiagonal<T2>::value &&
177 !IsResizable< ElementType_<T1> >::value &&
178 !IsResizable<VET>::value };
188 template<
typename T1,
typename T2,
typename T3 >
189 struct UseDefaultKernel {
190 enum :
bool { value = !UseVectorizedKernel<T1,T2,T3>::value &&
191 !UseOptimizedKernel<T1,T2,T3>::value };
227 enum :
bool { smpAssignable = !evaluateMatrix && MT::smpAssignable &&
228 !evaluateVector && VT::smpAssignable };
261 return mat_(index,index) *
vec_[index];
271 const size_t n (
mat_.columns() -
begin );
288 inline ReturnType
at(
size_t index )
const {
289 if( index >=
mat_.rows() ) {
292 return (*
this)[index];
301 inline size_t size() const noexcept {
332 template<
typename T >
333 inline bool canAlias(
const T* alias )
const noexcept {
334 return mat_.isAliased( alias ) ||
vec_.isAliased( alias );
344 template<
typename T >
345 inline bool isAliased(
const T* alias )
const noexcept {
346 return mat_.isAliased( alias ) ||
vec_.isAliased( alias );
356 return mat_.isAligned();
366 return (
size() > SMP_TDMATSVECMULT_THRESHOLD );
389 template<
typename VT1 >
397 RT x(
serial( rhs.vec_ ) );
398 if( x.nonZeros() == 0UL ) {
404 LT A(
serial( rhs.mat_ ) );
413 TDMatSVecMultExpr::selectAssignKernel( ~lhs, A, x );
432 template<
typename VT1
436 selectAssignKernel( VT1& y,
const MT1& A,
const VT2& x )
442 const size_t M( A.rows() );
444 ConstIterator element( x.begin() );
445 const ConstIterator
end( x.end() );
451 for(
size_t i=0UL; i<iend; ++i )
455 for( ; element!=
end; ++element )
457 const size_t index( element->index() );
459 if( IsDiagonal<MT1>::value )
461 for(
size_t i=last; i<index; ++i )
464 y[index] = A(index,index) * element->value();
469 const size_t ibegin( ( IsLower<MT1>::value )
470 ?( IsStrictlyLower<MT1>::value ? index+1UL : index )
472 const size_t iend( ( IsUpper<MT1>::value )
473 ?( IsStrictlyUpper<MT1>::value ? index : index+1UL )
477 for(
size_t i=ibegin; i<last; ++i ) {
478 y[i] += A(i,index) * element->value();
480 for(
size_t i=last; i<iend; ++i ) {
481 y[i] = A(i,index) * element->value();
488 if( IsUpper<MT1>::value ) {
489 for(
size_t i=last; i<M; ++i )
510 template<
typename VT1
513 static inline EnableIf_< UseOptimizedKernel<VT1,MT1,VT2> >
514 selectAssignKernel( VT1& y,
const MT1& A,
const VT2& x )
516 typedef ConstIterator_< RemoveReference_<RT> >
ConstIterator;
520 const size_t M( A.rows() );
522 ConstIterator element( x.begin() );
523 const ConstIterator
end( x.end() );
525 const size_t jpos( x.nonZeros() & size_t(-4) );
526 BLAZE_INTERNAL_ASSERT( ( x.nonZeros() - ( x.nonZeros() % 4UL ) ) == jpos,
"Invalid end calculation" );
530 const size_t j1( element->index() );
531 const VET v1( element->value() );
533 const size_t j2( element->index() );
534 const VET v2( element->value() );
536 const size_t j3( element->index() );
537 const VET v3( element->value() );
539 const size_t j4( element->index() );
540 const VET v4( element->value() );
545 for(
size_t i=0UL; i<M; ++i ) {
546 y[i] = A(i,j1) * v1 + A(i,j2) * v2 + A(i,j3) * v3 + A(i,j4) * v4;
551 const size_t j1( element->index() );
552 const VET v1( element->value() );
555 for(
size_t i=0UL; i<M; ++i ) {
560 for(
size_t j=(jpos>3UL)?(4UL):(1UL); (j+4UL)<=jpos; j+=4UL )
562 const size_t j1( element->index() );
563 const VET v1( element->value() );
565 const size_t j2( element->index() );
566 const VET v2( element->value() );
568 const size_t j3( element->index() );
569 const VET v3( element->value() );
571 const size_t j4( element->index() );
572 const VET v4( element->value() );
577 const size_t ibegin( ( IsLower<MT1>::value )
578 ?( IsStrictlyLower<MT1>::value ? j1+1UL : j1 )
580 const size_t iend( ( IsUpper<MT1>::value )
581 ?( IsStrictlyUpper<MT1>::value ? j4 : j4+1UL )
585 for(
size_t i=ibegin; i<iend; ++i ) {
586 y[i] += A(i,j1) * v1 + A(i,j2) * v2 + A(i,j3) * v3 + A(i,j4) * v4;
589 for( ; element!=
end; ++element )
591 const size_t j1( element->index() );
592 const VET v1( element->value() );
594 const size_t ibegin( ( IsLower<MT1>::value )
595 ?( IsStrictlyLower<MT1>::value ? j1+1UL : j1 )
597 const size_t iend( ( IsUpper<MT1>::value )
598 ?( IsStrictlyUpper<MT1>::value ? j1 : j1+1UL )
602 for(
size_t i=ibegin; i<iend; ++i ) {
603 y[i] += A(i,j1) * v1;
624 template<
typename VT1
627 static inline EnableIf_< UseVectorizedKernel<VT1,MT1,VT2> >
628 selectAssignKernel( VT1& y,
const MT1& A,
const VT2& x )
630 typedef ConstIterator_< RemoveReference_<RT> >
ConstIterator;
634 const size_t M( A.rows() );
636 const bool remainder( !IsPadded<MT1>::value || !IsPadded<VT1>::value );
638 ConstIterator element( x.begin() );
639 const ConstIterator
end( x.end() );
641 const size_t jpos( x.nonZeros() & size_t(-4) );
642 BLAZE_INTERNAL_ASSERT( ( x.nonZeros() - ( x.nonZeros() % 4UL ) ) == jpos,
"Invalid end calculation" );
646 const size_t j1( element->index() );
647 const VET v1( element->value() );
649 const size_t j2( element->index() );
650 const VET v2( element->value() );
652 const size_t j3( element->index() );
653 const VET v3( element->value() );
655 const size_t j4( element->index() );
656 const VET v4( element->value() );
661 const SIMDType xmm1(
set( v1 ) );
662 const SIMDType xmm2(
set( v2 ) );
663 const SIMDType xmm3(
set( v3 ) );
664 const SIMDType xmm4(
set( v4 ) );
666 const size_t ipos( remainder ? ( M &
size_t(-SIMDSIZE) ) : M );
671 for( ; i<ipos; i+=SIMDSIZE ) {
672 y.store( i, A.load(i,j1) * xmm1 + A.load(i,j2) * xmm2 + A.load(i,j3) * xmm3 + A.load(i,j4) * xmm4 );
674 for( ; remainder && i<M; ++i ) {
675 y[i] = A(i,j1) * v1 + A(i,j2) * v2 + A(i,j3) * v3 + A(i,j4) * v4;
680 const size_t j1( element->index() );
681 const VET v1( element->value() );
684 const SIMDType xmm1(
set( v1 ) );
686 const size_t ipos( remainder ? ( M &
size_t(-SIMDSIZE) ) : M );
691 for( ; i<ipos; i+=SIMDSIZE ) {
692 y.store( i, A.load(i,j1) * xmm1 );
694 for( ; remainder && i<M; ++i ) {
699 for(
size_t j=(jpos>3UL)?(4UL):(1UL); (j+4UL)<=jpos; j+=4UL )
701 const size_t j1( element->index() );
702 const VET v1( element->value() );
704 const size_t j2( element->index() );
705 const VET v2( element->value() );
707 const size_t j3( element->index() );
708 const VET v3( element->value() );
710 const size_t j4( element->index() );
711 const VET v4( element->value() );
716 const SIMDType xmm1(
set( v1 ) );
717 const SIMDType xmm2(
set( v2 ) );
718 const SIMDType xmm3(
set( v3 ) );
719 const SIMDType xmm4(
set( v4 ) );
721 const size_t ibegin( ( IsLower<MT1>::value )
722 ?( ( IsStrictlyLower<MT1>::value ? j1+1UL : j1 ) &
size_t(-SIMDSIZE) )
724 const size_t iend( ( IsUpper<MT1>::value )
725 ?( IsStrictlyUpper<MT1>::value ? j4 : j4+1UL )
729 const size_t ipos( remainder ? ( iend &
size_t(-SIMDSIZE) ) : iend );
730 BLAZE_INTERNAL_ASSERT( !remainder || ( iend - ( iend % SIMDSIZE ) ) == ipos,
"Invalid end calculation" );
734 for( ; i<ipos; i+=SIMDSIZE ) {
735 y.store( i, y.load(i) + A.load(i,j1) * xmm1 + A.load(i,j2) * xmm2 + A.load(i,j3) * xmm3 + A.load(i,j4) * xmm4 );
737 for( ; remainder && i<iend; ++i ) {
738 y[i] += A(i,j1) * v1 + A(i,j2) * v2 + A(i,j3) * v3 + A(i,j4) * v4;
742 for( ; element!=
end; ++element )
744 const size_t j1( element->index() );
745 const VET v1( element->value() );
747 const SIMDType xmm1(
set( v1 ) );
749 const size_t ibegin( ( IsLower<MT1>::value )
750 ?( ( IsStrictlyLower<MT1>::value ? j1+1UL : j1 ) &
size_t(-SIMDSIZE) )
752 const size_t iend( ( IsUpper<MT1>::value )
753 ?( IsStrictlyUpper<MT1>::value ? j1 : j1+1UL )
757 const size_t ipos( remainder ? ( iend &
size_t(-SIMDSIZE) ) : iend );
758 BLAZE_INTERNAL_ASSERT( !remainder || ( iend - ( iend % SIMDSIZE ) ) == ipos,
"Invalid end calculation" );
762 for( ; i<ipos; i+=SIMDSIZE ) {
763 y.store( i, y.load(i) + A.load(i,j1) * xmm1 );
765 for( ; remainder && i<iend; ++i ) {
766 y[i] += A(i,j1) * v1;
786 template<
typename VT1 >
787 friend inline void assign( SparseVector<VT1,false>& lhs,
const TDMatSVecMultExpr& rhs )
797 const ResultType tmp(
serial( rhs ) );
816 template<
typename VT1 >
817 friend inline void addAssign( DenseVector<VT1,false>& lhs,
const TDMatSVecMultExpr& rhs )
824 RT x(
serial( rhs.vec_ ) );
825 if( x.nonZeros() == 0UL )
return;
828 LT A(
serial( rhs.mat_ ) );
837 TDMatSVecMultExpr::selectAddAssignKernel( ~lhs, A, x );
856 template<
typename VT1
859 static inline EnableIf_< UseDefaultKernel<VT1,MT1,VT2> >
860 selectAddAssignKernel( VT1& y,
const MT1& A,
const VT2& x )
862 typedef ConstIterator_< RemoveReference_<RT> >
ConstIterator;
866 const size_t M( A.rows() );
868 ConstIterator element( x.begin() );
869 const ConstIterator
end( x.end() );
871 for( ; element!=
end; ++element )
873 const size_t index( element->index() );
875 if( IsDiagonal<MT1>::value )
877 y[index] += A(index,index) * element->value();
881 const size_t ibegin( ( IsLower<MT1>::value )
882 ?( IsStrictlyLower<MT1>::value ? index+1UL : index )
884 const size_t iend( ( IsUpper<MT1>::value )
885 ?( IsStrictlyUpper<MT1>::value ? index : index+1UL )
889 for(
size_t i=ibegin; i<iend; ++i ) {
890 y[i] += A(i,index) * element->value();
912 template<
typename VT1
915 static inline EnableIf_< UseOptimizedKernel<VT1,MT1,VT2> >
916 selectAddAssignKernel( VT1& y,
const MT1& A,
const VT2& x )
918 typedef ConstIterator_< RemoveReference_<RT> >
ConstIterator;
922 const size_t M( A.rows() );
924 ConstIterator element( x.begin() );
925 const ConstIterator
end( x.end() );
927 const size_t jpos( x.nonZeros() & size_t(-4) );
928 BLAZE_INTERNAL_ASSERT( ( x.nonZeros() - ( x.nonZeros() % 4UL ) ) == jpos,
"Invalid end calculation" );
930 for(
size_t j=0UL; (j+4UL)<=jpos; j+=4UL )
932 const size_t j1( element->index() );
933 const VET v1( element->value() );
935 const size_t j2( element->index() );
936 const VET v2( element->value() );
938 const size_t j3( element->index() );
939 const VET v3( element->value() );
941 const size_t j4( element->index() );
942 const VET v4( element->value() );
947 const size_t ibegin( ( IsLower<MT1>::value )
948 ?( IsStrictlyLower<MT1>::value ? j1+1UL : j1 )
950 const size_t iend( ( IsUpper<MT1>::value )
951 ?( IsStrictlyUpper<MT1>::value ? j4 : j4+1UL )
955 for(
size_t i=ibegin; i<iend; ++i ) {
956 y[i] += A(i,j1) * v1 + A(i,j2) * v2 + A(i,j3) * v3 + A(i,j4) * v4;
959 for( ; element!=
end; ++element )
961 const size_t j1( element->index() );
962 const VET v1( element->value() );
964 const size_t ibegin( ( IsLower<MT1>::value )
965 ?( IsStrictlyLower<MT1>::value ? j1+1UL : j1 )
967 const size_t iend( ( IsUpper<MT1>::value )
968 ?( IsStrictlyUpper<MT1>::value ? j1 : j1+1UL )
972 for(
size_t i=ibegin; i<iend; ++i ) {
973 y[i] += A(i,j1) * v1;
994 template<
typename VT1
997 static inline EnableIf_< UseVectorizedKernel<VT1,MT1,VT2> >
998 selectAddAssignKernel( VT1& y,
const MT1& A,
const VT2& x )
1000 typedef ConstIterator_< RemoveReference_<RT> >
ConstIterator;
1004 const size_t M( A.rows() );
1006 const bool remainder( !IsPadded<MT1>::value || !IsPadded<VT1>::value );
1008 ConstIterator element( x.begin() );
1009 const ConstIterator
end( x.end() );
1011 const size_t jpos( x.nonZeros() & size_t(-4) );
1012 BLAZE_INTERNAL_ASSERT( ( x.nonZeros() - ( x.nonZeros() % 4UL ) ) == jpos,
"Invalid end calculation" );
1014 for(
size_t j=0UL; (j+4UL)<=jpos; j+=4UL )
1016 const size_t j1( element->index() );
1017 const VET v1( element->value() );
1019 const size_t j2( element->index() );
1020 const VET v2( element->value() );
1022 const size_t j3( element->index() );
1023 const VET v3( element->value() );
1025 const size_t j4( element->index() );
1026 const VET v4( element->value() );
1031 const SIMDType xmm1(
set( v1 ) );
1032 const SIMDType xmm2(
set( v2 ) );
1033 const SIMDType xmm3(
set( v3 ) );
1034 const SIMDType xmm4(
set( v4 ) );
1036 const size_t ibegin( ( IsLower<MT1>::value )
1037 ?( ( IsStrictlyLower<MT1>::value ? j1+1UL : j1 ) &
size_t(-SIMDSIZE) )
1039 const size_t iend( ( IsUpper<MT1>::value )
1040 ?( IsStrictlyUpper<MT1>::value ? j4 : j4+1UL )
1044 const size_t ipos( remainder ? ( iend &
size_t(-SIMDSIZE) ) : iend );
1045 BLAZE_INTERNAL_ASSERT( !remainder || ( iend - ( iend % SIMDSIZE ) ) == ipos,
"Invalid end calculation" );
1049 for( ; i<ipos; i+=SIMDSIZE ) {
1050 y.store( i, y.load(i) + A.load(i,j1) * xmm1 + A.load(i,j2) * xmm2 + A.load(i,j3) * xmm3 + A.load(i,j4) * xmm4 );
1052 for( ; remainder && i<iend; ++i ) {
1053 y[i] += A(i,j1) * v1 + A(i,j2) * v2 + A(i,j3) * v3 + A(i,j4) * v4;
1056 for( ; element!=
end; ++element )
1058 const size_t j1( element->index() );
1059 const VET v1( element->value() );
1061 const SIMDType xmm1(
set( v1 ) );
1063 const size_t ibegin( ( IsLower<MT1>::value )
1064 ?( ( IsStrictlyLower<MT1>::value ? j1+1UL : j1 ) &
size_t(-SIMDSIZE) )
1066 const size_t iend( ( IsUpper<MT1>::value )
1067 ?( IsStrictlyUpper<MT1>::value ? j1 : j1+1UL )
1071 const size_t ipos( remainder ? ( iend &
size_t(-SIMDSIZE) ) : iend );
1072 BLAZE_INTERNAL_ASSERT( !remainder || ( iend - ( iend % SIMDSIZE ) ) == ipos,
"Invalid end calculation" );
1076 for( ; i<ipos; i+=SIMDSIZE ) {
1077 y.store( i, y.load(i) + A.load(i,j1) * xmm1 );
1079 for( ; remainder && i<iend; ++i ) {
1080 y[i] += A(i,j1) * v1;
1104 template<
typename VT1 >
1105 friend inline void subAssign( DenseVector<VT1,false>& lhs,
const TDMatSVecMultExpr& rhs )
1112 RT x(
serial( rhs.vec_ ) );
1113 if( x.nonZeros() == 0UL )
return;
1116 LT A(
serial( rhs.mat_ ) );
1125 TDMatSVecMultExpr::selectSubAssignKernel( ~lhs, A, x );
1144 template<
typename VT1
1147 static inline EnableIf_< UseDefaultKernel<VT1,MT1,VT2> >
1148 selectSubAssignKernel( VT1& y,
const MT1& A,
const VT2& x )
1150 typedef ConstIterator_< RemoveReference_<RT> >
ConstIterator;
1154 const size_t M( A.rows() );
1156 ConstIterator element( x.begin() );
1157 const ConstIterator
end( x.end() );
1159 for( ; element!=
end; ++element )
1161 const size_t index( element->index() );
1163 if( IsDiagonal<MT1>::value )
1165 y[index] -= A(index,index) * element->value();
1169 const size_t ibegin( ( IsLower<MT1>::value )
1170 ?( IsStrictlyLower<MT1>::value ? index+1UL : index )
1172 const size_t iend( ( IsUpper<MT1>::value )
1173 ?( IsStrictlyUpper<MT1>::value ? index : index+1UL )
1177 for(
size_t i=ibegin; i<iend; ++i ) {
1178 y[i] -= A(i,index) * element->value();
1200 template<
typename VT1
1203 static inline EnableIf_< UseOptimizedKernel<VT1,MT1,VT2> >
1204 selectSubAssignKernel( VT1& y,
const MT1& A,
const VT2& x )
1206 typedef ConstIterator_< RemoveReference_<RT> >
ConstIterator;
1210 const size_t M( A.rows() );
1212 ConstIterator element( x.begin() );
1213 const ConstIterator
end( x.end() );
1215 const size_t jpos( x.nonZeros() & size_t(-4) );
1216 BLAZE_INTERNAL_ASSERT( ( x.nonZeros() - ( x.nonZeros() % 4UL ) ) == jpos,
"Invalid end calculation" );
1218 for(
size_t j=0UL; (j+4UL)<=jpos; j+=4UL )
1220 const size_t j1( element->index() );
1221 const VET v1( element->value() );
1223 const size_t j2( element->index() );
1224 const VET v2( element->value() );
1226 const size_t j3( element->index() );
1227 const VET v3( element->value() );
1229 const size_t j4( element->index() );
1230 const VET v4( element->value() );
1235 const size_t ibegin( ( IsLower<MT1>::value )
1236 ?( IsStrictlyLower<MT1>::value ? j1+1UL : j1 )
1238 const size_t iend( ( IsUpper<MT1>::value )
1239 ?( IsStrictlyUpper<MT1>::value ? j4 : j4+1UL )
1243 for(
size_t i=ibegin; i<iend; ++i ) {
1244 y[i] -= A(i,j1) * v1 + A(i,j2) * v2 + A(i,j3) * v3 + A(i,j4) * v4;
1247 for( ; element!=
end; ++element )
1249 const size_t j1( element->index() );
1250 const VET v1( element->value() );
1252 const size_t ibegin( ( IsLower<MT1>::value )
1253 ?( IsStrictlyLower<MT1>::value ? j1+1UL : j1 )
1255 const size_t iend( ( IsUpper<MT1>::value )
1256 ?( IsStrictlyUpper<MT1>::value ? j1 : j1+1UL )
1260 for(
size_t i=ibegin; i<iend; ++i ) {
1261 y[i] -= A(i,j1) * v1;
1282 template<
typename VT1
1285 static inline EnableIf_< UseVectorizedKernel<VT1,MT1,VT2> >
1286 selectSubAssignKernel( VT1& y,
const MT1& A,
const VT2& x )
1288 typedef ConstIterator_< RemoveReference_<RT> >
ConstIterator;
1292 const size_t M( A.rows() );
1294 const bool remainder( !IsPadded<MT1>::value || !IsPadded<VT1>::value );
1296 ConstIterator element( x.begin() );
1297 const ConstIterator
end( x.end() );
1299 const size_t jpos( x.nonZeros() & size_t(-4) );
1300 BLAZE_INTERNAL_ASSERT( ( x.nonZeros() - ( x.nonZeros() % 4UL ) ) == jpos,
"Invalid end calculation" );
1302 for(
size_t j=0UL; (j+4UL)<=jpos; j+=4UL )
1304 const size_t j1( element->index() );
1305 const VET v1( element->value() );
1307 const size_t j2( element->index() );
1308 const VET v2( element->value() );
1310 const size_t j3( element->index() );
1311 const VET v3( element->value() );
1313 const size_t j4( element->index() );
1314 const VET v4( element->value() );
1319 const SIMDType xmm1(
set( v1 ) );
1320 const SIMDType xmm2(
set( v2 ) );
1321 const SIMDType xmm3(
set( v3 ) );
1322 const SIMDType xmm4(
set( v4 ) );
1324 const size_t ibegin( ( IsLower<MT1>::value )
1325 ?( ( IsStrictlyLower<MT1>::value ? j1+1UL : j1 ) &
size_t(-SIMDSIZE) )
1327 const size_t iend( ( IsUpper<MT1>::value )
1328 ?( IsStrictlyUpper<MT1>::value ? j4 : j4+1UL )
1332 const size_t ipos( remainder ? ( iend &
size_t(-SIMDSIZE) ) : iend );
1333 BLAZE_INTERNAL_ASSERT( !remainder || ( iend - ( iend % SIMDSIZE ) ) == ipos,
"Invalid end calculation" );
1337 for( ; i<ipos; i+=SIMDSIZE ) {
1338 y.store( i, y.load(i) - A.load(i,j1) * xmm1 - A.load(i,j2) * xmm2 - A.load(i,j3) * xmm3 - A.load(i,j4) * xmm4 );
1340 for( ; remainder && i<iend; ++i ) {
1341 y[i] -= A(i,j1) * v1 + A(i,j2) * v2 + A(i,j3) * v3 + A(i,j4) * v4;
1344 for( ; element!=
end; ++element )
1346 const size_t j1( element->index() );
1347 const VET v1( element->value() );
1349 const SIMDType xmm1(
set( v1 ) );
1351 const size_t ibegin( ( IsLower<MT1>::value )
1352 ?( ( IsStrictlyLower<MT1>::value ? j1+1UL : j1 ) &
size_t(-SIMDSIZE) )
1354 const size_t iend( ( IsUpper<MT1>::value )
1355 ?( IsStrictlyUpper<MT1>::value ? j1 : j1+1UL )
1359 const size_t ipos( remainder ? ( iend &
size_t(-SIMDSIZE) ) : iend );
1360 BLAZE_INTERNAL_ASSERT( !remainder || ( iend - ( iend % SIMDSIZE ) ) == ipos,
"Invalid end calculation" );
1364 for( ; i<ipos; i+=SIMDSIZE ) {
1365 y.store( i, y.load(i) - A.load(i,j1) * xmm1 );
1367 for( ; remainder && i<iend; ++i ) {
1368 y[i] -= A(i,j1) * v1;
1392 template<
typename VT1 >
1393 friend inline void multAssign( DenseVector<VT1,false>& lhs,
const TDMatSVecMultExpr& rhs )
1403 const ResultType tmp(
serial( rhs ) );
1404 multAssign( ~lhs, tmp );
1426 template<
typename VT1 >
1427 friend inline void divAssign( DenseVector<VT1,false>& lhs,
const TDMatSVecMultExpr& rhs )
1437 const ResultType tmp(
serial( rhs ) );
1438 divAssign( ~lhs, tmp );
1462 template<
typename VT1 >
1463 friend inline EnableIf_< UseSMPAssign<VT1> >
1472 if( x.nonZeros() == 0UL ) {
1507 template<
typename VT1 >
1508 friend inline EnableIf_< UseSMPAssign<VT1> >
1519 const ResultType tmp( rhs );
1540 template<
typename VT1 >
1541 friend inline EnableIf_< UseSMPAssign<VT1> >
1550 if( x.nonZeros() == 0UL )
return;
1586 template<
typename VT1 >
1587 friend inline EnableIf_< UseSMPAssign<VT1> >
1596 if( x.nonZeros() == 0UL )
return;
1632 template<
typename VT1 >
1633 friend inline EnableIf_< UseSMPAssign<VT1> >
1644 const ResultType tmp( rhs );
1669 template<
typename VT1 >
1670 friend inline EnableIf_< UseSMPAssign<VT1> >
1681 const ResultType tmp( rhs );
1744 template<
typename T1
1746 inline const DisableIf_< IsMatMatMultExpr<T1>, TDMatSVecMultExpr<T1,T2> >
1770 template<
typename MT,
typename VT >
1787 template<
typename MT,
typename VT >
1805 template<
typename MT,
typename VT,
bool AF >
1810 using Type = MultExprTrait_< SubmatrixExprTrait_<const MT,AF>
1811 , SubvectorExprTrait_<const VT,AF> >;
#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
RightOperand vec_
Right-hand side sparse vector of the multiplication expression.
Definition: TDMatSVecMultExpr.h:373
constexpr bool useOptimizedKernels
Configuration switch for optimized kernels.This configuration switch enables/disables all optimized c...
Definition: Optimizations.h:84
CompositeType_< VT > VCT
Composite type of the right-hand side sparse vector expression.
Definition: TDMatSVecMultExpr.h:121
Header file for the Rows 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
Header file for basic type definitions.
CompositeType_< MT > MCT
Composite type of the left-hand side dense matrix expression.
Definition: TDMatSVecMultExpr.h:120
ElementType_< ResultType > ElementType
Resulting element type.
Definition: TDMatSVecMultExpr.h:201
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a column dense or sparse vector type...
Definition: ColumnVector.h:61
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
IfTrue_< evaluateVector, const VRT, CompositeType_< VT > > RT
Type for the assignment of the right-hand side dense matrix operand.
Definition: TDMatSVecMultExpr.h:216
Header file for the serial shim.
Header file for the IsDiagonal type trait.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
#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 IsSame and IsStrictlySame type traits.
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
Availability of a SIMD multiplication for the given data types.Depending on the available instruction...
Definition: HasSIMDMult.h:162
MultTrait_< MRT, VRT > ResultType
Result type for expression template evaluations.
Definition: TDMatSVecMultExpr.h:199
typename SIMDTrait< T >::Type SIMDTrait_
Auxiliary alias declaration for the SIMDTrait class template.The SIMDTrait_ alias declaration provide...
Definition: SIMDTrait.h:315
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
ElementType_< VRT > VET
Element type of the right-hand side sparse vector expression.
Definition: TDMatSVecMultExpr.h:119
Header file for the DenseVector base class.
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:88
Availability of a SIMD addition for the given data types.Depending on the available instruction set (...
Definition: HasSIMDAdd.h:162
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.
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TDMatSVecMultExpr.h:203
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:88
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: TDMatSVecMultExpr.h:355
Header file for the RequiresEvaluation type trait.
System settings for performance optimizations.
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
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
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
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
IfTrue_< evaluateMatrix, const MRT, MCT > LT
Type for the assignment of the left-hand side dense matrix operand.
Definition: TDMatSVecMultExpr.h:213
Constraint on the transpose flag of vector types.
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
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TDMatSVecMultExpr.h:345
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
ResultType_< MT > MRT
Result type of the left-hand side dense matrix expression.
Definition: TDMatSVecMultExpr.h:116
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
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
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 IsMatMatMultExpr type trait class.
LeftOperand mat_
Left-hand side dense matrix of the multiplication expression.
Definition: TDMatSVecMultExpr.h:372
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TDMatSVecMultExpr.h:200
#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 HasSIMDAdd type trait.
If_< IsExpression< MT >, const MT, const MT & > LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: TDMatSVecMultExpr.h:207
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Header file for all SIMD functionality.
LeftOperand leftOperand() const noexcept
Returns the left-hand side transpose dense matrix operand.
Definition: TDMatSVecMultExpr.h:311
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
Header file for the IsLower type trait.
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type...
Definition: SparseVector.h:61
Header file for the IsAligned type trait.
Compile time check for diagonal matrices.This type trait tests whether or not the given template para...
Definition: IsDiagonal.h:90
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:330
#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
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_MATVECMULTEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid matrix/vector ...
Definition: MatVecMultExpr.h:110
Constraint on the data type.
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
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
Header file for all forward declarations for expression class templates.
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
If_< IsExpression< VT >, const VT, const VT & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: TDMatSVecMultExpr.h:210
Expression object for transpose dense matrix-sparse vector multiplications.The TDMatSVecMultExpr clas...
Definition: Forward.h:133
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:76
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
SIMDTrait_< ElementType > SIMDType
Resulting SIMD element type.
Definition: TDMatSVecMultExpr.h:202
Header file for the SubmatrixExprTrait class template.
Header file for the HasSIMDMult type trait.
Header file for run time assertion macros.
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
EnableIf_< IsDenseVector< VT1 > > smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:222
const ResultType CompositeType
Data type for composite expression templates.
Definition: TDMatSVecMultExpr.h:204
Header file for the reset shim.
RightOperand rightOperand() const noexcept
Returns the right-hand side sparse vector operand.
Definition: TDMatSVecMultExpr.h:321
Constraints on the storage order of matrix types.
ResultType_< VT > VRT
Result type of the right-hand side sparse vector expression.
Definition: TDMatSVecMultExpr.h:117
TDMatSVecMultExpr(const MT &mat, const VT &vec) noexcept
Constructor for the TDMatSVecMultExpr class.
Definition: TDMatSVecMultExpr.h:242
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
Header file for the RemoveReference type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
ElementType_< MRT > MET
Element type of the left-hand side dense matrix expression.
Definition: TDMatSVecMultExpr.h:118
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
Header file for the AreSIMDCombinable type trait.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TDMatSVecMultExpr.h:333
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: TDMatSVecMultExpr.h:288
Header file for the IsComputation type trait class.
TDMatSVecMultExpr< MT, VT > This
Type of this TDMatSVecMultExpr instance.
Definition: TDMatSVecMultExpr.h:198
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:110
#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.
Header file for the SubvectorExprTrait class template.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: TDMatSVecMultExpr.h:365
Constraint on the data type.
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 MatVecMultExpr base class.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: TDMatSVecMultExpr.h:256
Header file for the IsResizable type trait.
Header file for the Size type trait.
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 IsExpression type trait class.
Header file for the FunctionTrace class.
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: TDMatSVecMultExpr.h:301