DVecTDVecMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DVECTDVECMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DVECTDVECMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
57 #include <blaze/math/Intrinsics.h>
74 #include <blaze/system/Inline.h>
77 #include <blaze/util/Assert.h>
79 #include <blaze/util/EnableIf.h>
80 #include <blaze/util/Exception.h>
82 #include <blaze/util/SelectType.h>
83 #include <blaze/util/Types.h>
86 
87 
88 namespace blaze {
89 
90 //=================================================================================================
91 //
92 // CLASS DVECTDVECMULTEXPR
93 //
94 //=================================================================================================
95 
96 //*************************************************************************************************
103 template< typename VT1 // Type of the left-hand side dense vector
104  , typename VT2 > // Type of the right-hand side dense vector
105 class DVecTDVecMultExpr : public DenseMatrix< DVecTDVecMultExpr<VT1,VT2>, false >
106  , private VecTVecMultExpr
107  , private Computation
108 {
109  private:
110  //**Type definitions****************************************************************************
111  typedef typename VT1::ResultType RT1;
112  typedef typename VT2::ResultType RT2;
113  typedef typename RT1::ElementType ET1;
114  typedef typename RT2::ElementType ET2;
115  typedef typename VT1::ReturnType RN1;
116  typedef typename VT2::ReturnType RN2;
117  typedef typename VT1::CompositeType CT1;
118  typedef typename VT2::CompositeType CT2;
119  //**********************************************************************************************
120 
121  //**********************************************************************************************
124  //**********************************************************************************************
125 
126  //**********************************************************************************************
128  enum { evaluateRight = IsComputation<VT2>::value || RequiresEvaluation<VT2>::value };
129  //**********************************************************************************************
130 
131  //**Return type evaluation**********************************************************************
133 
138  enum { returnExpr = !IsTemporary<RN1>::value && !IsTemporary<RN2>::value };
139 
142  //**********************************************************************************************
143 
144  //**Serial evaluation strategy******************************************************************
146 
152  enum { useAssign = ( evaluateLeft || evaluateRight ) };
153 
155  template< typename VT >
157  struct UseAssign {
158  enum { value = useAssign };
159  };
161  //**********************************************************************************************
162 
163  //**Parallel evaluation strategy****************************************************************
165 
169  template< typename VT >
170  struct UseSMPAssign {
171  enum { value = evaluateRight };
172  };
174  //**********************************************************************************************
175 
176  //**********************************************************************************************
178 
181  template< typename T1, typename T2, typename T3 >
182  struct UseVectorizedKernel {
183  enum { value = useOptimizedKernels &&
184  T1::vectorizable && T2::vectorizable && T3::vectorizable &&
188  };
190  //**********************************************************************************************
191 
192  //**********************************************************************************************
194 
197  template< typename T1, typename T2, typename T3 >
198  struct UseDefaultKernel {
199  enum { value = !UseVectorizedKernel<T1,T2,T3>::value };
200  };
202  //**********************************************************************************************
203 
204  public:
205  //**Type definitions****************************************************************************
212 
215 
218 
220  typedef typename SelectType< IsExpression<VT1>::value, const VT1, const VT1& >::Type LeftOperand;
221 
223  typedef typename SelectType< IsExpression<VT2>::value, const VT2, const VT2& >::Type RightOperand;
224 
227 
230  //**********************************************************************************************
231 
232  //**ConstIterator class definition**************************************************************
236  {
237  public:
238  //**Type definitions*************************************************************************
239  typedef std::random_access_iterator_tag IteratorCategory;
240  typedef ElementType ValueType;
241  typedef ElementType* PointerType;
242  typedef ElementType& ReferenceType;
244 
245  // STL iterator requirements
246  typedef IteratorCategory iterator_category;
247  typedef ValueType value_type;
248  typedef PointerType pointer;
249  typedef ReferenceType reference;
250  typedef DifferenceType difference_type;
251 
254 
257  //*******************************************************************************************
258 
259  //**Constructor******************************************************************************
265  explicit inline ConstIterator( LeftIteratorType left, RightIteratorType right )
266  : left_ ( left ) // Iterator to the current left-hand side element
267  , right_( right ) // Iterator to the current right-hand side element
268  {}
269  //*******************************************************************************************
270 
271  //**Addition assignment operator*************************************************************
277  inline ConstIterator& operator+=( size_t inc ) {
278  right_ += inc;
279  return *this;
280  }
281  //*******************************************************************************************
282 
283  //**Subtraction assignment operator**********************************************************
289  inline ConstIterator& operator-=( size_t dec ) {
290  right_ -= dec;
291  return *this;
292  }
293  //*******************************************************************************************
294 
295  //**Prefix increment operator****************************************************************
301  ++right_;
302  return *this;
303  }
304  //*******************************************************************************************
305 
306  //**Postfix increment operator***************************************************************
311  inline const ConstIterator operator++( int ) {
312  return ConstIterator( left_, right_++ );
313  }
314  //*******************************************************************************************
315 
316  //**Prefix decrement operator****************************************************************
322  --right_;
323  return *this;
324  }
325  //*******************************************************************************************
326 
327  //**Postfix decrement operator***************************************************************
332  inline const ConstIterator operator--( int ) {
333  return ConstIterator( left_, right_-- );
334  }
335  //*******************************************************************************************
336 
337  //**Element access operator******************************************************************
342  inline ReturnType operator*() const {
343  return (*left_) * (*right_);
344  }
345  //*******************************************************************************************
346 
347  //**Load function****************************************************************************
352  inline IntrinsicType load() const {
353  return set( *left_ ) * right_.load();
354  }
355  //*******************************************************************************************
356 
357  //**Equality operator************************************************************************
363  inline bool operator==( const ConstIterator& rhs ) const {
364  return right_ == rhs.right_;
365  }
366  //*******************************************************************************************
367 
368  //**Inequality operator**********************************************************************
374  inline bool operator!=( const ConstIterator& rhs ) const {
375  return right_ != rhs.right_;
376  }
377  //*******************************************************************************************
378 
379  //**Less-than operator***********************************************************************
385  inline bool operator<( const ConstIterator& rhs ) const {
386  return right_ < rhs.right_;
387  }
388  //*******************************************************************************************
389 
390  //**Greater-than operator********************************************************************
396  inline bool operator>( const ConstIterator& rhs ) const {
397  return right_ > rhs.right_;
398  }
399  //*******************************************************************************************
400 
401  //**Less-or-equal-than operator**************************************************************
407  inline bool operator<=( const ConstIterator& rhs ) const {
408  return right_ <= rhs.right_;
409  }
410  //*******************************************************************************************
411 
412  //**Greater-or-equal-than operator***********************************************************
418  inline bool operator>=( const ConstIterator& rhs ) const {
419  return right_ >= rhs.right_;
420  }
421  //*******************************************************************************************
422 
423  //**Subtraction operator*********************************************************************
429  inline DifferenceType operator-( const ConstIterator& rhs ) const {
430  return right_ - rhs.right_;
431  }
432  //*******************************************************************************************
433 
434  //**Addition operator************************************************************************
441  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
442  return ConstIterator( it.left_, it.right_ + inc );
443  }
444  //*******************************************************************************************
445 
446  //**Addition operator************************************************************************
453  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
454  return ConstIterator( it.left_, it.right_ + inc );
455  }
456  //*******************************************************************************************
457 
458  //**Subtraction operator*********************************************************************
465  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
466  return ConstIterator( it.left_, it.right_ - dec );
467  }
468  //*******************************************************************************************
469 
470  private:
471  //**Member variables*************************************************************************
472  LeftIteratorType left_;
473  RightIteratorType right_;
474  //*******************************************************************************************
475  };
476  //**********************************************************************************************
477 
478  //**Compilation flags***************************************************************************
480  enum { vectorizable = VT1::vectorizable && VT2::vectorizable &&
483 
485  enum { smpAssignable = VT1::smpAssignable && !evaluateRight };
486  //**********************************************************************************************
487 
488  //**Constructor*********************************************************************************
494  explicit inline DVecTDVecMultExpr( const VT1& lhs, const VT2& rhs )
495  : lhs_( lhs ) // Left-hand side dense vector of the multiplication expression
496  , rhs_( rhs ) // Right-hand side dense vector of the multiplication expression
497  {}
498  //**********************************************************************************************
499 
500  //**Access operator*****************************************************************************
507  inline ReturnType operator()( size_t i, size_t j ) const {
508  BLAZE_INTERNAL_ASSERT( i < lhs_.size(), "Invalid row access index" );
509  BLAZE_INTERNAL_ASSERT( j < rhs_.size(), "Invalid column access index" );
510 
511  return lhs_[i] * rhs_[j];
512  }
513  //**********************************************************************************************
514 
515  //**At function*********************************************************************************
523  inline ReturnType at( size_t i, size_t j ) const {
524  if( i >= lhs_.size() ) {
525  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
526  }
527  if( j >= rhs_.size() ) {
528  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
529  }
530  return (*this)(i,j);
531  }
532  //**********************************************************************************************
533 
534  //**Load function*******************************************************************************
541  BLAZE_ALWAYS_INLINE IntrinsicType load( size_t i, size_t j ) const {
542  typedef IntrinsicTrait<ElementType> IT;
543  BLAZE_INTERNAL_ASSERT( i < lhs_.size() , "Invalid row access index" );
544  BLAZE_INTERNAL_ASSERT( j < rhs_.size() , "Invalid column access index" );
545  BLAZE_INTERNAL_ASSERT( j % IT::size == 0UL, "Invalid column access index" );
546  const IntrinsicType xmm1( set( lhs_[i] ) );
547  const IntrinsicType xmm2( rhs_.load( j ) );
548  return xmm1 * xmm2;
549  }
550  //**********************************************************************************************
551 
552  //**Begin function******************************************************************************
558  inline ConstIterator begin( size_t i ) const {
559  BLAZE_INTERNAL_ASSERT( i < lhs_.size(), "Invalid row access index" );
560  return ConstIterator( lhs_.begin()+i, rhs_.begin() );
561  }
562  //**********************************************************************************************
563 
564  //**End function********************************************************************************
570  inline ConstIterator end( size_t i ) const {
571  BLAZE_INTERNAL_ASSERT( i < lhs_.size(), "Invalid row access index" );
572  return ConstIterator( lhs_.begin()+i, rhs_.end() );
573  }
574  //**********************************************************************************************
575 
576  //**Rows function*******************************************************************************
581  inline size_t rows() const {
582  return lhs_.size();
583  }
584  //**********************************************************************************************
585 
586  //**Columns function****************************************************************************
591  inline size_t columns() const {
592  return rhs_.size();
593  }
594  //**********************************************************************************************
595 
596  //**Left operand access*************************************************************************
601  inline LeftOperand leftOperand() const {
602  return lhs_;
603  }
604  //**********************************************************************************************
605 
606  //**Right operand access************************************************************************
611  inline RightOperand rightOperand() const {
612  return rhs_;
613  }
614  //**********************************************************************************************
615 
616  //**********************************************************************************************
622  template< typename T >
623  inline bool canAlias( const T* alias ) const {
624  return ( lhs_.canAlias( alias ) || rhs_.canAlias( alias ) );
625  }
626  //**********************************************************************************************
627 
628  //**********************************************************************************************
634  template< typename T >
635  inline bool isAliased( const T* alias ) const {
636  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
637  }
638  //**********************************************************************************************
639 
640  //**********************************************************************************************
645  inline bool isAligned() const {
646  return lhs_.isAligned() && rhs_.isAligned();
647  }
648  //**********************************************************************************************
649 
650  //**********************************************************************************************
655  inline bool canSMPAssign() const {
656  return ( rows() > SMP_DVECTDVECMULT_THRESHOLD );
657  }
658  //**********************************************************************************************
659 
660  private:
661  //**Member variables****************************************************************************
662  LeftOperand lhs_;
663  RightOperand rhs_;
664  //**********************************************************************************************
665 
666  //**Assignment to row-major dense matrices******************************************************
680  template< typename MT > // Type of the target dense matrix
681  friend inline typename EnableIf< UseAssign<MT> >::Type
682  assign( DenseMatrix<MT,false>& lhs, const DVecTDVecMultExpr& rhs )
683  {
685 
686  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
687  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
688 
689  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
690  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
691 
692  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
693  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
694  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
695  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
696 
697  DVecTDVecMultExpr::selectAssignKernel( ~lhs, x, y );
698  }
700  //**********************************************************************************************
701 
702  //**Default assignment to row-major dense matrices**********************************************
716  template< typename MT // Type of the left-hand side target matrix
717  , typename VT3 // Type of the left-hand side vector operand
718  , typename VT4 > // Type of the right-hand side vector operand
719  static inline typename EnableIf< UseDefaultKernel<MT,VT3,VT4> >::Type
720  selectAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
721  {
722  const size_t M( (~A).rows() );
723  const size_t N( (~A).columns() );
724 
725  const size_t jpos( N & size_t(-2) );
726  BLAZE_INTERNAL_ASSERT( ( N - ( N % 2UL ) ) == jpos, "Invalid end calculation" );
727 
728  for( size_t i=0UL; i<M; ++i ) {
729  for( size_t j=0UL; j<jpos; j+=2UL ) {
730  (~A)(i,j ) = x[i] * y[j ];
731  (~A)(i,j+1UL) = x[i] * y[j+1];
732  }
733  if( jpos < N ) {
734  (~A)(i,jpos) = x[i] * y[jpos];
735  }
736  }
737  }
739  //**********************************************************************************************
740 
741  //**Vectorized assignment to row-major dense matrices*******************************************
755  template< typename MT // Type of the left-hand side target matrix
756  , typename VT3 // Type of the left-hand side vector operand
757  , typename VT4 > // Type of the right-hand side vector operand
758  static inline typename EnableIf< UseVectorizedKernel<MT,VT3,VT4> >::Type
759  selectAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
760  {
761  typedef IntrinsicTrait<ElementType> IT;
762 
763  const size_t M( (~A).rows() );
764  const size_t N( (~A).columns() );
765 
766  const bool remainder( !IsPadded<MT>::value || !IsPadded<VT4>::value );
767 
768  const size_t jpos( remainder ? ( N & size_t(-IT::size) ) : N );
769  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % IT::size ) ) == jpos, "Invalid end calculation" );
770 
771  for( size_t i=0UL; i<M; ++i )
772  {
773  const IntrinsicType x1( set( x[i] ) );
774 
775  size_t j( 0UL );
776 
777  for( ; j<jpos; j+=IT::size ) {
778  (~A).store( i, j, x1 * y.load(j) );
779  }
780  for( ; remainder && j<N; ++j ) {
781  (~A)(i,j) = x[i] * y[j];
782  }
783  }
784  }
786  //**********************************************************************************************
787 
788  //**Assignment to column-major dense matrices***************************************************
800  template< typename MT > // Type of the target dense matrix
801  friend inline void assign( DenseMatrix<MT,true>& lhs, const DVecTDVecMultExpr& rhs )
802  {
804 
806 
807  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
808  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
809 
810  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
811  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
812 
813  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
814  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
815  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
816  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
817 
818  DVecTDVecMultExpr::selectAssignKernel( ~lhs, x, y );
819  }
821  //**********************************************************************************************
822 
823  //**Default assignment to column-major dense matrices*******************************************
837  template< typename MT // Type of the left-hand side target matrix
838  , typename VT3 // Type of the left-hand side vector operand
839  , typename VT4 > // Type of the right-hand side vector operand
840  static inline typename EnableIf< UseDefaultKernel<MT,VT3,VT4> >::Type
841  selectAssignKernel( DenseMatrix<MT,true>& A, const VT3& x, const VT4& y )
842  {
843  const size_t M( (~A).rows() );
844  const size_t N( (~A).columns() );
845 
846  const size_t ipos( M & size_t(-2) );
847  BLAZE_INTERNAL_ASSERT( ( M - ( M % 2UL ) ) == ipos, "Invalid end calculation" );
848 
849  for( size_t j=0UL; j<N; ++j ) {
850  for( size_t i=0UL; i<ipos; i+=2UL ) {
851  (~A)(i ,j) = x[i ] * y[j];
852  (~A)(i+1UL,j) = x[i+1] * y[j];
853  }
854  if( ipos < M ) {
855  (~A)(ipos,j) = x[ipos] * y[j];
856  }
857  }
858  }
860  //**********************************************************************************************
861 
862  //**Vectorized assignment to column-major dense matrices****************************************
876  template< typename MT // Type of the left-hand side target matrix
877  , typename VT3 // Type of the left-hand side vector operand
878  , typename VT4 > // Type of the right-hand side vector operand
879  static inline typename EnableIf< UseVectorizedKernel<MT,VT3,VT4> >::Type
880  selectAssignKernel( DenseMatrix<MT,true>& A, const VT3& x, const VT4& y )
881  {
882  typedef IntrinsicTrait<ElementType> IT;
883 
884  const size_t M( (~A).rows() );
885  const size_t N( (~A).columns() );
886 
887  const bool remainder( !IsPadded<MT>::value || !IsPadded<VT3>::value );
888 
889  const size_t ipos( remainder ? ( M & size_t(-IT::size) ) : M );
890  BLAZE_INTERNAL_ASSERT( !remainder || ( M - ( M % IT::size ) ) == ipos, "Invalid end calculation" );
891 
892  for( size_t j=0UL; j<N; ++j )
893  {
894  const IntrinsicType y1( set( y[j] ) );
895 
896  size_t i( 0UL );
897 
898  for( ; i<ipos; i+=IT::size ) {
899  (~A).store( i, j, x.load(i) * y1 );
900  }
901  for( ; remainder && i<M; ++i ) {
902  (~A)(i,j) = x[i] * y[j];
903  }
904  }
905  }
907  //**********************************************************************************************
908 
909  //**Assignment to sparse matrices***************************************************************
921  template< typename MT // Type of the target sparse matrix
922  , bool SO > // Storage order of the target sparse matrix
923  friend inline void assign( SparseMatrix<MT,SO>& lhs, const DVecTDVecMultExpr& rhs )
924  {
926 
927  typedef typename SelectType< SO, OppositeType, ResultType >::Type TmpType;
928 
935 
936  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
937  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
938 
939  const TmpType tmp( serial( rhs ) );
940  assign( ~lhs, tmp );
941  }
943  //**********************************************************************************************
944 
945  //**Addition assignment to row-major dense matrices*********************************************
960  template< typename MT > // Type of the target dense matrix
961  friend inline typename EnableIf< UseAssign<MT> >::Type
962  addAssign( DenseMatrix<MT,false>& lhs, const DVecTDVecMultExpr& rhs )
963  {
965 
966  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
967  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
968 
969  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
970  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
971 
972  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
973  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
974  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
975  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
976 
977  DVecTDVecMultExpr::selectAddAssignKernel( ~lhs, x, y );
978  }
980  //**********************************************************************************************
981 
982  //**Default addition assignment to row-major dense matrices*************************************
996  template< typename MT // Type of the left-hand side target matrix
997  , typename VT3 // Type of the left-hand side vector operand
998  , typename VT4 > // Type of the right-hand side vector operand
999  static inline typename EnableIf< UseDefaultKernel<MT,VT3,VT4> >::Type
1000  selectAddAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
1001  {
1002  const size_t M( (~A).rows() );
1003  const size_t N( (~A).columns() );
1004 
1005  const size_t jpos( N & size_t(-2) );
1006  BLAZE_INTERNAL_ASSERT( ( N - ( N % 2UL ) ) == jpos, "Invalid end calculation" );
1007 
1008  for( size_t i=0UL; i<M; ++i ) {
1009  for( size_t j=0UL; j<jpos; j+=2UL ) {
1010  (~A)(i,j ) += x[i] * y[j ];
1011  (~A)(i,j+1UL) += x[i] * y[j+1UL];
1012  }
1013  if( jpos < N ) {
1014  (~A)(i,jpos) += x[i] * y[jpos];
1015  }
1016  }
1017  }
1019  //**********************************************************************************************
1020 
1021  //**Vectorized addition assignment to row-major dense matrices**********************************
1035  template< typename MT // Type of the left-hand side target matrix
1036  , typename VT3 // Type of the left-hand side vector operand
1037  , typename VT4 > // Type of the right-hand side vector operand
1038  static inline typename EnableIf< UseVectorizedKernel<MT,VT3,VT4> >::Type
1039  selectAddAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
1040  {
1041  typedef IntrinsicTrait<ElementType> IT;
1042 
1043  const size_t M( (~A).rows() );
1044  const size_t N( (~A).columns() );
1045 
1046  const bool remainder( !IsPadded<MT>::value || !IsPadded<VT4>::value );
1047 
1048  const size_t jpos( remainder ? ( N & size_t(-IT::size) ) : N );
1049  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % IT::size ) ) == jpos, "Invalid end calculation" );
1050 
1051  for( size_t i=0UL; i<M; ++i )
1052  {
1053  const IntrinsicType x1( set( x[i] ) );
1054 
1055  size_t j( 0UL );
1056 
1057  for( ; j<jpos; j+=IT::size ) {
1058  (~A).store( i, j, (~A).load(i,j) + x1 * y.load(j) );
1059  }
1060  for( ; remainder && j<N; ++j ) {
1061  (~A)(i,j) += x[i] * y[j];
1062  }
1063  }
1064  }
1066  //**********************************************************************************************
1067 
1068  //**Addition assignment to column-major dense matrices******************************************
1081  template< typename MT > // Type of the target dense matrix
1082  friend inline void addAssign( DenseMatrix<MT,true>& lhs, const DVecTDVecMultExpr& rhs )
1083  {
1085 
1087 
1088  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1089  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1090 
1091  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
1092  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1093 
1094  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1095  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1096  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1097  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1098 
1099  DVecTDVecMultExpr::selectAddAssignKernel( ~lhs, x, y );
1100  }
1102  //**********************************************************************************************
1103 
1104  //**Default addition assignment to column dense matrices****************************************
1118  template< typename MT // Type of the left-hand side target matrix
1119  , typename VT3 // Type of the left-hand side vector operand
1120  , typename VT4 > // Type of the right-hand side vector operand
1121  static inline typename EnableIf< UseDefaultKernel<MT,VT3,VT4> >::Type
1122  selectAddAssignKernel( DenseMatrix<MT,true>& A, const VT3& x, const VT4& y )
1123  {
1124  const size_t M( (~A).rows() );
1125  const size_t N( (~A).columns() );
1126 
1127  const size_t ipos( M & size_t(-2) );
1128  BLAZE_INTERNAL_ASSERT( ( M - ( M % 2UL ) ) == ipos, "Invalid end calculation" );
1129 
1130  for( size_t j=0UL; j<N; ++j ) {
1131  for( size_t i=0UL; i<ipos; i+=2UL ) {
1132  (~A)(i ,j) += x[i ] * y[j];
1133  (~A)(i+1UL,j) += x[i+1UL] * y[j];
1134  }
1135  if( ipos < M ) {
1136  (~A)(ipos,j) += x[ipos] * y[j];
1137  }
1138  }
1139  }
1141  //**********************************************************************************************
1142 
1143  //**Vectorized addition assignment to column-major dense matrices*******************************
1157  template< typename MT // Type of the left-hand side target matrix
1158  , typename VT3 // Type of the left-hand side vector operand
1159  , typename VT4 > // Type of the right-hand side vector operand
1160  static inline typename EnableIf< UseVectorizedKernel<MT,VT3,VT4> >::Type
1161  selectAddAssignKernel( DenseMatrix<MT,true>& A, const VT3& x, const VT4& y )
1162  {
1163  typedef IntrinsicTrait<ElementType> IT;
1164 
1165  const size_t M( (~A).rows() );
1166  const size_t N( (~A).columns() );
1167 
1168  const bool remainder( !IsPadded<MT>::value || !IsPadded<VT3>::value );
1169 
1170  const size_t ipos( remainder ? ( M & size_t(-IT::size) ) : M );
1171  BLAZE_INTERNAL_ASSERT( !remainder || ( M - ( M % IT::size ) ) == ipos, "Invalid end calculation" );
1172 
1173  for( size_t j=0UL; j<N; ++j )
1174  {
1175  const IntrinsicType y1( set( y[j] ) );
1176 
1177  size_t i( 0UL );
1178 
1179  for( ; i<ipos; i+=IT::size ) {
1180  (~A).store( i, j, (~A).load(i,j) + x.load(i) * y1 );
1181  }
1182  for( ; remainder && i<M; ++i ) {
1183  (~A)(i,j) += x[i] * y[j];
1184  }
1185  }
1186  }
1188  //**********************************************************************************************
1189 
1190  //**Addition assignment to sparse matrices******************************************************
1191  // No special implementation for the addition assignment to sparse matrices.
1192  //**********************************************************************************************
1193 
1194  //**Subtraction assignment to row-major dense matrices******************************************
1209  template< typename MT > // Type of the target dense matrix
1210  friend inline typename EnableIf< UseAssign<MT> >::Type
1211  subAssign( DenseMatrix<MT,false>& lhs, const DVecTDVecMultExpr& rhs )
1212  {
1214 
1215  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1216  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1217 
1218  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
1219  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1220 
1221  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1222  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1223  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1224  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1225 
1226  DVecTDVecMultExpr::selectSubAssignKernel( ~lhs, x, y );
1227  }
1229  //**********************************************************************************************
1230 
1231  //**Default subtraction assignment to row-major dense matrices**********************************
1245  template< typename MT // Type of the left-hand side target matrix
1246  , typename VT3 // Type of the left-hand side vector operand
1247  , typename VT4 > // Type of the right-hand side vector operand
1248  static inline typename EnableIf< UseDefaultKernel<MT,VT3,VT4> >::Type
1249  selectSubAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
1250  {
1251  const size_t M( (~A).rows() );
1252  const size_t N( (~A).columns() );
1253 
1254  const size_t jpos( N & size_t(-2) );
1255  BLAZE_INTERNAL_ASSERT( ( N - ( N % 2UL ) ) == jpos, "Invalid end calculation" );
1256 
1257  for( size_t i=0UL; i<M; ++i ) {
1258  for( size_t j=0UL; j<jpos; j+=2UL ) {
1259  (~A)(i,j ) -= x[i] * y[j ];
1260  (~A)(i,j+1UL) -= x[i] * y[j+1UL];
1261  }
1262  if( jpos < N ) {
1263  (~A)(i,jpos) -= x[i] * y[jpos];
1264  }
1265  }
1266  }
1268  //**********************************************************************************************
1269 
1270  //**Vectorized subtraction assignment to row-major dense matrices*******************************
1284  template< typename MT // Type of the left-hand side target matrix
1285  , typename VT3 // Type of the left-hand side vector operand
1286  , typename VT4 > // Type of the right-hand side vector operand
1287  static inline typename EnableIf< UseVectorizedKernel<MT,VT3,VT4> >::Type
1288  selectSubAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
1289  {
1290  typedef IntrinsicTrait<ElementType> IT;
1291 
1292  const size_t M( (~A).rows() );
1293  const size_t N( (~A).columns() );
1294 
1295  const bool remainder( !IsPadded<MT>::value || !IsPadded<VT4>::value );
1296 
1297  const size_t jpos( remainder ? ( N & size_t(-IT::size) ) : N );
1298  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % IT::size ) ) == jpos, "Invalid end calculation" );
1299 
1300  for( size_t i=0UL; i<M; ++i )
1301  {
1302  const IntrinsicType x1( set( x[i] ) );
1303 
1304  size_t j( 0UL );
1305 
1306  for( ; j<jpos; j+=IT::size ) {
1307  (~A).store( i, j, (~A).load(i,j) - x1 * y.load(j) );
1308  }
1309  for( ; remainder && j<N; ++j ) {
1310  (~A)(i,j) -= x[i] * y[j];
1311  }
1312  }
1313  }
1315  //**********************************************************************************************
1316 
1317  //**Subtraction assignment to column-major dense matrices***************************************
1330  template< typename MT > // Type of the target dense matrix
1331  friend inline void subAssign( DenseMatrix<MT,true>& lhs, const DVecTDVecMultExpr& rhs )
1332  {
1334 
1336 
1337  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1338  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1339 
1340  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
1341  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1342 
1343  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1344  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1345  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1346  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1347 
1348  DVecTDVecMultExpr::selectSubAssignKernel( ~lhs, x, y );
1349  }
1351  //**********************************************************************************************
1352 
1353  //**Default subtraction assignment to column dense matrices*************************************
1367  template< typename MT // Type of the left-hand side target matrix
1368  , typename VT3 // Type of the left-hand side vector operand
1369  , typename VT4 > // Type of the right-hand side vector operand
1370  static inline typename EnableIf< UseDefaultKernel<MT,VT3,VT4> >::Type
1371  selectSubAssignKernel( DenseMatrix<MT,true>& A, const VT3& x, const VT4& y )
1372  {
1373  const size_t M( (~A).rows() );
1374  const size_t N( (~A).columns() );
1375 
1376  const size_t ipos( M & size_t(-2) );
1377  BLAZE_INTERNAL_ASSERT( ( M - ( M % 2UL ) ) == ipos, "Invalid end calculation" );
1378 
1379  for( size_t j=0UL; j<N; ++j ) {
1380  for( size_t i=0UL; i<ipos; i+=2UL ) {
1381  (~A)(i ,j) -= x[i ] * y[j];
1382  (~A)(i+1UL,j) -= x[i+1UL] * y[j];
1383  }
1384  if( ipos < M ) {
1385  (~A)(ipos,j) -= x[ipos] * y[j];
1386  }
1387  }
1388  }
1390  //**********************************************************************************************
1391 
1392  //**Vectorized subtraction assignment to column-major dense matrices****************************
1406  template< typename MT // Type of the left-hand side target matrix
1407  , typename VT3 // Type of the left-hand side vector operand
1408  , typename VT4 > // Type of the right-hand side vector operand
1409  static inline typename EnableIf< UseVectorizedKernel<MT,VT3,VT4> >::Type
1410  selectSubAssignKernel( DenseMatrix<MT,true>& A, const VT3& x, const VT4& y )
1411  {
1412  typedef IntrinsicTrait<ElementType> IT;
1413 
1414  const size_t M( (~A).rows() );
1415  const size_t N( (~A).columns() );
1416 
1417  const bool remainder( !IsPadded<MT>::value || !IsPadded<VT3>::value );
1418 
1419  const size_t ipos( remainder ? ( M & size_t(-IT::size) ) : M );
1420  BLAZE_INTERNAL_ASSERT( !remainder || ( M - ( M % IT::size ) ) == ipos, "Invalid end calculation" );
1421 
1422  for( size_t j=0UL; j<N; ++j )
1423  {
1424  const IntrinsicType y1( set( y[j] ) );
1425 
1426  size_t i( 0UL );
1427 
1428  for( ; i<ipos; i+=IT::size ) {
1429  (~A).store( i, j, (~A).load(i,j) - x.load(i) * y1 );
1430  }
1431  for( ; remainder && i<M; ++i ) {
1432  (~A)(i,j) -= x[i] * y[j];
1433  }
1434  }
1435  }
1437  //**********************************************************************************************
1438 
1439  //**Subtraction assignment to sparse matrices***************************************************
1440  // No special implementation for the subtraction assignment to sparse matrices.
1441  //**********************************************************************************************
1442 
1443  //**Multiplication assignment to dense matrices*************************************************
1444  // No special implementation for the multiplication assignment to dense matrices.
1445  //**********************************************************************************************
1446 
1447  //**Multiplication assignment to sparse matrices************************************************
1448  // No special implementation for the multiplication assignment to sparse matrices.
1449  //**********************************************************************************************
1450 
1451  //**SMP assignment to dense matrices************************************************************
1465  template< typename MT // Type of the target dense matrix
1466  , bool SO > // Storage order of the target dense matrix
1467  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
1468  smpAssign( DenseMatrix<MT,SO>& lhs, const DVecTDVecMultExpr& rhs )
1469  {
1471 
1472  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1473  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1474 
1475  LT x( rhs.lhs_ ); // Evaluation of the left-hand side dense vector operand
1476  RT y( rhs.rhs_ ); // Evaluation of the right-hand side dense vector operand
1477 
1478  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1479  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1480  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1481  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1482 
1483  smpAssign( ~lhs, x * y );
1484  }
1486  //**********************************************************************************************
1487 
1488  //**SMP assignment to sparse matrices***********************************************************
1502  template< typename MT // Type of the target sparse matrix
1503  , bool SO > // Storage order of the target sparse matrix
1504  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
1505  smpAssign( SparseMatrix<MT,SO>& lhs, const DVecTDVecMultExpr& rhs )
1506  {
1508 
1509  typedef typename SelectType< SO, OppositeType, ResultType >::Type TmpType;
1510 
1517 
1518  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1519  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1520 
1521  const TmpType tmp( rhs );
1522  smpAssign( ~lhs, tmp );
1523  }
1525  //**********************************************************************************************
1526 
1527  //**SMP addition assignment to dense matrices***************************************************
1541  template< typename MT > // Type of the target dense matrix
1542  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
1543  smpAddAssign( DenseMatrix<MT,false>& lhs, const DVecTDVecMultExpr& rhs )
1544  {
1546 
1547  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1548  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1549 
1550  LT x( rhs.lhs_ ); // Evaluation of the left-hand side dense vector operand
1551  RT y( rhs.rhs_ ); // Evaluation of the right-hand side dense vector operand
1552 
1553  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1554  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1555  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1556  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1557 
1558  smpAddAssign( ~lhs, x * y );
1559  }
1561  //**********************************************************************************************
1562 
1563  //**SMP addition assignment to sparse matrices**************************************************
1564  // No special implementation for the SMP addition assignment to sparse matrices.
1565  //**********************************************************************************************
1566 
1567  //**SMP subtraction assignment to dense matrices************************************************
1582  template< typename MT > // Type of the target dense matrix
1583  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
1584  smpSubAssign( DenseMatrix<MT,false>& lhs, const DVecTDVecMultExpr& rhs )
1585  {
1587 
1588  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1589  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1590 
1591  LT x( rhs.lhs_ ); // Evaluation of the left-hand side dense vector operand
1592  RT y( rhs.rhs_ ); // Evaluation of the right-hand side dense vector operand
1593 
1594  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1595  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1596  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1597  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1598 
1599  smpSubAssign( ~lhs, x * y );
1600  }
1602  //**********************************************************************************************
1603 
1604  //**SMP subtraction assignment to sparse matrices***********************************************
1605  // No special implementation for the SMP subtraction assignment to sparse matrices.
1606  //**********************************************************************************************
1607 
1608  //**SMP multiplication assignment to dense matrices*********************************************
1609  // No special implementation for the SMP multiplication assignment to dense matrices.
1610  //**********************************************************************************************
1611 
1612  //**SMP multiplication assignment to sparse matrices********************************************
1613  // No special implementation for the SMP multiplication assignment to sparse matrices.
1614  //**********************************************************************************************
1615 
1616  //**Compile time checks*************************************************************************
1624  //**********************************************************************************************
1625 };
1626 //*************************************************************************************************
1627 
1628 
1629 
1630 
1631 //=================================================================================================
1632 //
1633 // GLOBAL BINARY ARITHMETIC OPERATORS
1634 //
1635 //=================================================================================================
1636 
1637 //*************************************************************************************************
1664 template< typename T1 // Type of the left-hand side dense vector
1665  , typename T2 > // Type of the right-hand side dense vector
1666 inline const DVecTDVecMultExpr<T1,T2>
1668 {
1670 
1671  return DVecTDVecMultExpr<T1,T2>( ~lhs, ~rhs );
1672 }
1673 //*************************************************************************************************
1674 
1675 
1676 
1677 
1678 //=================================================================================================
1679 //
1680 // ROWS SPECIALIZATIONS
1681 //
1682 //=================================================================================================
1683 
1684 //*************************************************************************************************
1686 template< typename VT1, typename VT2 >
1687 struct Rows< DVecTDVecMultExpr<VT1,VT2> > : public Size<VT1>
1688 {};
1690 //*************************************************************************************************
1691 
1692 
1693 
1694 
1695 //=================================================================================================
1696 //
1697 // COLUMNS SPECIALIZATIONS
1698 //
1699 //=================================================================================================
1700 
1701 //*************************************************************************************************
1703 template< typename VT1, typename VT2 >
1704 struct Columns< DVecTDVecMultExpr<VT1,VT2> > : public Size<VT2>
1705 {};
1707 //*************************************************************************************************
1708 
1709 
1710 
1711 
1712 //=================================================================================================
1713 //
1714 // ISALIGNED SPECIALIZATIONS
1715 //
1716 //=================================================================================================
1717 
1718 //*************************************************************************************************
1720 template< typename VT1, typename VT2 >
1721 struct IsAligned< DVecTDVecMultExpr<VT1,VT2> >
1722  : public IsTrue< And< IsAligned<VT1>, IsAligned<VT2> >::value >
1723 {};
1725 //*************************************************************************************************
1726 
1727 
1728 
1729 
1730 //=================================================================================================
1731 //
1732 // ISPADDED SPECIALIZATIONS
1733 //
1734 //=================================================================================================
1735 
1736 //*************************************************************************************************
1738 template< typename VT1, typename VT2 >
1739 struct IsPadded< DVecTDVecMultExpr<VT1,VT2> > : public IsTrue< IsPadded<VT2>::value >
1740 {};
1742 //*************************************************************************************************
1743 
1744 
1745 
1746 
1747 //=================================================================================================
1748 //
1749 // EXPRESSION TRAIT SPECIALIZATIONS
1750 //
1751 //=================================================================================================
1752 
1753 //*************************************************************************************************
1755 template< typename VT1, typename VT2, bool AF >
1756 struct SubmatrixExprTrait< DVecTDVecMultExpr<VT1,VT2>, AF >
1757 {
1758  public:
1759  //**********************************************************************************************
1760  typedef typename MultExprTrait< typename SubvectorExprTrait<const VT1,AF>::Type
1761  , typename SubvectorExprTrait<const VT2,AF>::Type >::Type Type;
1762  //**********************************************************************************************
1763 };
1765 //*************************************************************************************************
1766 
1767 
1768 //*************************************************************************************************
1770 template< typename VT1, typename VT2 >
1771 struct RowExprTrait< DVecTDVecMultExpr<VT1,VT2> >
1772 {
1773  public:
1774  //**********************************************************************************************
1775  typedef typename MultExprTrait< typename VT1::ReturnType, VT2 >::Type Type;
1776  //**********************************************************************************************
1777 };
1779 //*************************************************************************************************
1780 
1781 
1782 //*************************************************************************************************
1784 template< typename VT1, typename VT2 >
1785 struct ColumnExprTrait< DVecTDVecMultExpr<VT1,VT2> >
1786 {
1787  public:
1788  //**********************************************************************************************
1789  typedef typename MultExprTrait< VT1, typename VT2::ReturnType >::Type Type;
1790  //**********************************************************************************************
1791 };
1793 //*************************************************************************************************
1794 
1795 } // namespace blaze
1796 
1797 #endif
Pointer difference type of the Blaze library.
RT1::ElementType ET1
Element type of the left-hand side dense vector expression.
Definition: DVecTDVecMultExpr.h:113
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, simd_int16_t >::Type set(T value)
Sets all values in the vector to the given 2-byte integral value.
Definition: Set.h:73
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:89
DVecTDVecMultExpr< VT1, VT2 > This
Type of this DVecTDVecMultExpr instance.
Definition: DVecTDVecMultExpr.h:206
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecTDVecMultExpr.h:243
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:7820
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecTDVecMultExpr.h:311
#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:79
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecTDVecMultExpr.h:289
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: DVecTDVecMultExpr.h:570
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecTDVecMultExpr.h:465
#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:79
Header file for the ColumnExprTrait class template.
MultTrait< RT1, RT2 >::Type ResultType
Result type for expression template evaluations.
Definition: DVecTDVecMultExpr.h:207
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DVecTDVecMultExpr.h:623
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecTDVecMultExpr.h:429
ElementType * PointerType
Pointer return type.
Definition: DVecTDVecMultExpr.h:241
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:259
DVecTDVecMultExpr(const VT1 &lhs, const VT2 &rhs)
Constructor for the DVecTDVecMultExpr class.
Definition: DVecTDVecMultExpr.h:494
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecTDVecMultExpr.h:472
VT2::ConstIterator RightIteratorType
ConstIterator type of the right-hand side dense matrix expression.
Definition: DVecTDVecMultExpr.h:256
Expression object for outer products between two dense vectors.The DVecTDVecMultExpr class represents...
Definition: DVecTDVecMultExpr.h:105
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
Header file for the Computation base class.
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecTDVecMultExpr.h:418
Type relationship analysis.This class tests if the two data types A and B are equal. For this type comparison, the cv-qualifiers of both data types are ignored. If A and B are the same data type (ignoring the cv-qualifiers), then the value member enumeration is set to 1, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to 0, Type is FalseType, and the class derives from FalseType.
Definition: IsSame.h:158
Constraints on the storage order of matrix types.
Header file for the RequiresEvaluation type trait.
System settings for performance optimizations.
SelectType< evaluateLeft, const RT1, CT1 >::Type LT
Type for the assignment of the left-hand side dense vector operand.
Definition: DVecTDVecMultExpr.h:226
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.
VT1::ConstIterator LeftIteratorType
ConstIterator type of the left-hand side dense matrix expression.
Definition: DVecTDVecMultExpr.h:253
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecTDVecMultExpr.h:385
Constraint on the transpose flag of vector types.
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DVecTDVecMultExpr.h:635
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:90
ValueType value_type
Type of the underlying elements.
Definition: DVecTDVecMultExpr.h:247
VT1::CompositeType CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecTDVecMultExpr.h:117
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the IsTemporary type trait class.
Header file for the multiplication trait.
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecTDVecMultExpr.h:441
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
VT2::ReturnType RN2
Return type of the right-hand side dense vector expression.
Definition: DVecTDVecMultExpr.h:116
#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:79
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecTDVecMultExpr.h:321
SelectType< useAssign, const ResultType, const DVecTDVecMultExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: DVecTDVecMultExpr.h:217
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_VECTVECMULTEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid vector/vector ...
Definition: VecTVecMultExpr.h:161
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecTDVecMultExpr.h:363
LeftOperand leftOperand() const
Returns the left-hand side dense vector operand.
Definition: DVecTDVecMultExpr.h:601
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
Header file for the Columns type trait.
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DVecTDVecMultExpr.h:208
IntrinsicTrait< ElementType >::Type IntrinsicType
Resulting intrinsic element type.
Definition: DVecTDVecMultExpr.h:211
size_t rows() const
Returns the current number of rows of the matrix.
Definition: DVecTDVecMultExpr.h:581
ReferenceType reference
Reference return type.
Definition: DVecTDVecMultExpr.h:249
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DVecTDVecMultExpr.h:265
Header file for the IsAligned type trait.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecTDVecMultExpr.h:374
bool isAligned() const
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecTDVecMultExpr.h:645
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: DVecTDVecMultExpr.h:214
SelectType< IsExpression< VT2 >::value, const VT2, const VT2 & >::Type RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecTDVecMultExpr.h:223
#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:78
DifferenceType difference_type
Difference between two iterators.
Definition: DVecTDVecMultExpr.h:250
Constraints on the storage order of matrix types.
Constraint on the data type.
SelectType< evaluateRight, const RT2, CT2 >::Type RT
Type for the assignment of the right-hand side dense vector operand.
Definition: DVecTDVecMultExpr.h:229
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecTDVecMultExpr.h:453
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
VT1::ReturnType RN1
Return type of the left-hand side dense vector expression.
Definition: DVecTDVecMultExpr.h:115
Header file for the SelectType class template.
Header file for the RowExprTrait class template.
Header file for all forward declarations for expression class templates.
Header file for the VecTVecMultExpr base class.
VT2::ResultType RT2
Result type of the right-hand side dense vector expression.
Definition: DVecTDVecMultExpr.h:112
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecTDVecMultExpr.h:300
Header file for the serial shim.
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecTDVecMultExpr.h:239
IteratorCategory iterator_category
The iterator category.
Definition: DVecTDVecMultExpr.h:246
VT1::ResultType RT1
Result type of the left-hand side dense vector expression.
Definition: DVecTDVecMultExpr.h:111
EnableIf< IsDenseMatrix< MT1 > >::Type 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
LeftOperand lhs_
Left-hand side dense vector of the multiplication expression.
Definition: DVecTDVecMultExpr.h:662
#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:116
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:79
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:1232
Header file for run time assertion macros.
EnableIf< IsDenseMatrix< MT1 > >::Type 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
Base template for the MultTrait class.
Definition: MultTrait.h:138
RightOperand rightOperand() const
Returns the right-hand side dense vector operand.
Definition: DVecTDVecMultExpr.h:611
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
const bool useOptimizedKernels
Configuration switch for optimized kernels.This configuration switch enables/disables all optimized c...
Definition: Optimizations.h:84
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: DVecTDVecMultExpr.h:558
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DVecTDVecMultExpr.h:473
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DVecTDVecMultExpr.h:209
RT2::ElementType ET2
Element type of the right-hand side dense vector expression.
Definition: DVecTDVecMultExpr.h:114
RightOperand rhs_
Right-hand side dense vector of the multiplication expression.
Definition: DVecTDVecMultExpr.h:663
IntrinsicType load() const
Access to the intrinsic elements of the matrix.
Definition: DVecTDVecMultExpr.h:352
VT2::CompositeType CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecTDVecMultExpr.h:118
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: DVecTDVecMultExpr.h:655
Constraint on the data type.
Constraints on the storage order of matrix types.
ElementType & ReferenceType
Reference return type.
Definition: DVecTDVecMultExpr.h:242
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DVecTDVecMultExpr.h:507
Constraint on the data type.
Header file for the IsReference type trait.
Base class for all outer product expression templates.The VecTVecMultExpr class serves as a tag for a...
Definition: VecTVecMultExpr.h:66
#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:122
Header file for all intrinsic functionality.
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecTDVecMultExpr.h:277
ResultType::ElementType ElementType
Resulting element type.
Definition: DVecTDVecMultExpr.h:210
#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:79
size_t columns() const
Returns the current number of columns of the matrix.
Definition: DVecTDVecMultExpr.h:591
ElementType ValueType
Type of the underlying elements.
Definition: DVecTDVecMultExpr.h:240
Header file for the IsComputation type trait class.
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecTDVecMultExpr.h:342
Iterator over the elements of the dense matrix.
Definition: DVecTDVecMultExpr.h:235
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:59
EnableIf< IsDenseMatrix< MT1 > >::Type 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
#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
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
Header file for the IsTrue value trait.
PointerType pointer
Pointer return type.
Definition: DVecTDVecMultExpr.h:248
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a row dense or sparse vector type (i...
Definition: RowVector.h:79
Header file for the SubvectorExprTrait class template.
MultExprTrait< RN1, RN2 >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: DVecTDVecMultExpr.h:141
Header file for exception macros.
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecTDVecMultExpr.h:407
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t i, size_t j) const
Access to the intrinsic elements of the matrix.
Definition: DVecTDVecMultExpr.h:541
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecTDVecMultExpr.h:332
System settings for the inline keywords.
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DVecTDVecMultExpr.h:523
Header file for the Size type trait.
Evaluation of the resulting expression type of a multiplication.Via this type trait it is possible to...
Definition: MultExprTrait.h:137
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecTDVecMultExpr.h:396
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
SelectType< IsExpression< VT1 >::value, const VT1, const VT1 & >::Type LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecTDVecMultExpr.h:220
Constraint on the transpose flag of vector types.
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.