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 
53 #include <blaze/math/Intrinsics.h>
67 #include <blaze/system/Inline.h>
69 #include <blaze/util/Assert.h>
71 #include <blaze/util/EnableIf.h>
73 #include <blaze/util/SelectType.h>
74 #include <blaze/util/Types.h>
76 
77 
78 namespace blaze {
79 
80 //=================================================================================================
81 //
82 // CLASS DVECTDVECMULTEXPR
83 //
84 //=================================================================================================
85 
86 //*************************************************************************************************
93 template< typename VT1 // Type of the left-hand side dense vector
94  , typename VT2 > // Type of the right-hand side dense vector
95 class DVecTDVecMultExpr : public DenseMatrix< DVecTDVecMultExpr<VT1,VT2>, false >
96  , private VecTVecMultExpr
97  , private Computation
98 {
99  private:
100  //**Type definitions****************************************************************************
101  typedef typename VT1::ResultType RT1;
102  typedef typename VT2::ResultType RT2;
103  typedef typename RT1::ElementType ET1;
104  typedef typename RT2::ElementType ET2;
105  typedef typename VT1::ReturnType RN1;
106  typedef typename VT2::ReturnType RN2;
107  typedef typename VT1::CompositeType CT1;
108  typedef typename VT2::CompositeType CT2;
109  //**********************************************************************************************
110 
111  //**********************************************************************************************
114  //**********************************************************************************************
115 
116  //**********************************************************************************************
118  enum { evaluateRight = IsComputation<VT2>::value || RequiresEvaluation<VT2>::value };
119  //**********************************************************************************************
120 
121  //**Return type evaluation**********************************************************************
123 
128  enum { returnExpr = !IsTemporary<RN1>::value && !IsTemporary<RN2>::value };
129 
132  //**********************************************************************************************
133 
134  //**Serial evaluation strategy******************************************************************
136 
142  enum { useAssign = ( evaluateLeft || evaluateRight ) };
143 
145  template< typename VT >
147  struct UseAssign {
148  enum { value = useAssign };
149  };
151  //**********************************************************************************************
152 
153  //**Parallel evaluation strategy****************************************************************
155 
159  template< typename VT >
160  struct UseSMPAssign {
161  enum { value = evaluateRight };
162  };
164  //**********************************************************************************************
165 
166  //**********************************************************************************************
168 
171  template< typename T1, typename T2, typename T3 >
172  struct UseVectorizedKernel {
173  enum { value = T1::vectorizable && T2::vectorizable && T3::vectorizable &&
177  };
179  //**********************************************************************************************
180 
181  //**********************************************************************************************
183 
186  template< typename T1, typename T2, typename T3 >
187  struct UseDefaultKernel {
188  enum { value = !UseVectorizedKernel<T1,T2,T3>::value };
189  };
191  //**********************************************************************************************
192 
193  public:
194  //**Type definitions****************************************************************************
201 
204 
207 
209  typedef typename SelectType< IsExpression<VT1>::value, const VT1, const VT1& >::Type LeftOperand;
210 
212  typedef typename SelectType< IsExpression<VT2>::value, const VT2, const VT2& >::Type RightOperand;
213 
216 
219  //**********************************************************************************************
220 
221  //**ConstIterator class definition**************************************************************
225  {
226  public:
227  //**Type definitions*************************************************************************
228  typedef std::random_access_iterator_tag IteratorCategory;
229  typedef ElementType ValueType;
230  typedef ElementType* PointerType;
231  typedef ElementType& ReferenceType;
233 
234  // STL iterator requirements
235  typedef IteratorCategory iterator_category;
236  typedef ValueType value_type;
237  typedef PointerType pointer;
238  typedef ReferenceType reference;
239  typedef DifferenceType difference_type;
240 
243 
246  //*******************************************************************************************
247 
248  //**Constructor******************************************************************************
254  explicit inline ConstIterator( LeftIteratorType left, RightIteratorType right )
255  : left_ ( left ) // Iterator to the current left-hand side element
256  , right_( right ) // Iterator to the current right-hand side element
257  {}
258  //*******************************************************************************************
259 
260  //**Addition assignment operator*************************************************************
266  inline ConstIterator& operator+=( size_t inc ) {
267  right_ += inc;
268  return *this;
269  }
270  //*******************************************************************************************
271 
272  //**Subtraction assignment operator**********************************************************
278  inline ConstIterator& operator-=( size_t dec ) {
279  right_ -= dec;
280  return *this;
281  }
282  //*******************************************************************************************
283 
284  //**Prefix increment operator****************************************************************
290  ++right_;
291  return *this;
292  }
293  //*******************************************************************************************
294 
295  //**Postfix increment operator***************************************************************
300  inline const ConstIterator operator++( int ) {
301  return ConstIterator( left_, right_++ );
302  }
303  //*******************************************************************************************
304 
305  //**Prefix decrement operator****************************************************************
311  --right_;
312  return *this;
313  }
314  //*******************************************************************************************
315 
316  //**Postfix decrement operator***************************************************************
321  inline const ConstIterator operator--( int ) {
322  return ConstIterator( left_, right_-- );
323  }
324  //*******************************************************************************************
325 
326  //**Element access operator******************************************************************
331  inline ReturnType operator*() const {
332  return (*left_) * (*right_);
333  }
334  //*******************************************************************************************
335 
336  //**Load function****************************************************************************
341  inline IntrinsicType load() const {
342  return set( *left_ ) * right_.load();
343  }
344  //*******************************************************************************************
345 
346  //**Equality operator************************************************************************
352  inline bool operator==( const ConstIterator& rhs ) const {
353  return right_ == rhs.right_;
354  }
355  //*******************************************************************************************
356 
357  //**Inequality operator**********************************************************************
363  inline bool operator!=( const ConstIterator& rhs ) const {
364  return right_ != rhs.right_;
365  }
366  //*******************************************************************************************
367 
368  //**Less-than operator***********************************************************************
374  inline bool operator<( const ConstIterator& rhs ) const {
375  return right_ < rhs.right_;
376  }
377  //*******************************************************************************************
378 
379  //**Greater-than operator********************************************************************
385  inline bool operator>( const ConstIterator& rhs ) const {
386  return right_ > rhs.right_;
387  }
388  //*******************************************************************************************
389 
390  //**Less-or-equal-than operator**************************************************************
396  inline bool operator<=( const ConstIterator& rhs ) const {
397  return right_ <= rhs.right_;
398  }
399  //*******************************************************************************************
400 
401  //**Greater-or-equal-than operator***********************************************************
407  inline bool operator>=( const ConstIterator& rhs ) const {
408  return right_ >= rhs.right_;
409  }
410  //*******************************************************************************************
411 
412  //**Subtraction operator*********************************************************************
418  inline DifferenceType operator-( const ConstIterator& rhs ) const {
419  return right_ - rhs.right_;
420  }
421  //*******************************************************************************************
422 
423  //**Addition operator************************************************************************
430  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
431  return ConstIterator( it.left_, it.right_ + inc );
432  }
433  //*******************************************************************************************
434 
435  //**Addition operator************************************************************************
442  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
443  return ConstIterator( it.left_, it.right_ + inc );
444  }
445  //*******************************************************************************************
446 
447  //**Subtraction operator*********************************************************************
454  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
455  return ConstIterator( it.left_, it.right_ - dec );
456  }
457  //*******************************************************************************************
458 
459  private:
460  //**Member variables*************************************************************************
461  LeftIteratorType left_;
462  RightIteratorType right_;
463  //*******************************************************************************************
464  };
465  //**********************************************************************************************
466 
467  //**Compilation flags***************************************************************************
469  enum { vectorizable = VT1::vectorizable && VT2::vectorizable &&
472 
474  enum { smpAssignable = VT1::smpAssignable && !evaluateRight };
475  //**********************************************************************************************
476 
477  //**Constructor*********************************************************************************
483  explicit inline DVecTDVecMultExpr( const VT1& lhs, const VT2& rhs )
484  : lhs_( lhs ) // Left-hand side dense vector of the multiplication expression
485  , rhs_( rhs ) // Right-hand side dense vector of the multiplication expression
486  {}
487  //**********************************************************************************************
488 
489  //**Access operator*****************************************************************************
496  inline ReturnType operator()( size_t i, size_t j ) const {
497  BLAZE_INTERNAL_ASSERT( i < lhs_.size(), "Invalid row access index" );
498  BLAZE_INTERNAL_ASSERT( j < rhs_.size(), "Invalid column access index" );
499 
500  return lhs_[i] * rhs_[j];
501  }
502  //**********************************************************************************************
503 
504  //**Load function*******************************************************************************
511  BLAZE_ALWAYS_INLINE IntrinsicType load( size_t i, size_t j ) const {
512  typedef IntrinsicTrait<ElementType> IT;
513  BLAZE_INTERNAL_ASSERT( i < lhs_.size() , "Invalid row access index" );
514  BLAZE_INTERNAL_ASSERT( j < rhs_.size() , "Invalid column access index" );
515  BLAZE_INTERNAL_ASSERT( j % IT::size == 0UL, "Invalid column access index" );
516  const IntrinsicType xmm1( set( lhs_[i] ) );
517  const IntrinsicType xmm2( rhs_.load( j ) );
518  return xmm1 * xmm2;
519  }
520  //**********************************************************************************************
521 
522  //**Begin function******************************************************************************
528  inline ConstIterator begin( size_t i ) const {
529  BLAZE_INTERNAL_ASSERT( i < lhs_.size(), "Invalid row access index" );
530  return ConstIterator( lhs_.begin()+i, rhs_.begin() );
531  }
532  //**********************************************************************************************
533 
534  //**End function********************************************************************************
540  inline ConstIterator end( size_t i ) const {
541  BLAZE_INTERNAL_ASSERT( i < lhs_.size(), "Invalid row access index" );
542  return ConstIterator( lhs_.begin()+i, rhs_.end() );
543  }
544  //**********************************************************************************************
545 
546  //**Rows function*******************************************************************************
551  inline size_t rows() const {
552  return lhs_.size();
553  }
554  //**********************************************************************************************
555 
556  //**Columns function****************************************************************************
561  inline size_t columns() const {
562  return rhs_.size();
563  }
564  //**********************************************************************************************
565 
566  //**Left operand access*************************************************************************
571  inline LeftOperand leftOperand() const {
572  return lhs_;
573  }
574  //**********************************************************************************************
575 
576  //**Right operand access************************************************************************
581  inline RightOperand rightOperand() const {
582  return rhs_;
583  }
584  //**********************************************************************************************
585 
586  //**********************************************************************************************
592  template< typename T >
593  inline bool canAlias( const T* alias ) const {
594  return ( lhs_.canAlias( alias ) || rhs_.canAlias( alias ) );
595  }
596  //**********************************************************************************************
597 
598  //**********************************************************************************************
604  template< typename T >
605  inline bool isAliased( const T* alias ) const {
606  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
607  }
608  //**********************************************************************************************
609 
610  //**********************************************************************************************
615  inline bool isAligned() const {
616  return lhs_.isAligned() && rhs_.isAligned();
617  }
618  //**********************************************************************************************
619 
620  //**********************************************************************************************
625  inline bool canSMPAssign() const {
626  return ( rows() > SMP_DVECTDVECMULT_THRESHOLD );
627  }
628  //**********************************************************************************************
629 
630  private:
631  //**Member variables****************************************************************************
632  LeftOperand lhs_;
633  RightOperand rhs_;
634  //**********************************************************************************************
635 
636  //**Assignment to row-major dense matrices******************************************************
650  template< typename MT > // Type of the target dense matrix
651  friend inline typename EnableIf< UseAssign<MT> >::Type
653  {
655 
656  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
657  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
658 
659  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
660  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
661 
662  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
663  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
664  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
665  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
666 
667  DVecTDVecMultExpr::selectAssignKernel( ~lhs, x, y );
668  }
670  //**********************************************************************************************
671 
672  //**Default assignment to row-major dense matrices**********************************************
686  template< typename MT // Type of the left-hand side target matrix
687  , typename VT3 // Type of the left-hand side vector operand
688  , typename VT4 > // Type of the right-hand side vector operand
689  static inline typename EnableIf< UseDefaultKernel<MT,VT3,VT4> >::Type
690  selectAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
691  {
692  const size_t m( (~A).rows() );
693  const size_t n( (~A).columns() );
694 
695  const size_t jpos( n & size_t(-2) );
696  BLAZE_INTERNAL_ASSERT( ( n - ( n % 2UL ) ) == jpos, "Invalid end calculation" );
697 
698  for( size_t i=0UL; i<m; ++i ) {
699  for( size_t j=0UL; j<jpos; j+=2UL ) {
700  (~A)(i,j ) = x[i] * y[j ];
701  (~A)(i,j+1UL) = x[i] * y[j+1];
702  }
703  if( jpos < n ) {
704  (~A)(i,jpos) = x[i] * y[jpos];
705  }
706  }
707  }
709  //**********************************************************************************************
710 
711  //**Vectorized assignment to row-major dense matrices*******************************************
725  template< typename MT // Type of the left-hand side target matrix
726  , typename VT3 // Type of the left-hand side vector operand
727  , typename VT4 > // Type of the right-hand side vector operand
728  static inline typename EnableIf< UseVectorizedKernel<MT,VT3,VT4> >::Type
729  selectAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
730  {
731  typedef IntrinsicTrait<ElementType> IT;
732 
733  const size_t m( (~A).rows() );
734  const size_t n( (~A).columns() );
735 
736  for( size_t i=0UL; i<m; ++i )
737  {
738  const IntrinsicType x1( set( x[i] ) );
739 
740  for( size_t j=0UL; j<n; j+=IT::size ) {
741  (~A).store( i, j, x1 * y.load(j) );
742  }
743  }
744  }
746  //**********************************************************************************************
747 
748  //**Assignment to column-major dense matrices***************************************************
760  template< typename MT > // Type of the target dense matrix
761  friend inline void assign( DenseMatrix<MT,true>& lhs, const DVecTDVecMultExpr& rhs )
762  {
764 
766 
767  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
768  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
769 
770  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
771  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
772 
773  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
774  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
775  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
776  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
777 
778  DVecTDVecMultExpr::selectAssignKernel( ~lhs, x, y );
779  }
781  //**********************************************************************************************
782 
783  //**Default assignment to column-major dense matrices*******************************************
797  template< typename MT // Type of the left-hand side target matrix
798  , typename VT3 // Type of the left-hand side vector operand
799  , typename VT4 > // Type of the right-hand side vector operand
800  static inline typename EnableIf< UseDefaultKernel<MT,VT3,VT4> >::Type
801  selectAssignKernel( DenseMatrix<MT,true>& A, const VT3& x, const VT4& y )
802  {
803  const size_t m( (~A).rows() );
804  const size_t n( (~A).columns() );
805 
806  const size_t ipos( m & size_t(-2) );
807  BLAZE_INTERNAL_ASSERT( ( m - ( m % 2UL ) ) == ipos, "Invalid end calculation" );
808 
809  for( size_t j=0UL; j<n; ++j ) {
810  for( size_t i=0UL; i<ipos; i+=2UL ) {
811  (~A)(i ,j) = x[i ] * y[j];
812  (~A)(i+1UL,j) = x[i+1] * y[j];
813  }
814  if( ipos < m ) {
815  (~A)(ipos,j) = x[ipos] * y[j];
816  }
817  }
818  }
820  //**********************************************************************************************
821 
822  //**Vectorized assignment to column-major dense matrices****************************************
836  template< typename MT // Type of the left-hand side target matrix
837  , typename VT3 // Type of the left-hand side vector operand
838  , typename VT4 > // Type of the right-hand side vector operand
839  static inline typename EnableIf< UseVectorizedKernel<MT,VT3,VT4> >::Type
840  selectAssignKernel( DenseMatrix<MT,true>& A, const VT3& x, const VT4& y )
841  {
842  typedef IntrinsicTrait<ElementType> IT;
843 
844  const size_t m( (~A).rows() );
845  const size_t n( (~A).columns() );
846 
847  for( size_t j=0UL; j<n; ++j )
848  {
849  const IntrinsicType y1( set( y[j] ) );
850 
851  for( size_t i=0UL; i<m; i+=IT::size ) {
852  (~A).store( i, j, x.load(i) * y1 );
853  }
854  }
855  }
857  //**********************************************************************************************
858 
859  //**Assignment to sparse matrices***************************************************************
871  template< typename MT // Type of the target sparse matrix
872  , bool SO > // Storage order of the target sparse matrix
873  friend inline void assign( SparseMatrix<MT,SO>& lhs, const DVecTDVecMultExpr& rhs )
874  {
876 
877  typedef typename SelectType< SO, OppositeType, ResultType >::Type TmpType;
878 
885 
886  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
887  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
888 
889  const TmpType tmp( serial( rhs ) );
890  assign( ~lhs, tmp );
891  }
893  //**********************************************************************************************
894 
895  //**Addition assignment to row-major dense matrices*********************************************
910  template< typename MT > // Type of the target dense matrix
911  friend inline typename EnableIf< UseAssign<MT> >::Type
912  addAssign( DenseMatrix<MT,false>& lhs, const DVecTDVecMultExpr& rhs )
913  {
915 
916  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
917  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
918 
919  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
920  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
921 
922  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
923  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
924  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
925  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
926 
927  DVecTDVecMultExpr::selectAddAssignKernel( ~lhs, x, y );
928  }
930  //**********************************************************************************************
931 
932  //**Default addition assignment to row-major dense matrices*************************************
946  template< typename MT // Type of the left-hand side target matrix
947  , typename VT3 // Type of the left-hand side vector operand
948  , typename VT4 > // Type of the right-hand side vector operand
949  static inline typename EnableIf< UseDefaultKernel<MT,VT3,VT4> >::Type
950  selectAddAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
951  {
952  const size_t m( (~A).rows() );
953  const size_t n( (~A).columns() );
954 
955  const size_t jpos( n & size_t(-2) );
956  BLAZE_INTERNAL_ASSERT( ( n - ( n % 2UL ) ) == jpos, "Invalid end calculation" );
957 
958  for( size_t i=0UL; i<m; ++i ) {
959  for( size_t j=0UL; j<jpos; j+=2UL ) {
960  (~A)(i,j ) += x[i] * y[j ];
961  (~A)(i,j+1UL) += x[i] * y[j+1UL];
962  }
963  if( jpos < n ) {
964  (~A)(i,jpos) += x[i] * y[jpos];
965  }
966  }
967  }
969  //**********************************************************************************************
970 
971  //**Vectorized addition assignment to row-major dense matrices**********************************
985  template< typename MT // Type of the left-hand side target matrix
986  , typename VT3 // Type of the left-hand side vector operand
987  , typename VT4 > // Type of the right-hand side vector operand
988  static inline typename EnableIf< UseVectorizedKernel<MT,VT3,VT4> >::Type
989  selectAddAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
990  {
991  typedef IntrinsicTrait<ElementType> IT;
992 
993  const size_t m( (~A).rows() );
994  const size_t n( (~A).columns() );
995 
996  for( size_t i=0UL; i<m; ++i )
997  {
998  const IntrinsicType x1( set( x[i] ) );
999 
1000  for( size_t j=0UL; j<n; j+=IT::size ) {
1001  (~A).store( i, j, (~A).load(i,j) + x1 * y.load(j) );
1002  }
1003  }
1004  }
1006  //**********************************************************************************************
1007 
1008  //**Addition assignment to column-major dense matrices******************************************
1021  template< typename MT > // Type of the target dense matrix
1022  friend inline void addAssign( DenseMatrix<MT,true>& lhs, const DVecTDVecMultExpr& rhs )
1023  {
1025 
1027 
1028  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1029  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1030 
1031  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
1032  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1033 
1034  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1035  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1036  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1037  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1038 
1039  DVecTDVecMultExpr::selectAddAssignKernel( ~lhs, x, y );
1040  }
1042  //**********************************************************************************************
1043 
1044  //**Default addition assignment to column dense matrices****************************************
1058  template< typename MT // Type of the left-hand side target matrix
1059  , typename VT3 // Type of the left-hand side vector operand
1060  , typename VT4 > // Type of the right-hand side vector operand
1061  static inline typename EnableIf< UseDefaultKernel<MT,VT3,VT4> >::Type
1062  selectAddAssignKernel( DenseMatrix<MT,true>& A, const VT3& x, const VT4& y )
1063  {
1064  const size_t m( (~A).rows() );
1065  const size_t n( (~A).columns() );
1066 
1067  const size_t ipos( m & size_t(-2) );
1068  BLAZE_INTERNAL_ASSERT( ( m - ( m % 2UL ) ) == ipos, "Invalid end calculation" );
1069 
1070  for( size_t j=0UL; j<n; ++j ) {
1071  for( size_t i=0UL; i<ipos; i+=2UL ) {
1072  (~A)(i ,j) += x[i ] * y[j];
1073  (~A)(i+1UL,j) += x[i+1UL] * y[j];
1074  }
1075  if( ipos < m ) {
1076  (~A)(ipos,j) += x[ipos] * y[j];
1077  }
1078  }
1079  }
1081  //**********************************************************************************************
1082 
1083  //**Vectorized addition assignment to column-major dense matrices*******************************
1097  template< typename MT // Type of the left-hand side target matrix
1098  , typename VT3 // Type of the left-hand side vector operand
1099  , typename VT4 > // Type of the right-hand side vector operand
1100  static inline typename EnableIf< UseVectorizedKernel<MT,VT3,VT4> >::Type
1101  selectAddAssignKernel( DenseMatrix<MT,true>& A, const VT3& x, const VT4& y )
1102  {
1103  typedef IntrinsicTrait<ElementType> IT;
1104 
1105  const size_t m( (~A).rows() );
1106  const size_t n( (~A).columns() );
1107 
1108  for( size_t j=0UL; j<n; ++j )
1109  {
1110  const IntrinsicType y1( set( y[j] ) );
1111 
1112  for( size_t i=0UL; i<m; i+=IT::size ) {
1113  (~A).store( i, j, (~A).load(i,j) + x.load(i) * y1 );
1114  }
1115  }
1116  }
1118  //**********************************************************************************************
1119 
1120  //**Addition assignment to sparse matrices******************************************************
1121  // No special implementation for the addition assignment to sparse matrices.
1122  //**********************************************************************************************
1123 
1124  //**Subtraction assignment to row-major dense matrices******************************************
1139  template< typename MT > // Type of the target dense matrix
1140  friend inline typename EnableIf< UseAssign<MT> >::Type
1141  subAssign( DenseMatrix<MT,false>& lhs, const DVecTDVecMultExpr& rhs )
1142  {
1144 
1145  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1146  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1147 
1148  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
1149  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1150 
1151  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1152  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1153  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1154  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1155 
1156  DVecTDVecMultExpr::selectSubAssignKernel( ~lhs, x, y );
1157  }
1159  //**********************************************************************************************
1160 
1161  //**Default subtraction assignment to row-major dense matrices**********************************
1175  template< typename MT // Type of the left-hand side target matrix
1176  , typename VT3 // Type of the left-hand side vector operand
1177  , typename VT4 > // Type of the right-hand side vector operand
1178  static inline typename EnableIf< UseDefaultKernel<MT,VT3,VT4> >::Type
1179  selectSubAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
1180  {
1181  const size_t m( (~A).rows() );
1182  const size_t n( (~A).columns() );
1183 
1184  const size_t jpos( n & size_t(-2) );
1185  BLAZE_INTERNAL_ASSERT( ( n - ( n % 2UL ) ) == jpos, "Invalid end calculation" );
1186 
1187  for( size_t i=0UL; i<m; ++i ) {
1188  for( size_t j=0UL; j<jpos; j+=2UL ) {
1189  (~A)(i,j ) -= x[i] * y[j ];
1190  (~A)(i,j+1UL) -= x[i] * y[j+1UL];
1191  }
1192  if( jpos < n ) {
1193  (~A)(i,jpos) -= x[i] * y[jpos];
1194  }
1195  }
1196  }
1198  //**********************************************************************************************
1199 
1200  //**Vectorized subtraction assignment to row-major dense matrices*******************************
1214  template< typename MT // Type of the left-hand side target matrix
1215  , typename VT3 // Type of the left-hand side vector operand
1216  , typename VT4 > // Type of the right-hand side vector operand
1217  static inline typename EnableIf< UseVectorizedKernel<MT,VT3,VT4> >::Type
1218  selectSubAssignKernel( DenseMatrix<MT,false>& A, const VT3& x, const VT4& y )
1219  {
1220  typedef IntrinsicTrait<ElementType> IT;
1221 
1222  const size_t m( (~A).rows() );
1223  const size_t n( (~A).columns() );
1224 
1225  for( size_t i=0UL; i<m; ++i )
1226  {
1227  const IntrinsicType x1( set( x[i] ) );
1228 
1229  for( size_t j=0UL; j<n; j+=IT::size ) {
1230  (~A).store( i, j, (~A).load(i,j) - x1 * y.load(j) );
1231  }
1232  }
1233  }
1235  //**********************************************************************************************
1236 
1237  //**Subtraction assignment to column-major dense matrices***************************************
1250  template< typename MT > // Type of the target dense matrix
1251  friend inline void subAssign( DenseMatrix<MT,true>& lhs, const DVecTDVecMultExpr& rhs )
1252  {
1254 
1256 
1257  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1258  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1259 
1260  LT x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense vector operand
1261  RT y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense vector operand
1262 
1263  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1264  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1265  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1266  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1267 
1268  DVecTDVecMultExpr::selectSubAssignKernel( ~lhs, x, y );
1269  }
1271  //**********************************************************************************************
1272 
1273  //**Default subtraction assignment to column dense matrices*************************************
1287  template< typename MT // Type of the left-hand side target matrix
1288  , typename VT3 // Type of the left-hand side vector operand
1289  , typename VT4 > // Type of the right-hand side vector operand
1290  static inline typename EnableIf< UseDefaultKernel<MT,VT3,VT4> >::Type
1291  selectSubAssignKernel( DenseMatrix<MT,true>& A, const VT3& x, const VT4& y )
1292  {
1293  const size_t m( (~A).rows() );
1294  const size_t n( (~A).columns() );
1295 
1296  const size_t ipos( m & size_t(-2) );
1297  BLAZE_INTERNAL_ASSERT( ( m - ( m % 2UL ) ) == ipos, "Invalid end calculation" );
1298 
1299  for( size_t j=0UL; j<n; ++j ) {
1300  for( size_t i=0UL; i<ipos; i+=2UL ) {
1301  (~A)(i ,j) -= x[i ] * y[j];
1302  (~A)(i+1UL,j) -= x[i+1UL] * y[j];
1303  }
1304  if( ipos < m ) {
1305  (~A)(ipos,j) -= x[ipos] * y[j];
1306  }
1307  }
1308  }
1310  //**********************************************************************************************
1311 
1312  //**Vectorized subtraction assignment to column-major dense matrices****************************
1326  template< typename MT // Type of the left-hand side target matrix
1327  , typename VT3 // Type of the left-hand side vector operand
1328  , typename VT4 > // Type of the right-hand side vector operand
1329  static inline typename EnableIf< UseVectorizedKernel<MT,VT3,VT4> >::Type
1330  selectSubAssignKernel( DenseMatrix<MT,true>& A, const VT3& x, const VT4& y )
1331  {
1332  typedef IntrinsicTrait<ElementType> IT;
1333 
1334  const size_t m( (~A).rows() );
1335  const size_t n( (~A).columns() );
1336 
1337  for( size_t j=0UL; j<n; ++j )
1338  {
1339  const IntrinsicType y1( set( y[j] ) );
1340 
1341  for( size_t i=0UL; i<m; i+=IT::size ) {
1342  (~A).store( i, j, (~A).load(i,j) - x.load(i) * y1 );
1343  }
1344  }
1345  }
1347  //**********************************************************************************************
1348 
1349  //**Subtraction assignment to sparse matrices***************************************************
1350  // No special implementation for the subtraction assignment to sparse matrices.
1351  //**********************************************************************************************
1352 
1353  //**Multiplication assignment to dense matrices*************************************************
1354  // No special implementation for the multiplication assignment to dense matrices.
1355  //**********************************************************************************************
1356 
1357  //**Multiplication assignment to sparse matrices************************************************
1358  // No special implementation for the multiplication assignment to sparse matrices.
1359  //**********************************************************************************************
1360 
1361  //**SMP assignment to dense matrices************************************************************
1375  template< typename MT // Type of the target dense matrix
1376  , bool SO > // Storage order of the target dense matrix
1377  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
1378  smpAssign( DenseMatrix<MT,SO>& lhs, const DVecTDVecMultExpr& rhs )
1379  {
1381 
1382  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1383  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1384 
1385  LT x( rhs.lhs_ ); // Evaluation of the left-hand side dense vector operand
1386  RT y( rhs.rhs_ ); // Evaluation of the right-hand side dense vector operand
1387 
1388  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1389  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1390  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1391  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1392 
1393  smpAssign( ~lhs, x * y );
1394  }
1396  //**********************************************************************************************
1397 
1398  //**SMP assignment to sparse matrices***********************************************************
1412  template< typename MT // Type of the target sparse matrix
1413  , bool SO > // Storage order of the target sparse matrix
1414  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
1415  smpAssign( SparseMatrix<MT,SO>& lhs, const DVecTDVecMultExpr& rhs )
1416  {
1418 
1419  typedef typename SelectType< SO, OppositeType, ResultType >::Type TmpType;
1420 
1427 
1428  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1429  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1430 
1431  const TmpType tmp( rhs );
1432  smpAssign( ~lhs, tmp );
1433  }
1435  //**********************************************************************************************
1436 
1437  //**SMP addition assignment to dense matrices***************************************************
1451  template< typename MT > // Type of the target dense matrix
1452  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
1453  smpAddAssign( DenseMatrix<MT,false>& lhs, const DVecTDVecMultExpr& rhs )
1454  {
1456 
1457  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1458  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1459 
1460  LT x( rhs.lhs_ ); // Evaluation of the left-hand side dense vector operand
1461  RT y( rhs.rhs_ ); // Evaluation of the right-hand side dense vector operand
1462 
1463  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1464  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1465  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1466  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1467 
1468  smpAddAssign( ~lhs, x * y );
1469  }
1471  //**********************************************************************************************
1472 
1473  //**SMP addition assignment to sparse matrices**************************************************
1474  // No special implementation for the SMP addition assignment to sparse matrices.
1475  //**********************************************************************************************
1476 
1477  //**SMP subtraction assignment to dense matrices************************************************
1492  template< typename MT > // Type of the target dense matrix
1493  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
1494  smpSubAssign( DenseMatrix<MT,false>& lhs, const DVecTDVecMultExpr& rhs )
1495  {
1497 
1498  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1499  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1500 
1501  LT x( rhs.lhs_ ); // Evaluation of the left-hand side dense vector operand
1502  RT y( rhs.rhs_ ); // Evaluation of the right-hand side dense vector operand
1503 
1504  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size() , "Invalid vector size" );
1505  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size() , "Invalid vector size" );
1506  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).rows() , "Invalid vector size" );
1507  BLAZE_INTERNAL_ASSERT( y.size() == (~lhs).columns(), "Invalid vector size" );
1508 
1509  smpSubAssign( ~lhs, x * y );
1510  }
1512  //**********************************************************************************************
1513 
1514  //**SMP subtraction assignment to sparse matrices***********************************************
1515  // No special implementation for the SMP subtraction assignment to sparse matrices.
1516  //**********************************************************************************************
1517 
1518  //**SMP multiplication assignment to dense matrices*********************************************
1519  // No special implementation for the SMP multiplication assignment to dense matrices.
1520  //**********************************************************************************************
1521 
1522  //**SMP multiplication assignment to sparse matrices********************************************
1523  // No special implementation for the SMP multiplication assignment to sparse matrices.
1524  //**********************************************************************************************
1525 
1526  //**Compile time checks*************************************************************************
1534  //**********************************************************************************************
1535 };
1536 //*************************************************************************************************
1537 
1538 
1539 
1540 
1541 //=================================================================================================
1542 //
1543 // GLOBAL BINARY ARITHMETIC OPERATORS
1544 //
1545 //=================================================================================================
1546 
1547 //*************************************************************************************************
1574 template< typename T1 // Type of the left-hand side dense vector
1575  , typename T2 > // Type of the right-hand side dense vector
1576 inline const DVecTDVecMultExpr<T1,T2>
1578 {
1580 
1581  return DVecTDVecMultExpr<T1,T2>( ~lhs, ~rhs );
1582 }
1583 //*************************************************************************************************
1584 
1585 
1586 
1587 
1588 //=================================================================================================
1589 //
1590 // ROWS SPECIALIZATIONS
1591 //
1592 //=================================================================================================
1593 
1594 //*************************************************************************************************
1596 template< typename VT1, typename VT2 >
1597 struct Rows< DVecTDVecMultExpr<VT1,VT2> > : public Size<VT1>
1598 {};
1600 //*************************************************************************************************
1601 
1602 
1603 
1604 
1605 //=================================================================================================
1606 //
1607 // COLUMNS SPECIALIZATIONS
1608 //
1609 //=================================================================================================
1610 
1611 //*************************************************************************************************
1613 template< typename VT1, typename VT2 >
1614 struct Columns< DVecTDVecMultExpr<VT1,VT2> > : public Size<VT2>
1615 {};
1617 //*************************************************************************************************
1618 
1619 
1620 
1621 
1622 //=================================================================================================
1623 //
1624 // EXPRESSION TRAIT SPECIALIZATIONS
1625 //
1626 //=================================================================================================
1627 
1628 //*************************************************************************************************
1630 template< typename VT1, typename VT2, bool AF >
1631 struct SubmatrixExprTrait< DVecTDVecMultExpr<VT1,VT2>, AF >
1632 {
1633  public:
1634  //**********************************************************************************************
1635  typedef typename MultExprTrait< typename SubvectorExprTrait<const VT1,AF>::Type
1636  , typename SubvectorExprTrait<const VT2,AF>::Type >::Type Type;
1637  //**********************************************************************************************
1638 };
1640 //*************************************************************************************************
1641 
1642 
1643 //*************************************************************************************************
1645 template< typename VT1, typename VT2 >
1646 struct RowExprTrait< DVecTDVecMultExpr<VT1,VT2> >
1647 {
1648  public:
1649  //**********************************************************************************************
1650  typedef typename MultExprTrait< typename VT1::ReturnType, VT2 >::Type Type;
1651  //**********************************************************************************************
1652 };
1654 //*************************************************************************************************
1655 
1656 
1657 //*************************************************************************************************
1659 template< typename VT1, typename VT2 >
1660 struct ColumnExprTrait< DVecTDVecMultExpr<VT1,VT2> >
1661 {
1662  public:
1663  //**********************************************************************************************
1664  typedef typename MultExprTrait< VT1, typename VT2::ReturnType >::Type Type;
1665  //**********************************************************************************************
1666 };
1668 //*************************************************************************************************
1669 
1670 } // namespace blaze
1671 
1672 #endif
Pointer difference type of the Blaze library.
RT1::ElementType ET1
Element type of the left-hand side dense vector expression.
Definition: DVecTDVecMultExpr.h:103
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:195
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecTDVecMultExpr.h:232
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:8247
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:264
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecTDVecMultExpr.h:300
#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: TransposeFlag.h:159
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:209
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecTDVecMultExpr.h:278
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: DVecTDVecMultExpr.h:540
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecTDVecMultExpr.h:454
#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:196
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DVecTDVecMultExpr.h:593
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecTDVecMultExpr.h:418
ElementType * PointerType
Pointer return type.
Definition: DVecTDVecMultExpr.h:230
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2507
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:261
DVecTDVecMultExpr(const VT1 &lhs, const VT2 &rhs)
Constructor for the DVecTDVecMultExpr class.
Definition: DVecTDVecMultExpr.h:483
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecTDVecMultExpr.h:461
VT2::ConstIterator RightIteratorType
ConstIterator type of the right-hand side dense matrix expression.
Definition: DVecTDVecMultExpr.h:245
Expression object for outer products between two dense vectors.The DVecTDVecMultExpr class represents...
Definition: DVecTDVecMultExpr.h:95
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:699
Header file for the Computation base class.
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecTDVecMultExpr.h:407
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
SelectType< evaluateLeft, const RT1, CT1 >::Type LT
Type for the assignment of the left-hand side dense vector operand.
Definition: DVecTDVecMultExpr.h:215
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:242
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecTDVecMultExpr.h:374
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DVecTDVecMultExpr.h:605
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:236
VT1::CompositeType CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecTDVecMultExpr.h:107
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:430
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:106
#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: StorageOrder.h:161
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecTDVecMultExpr.h:310
SelectType< useAssign, const ResultType, const DVecTDVecMultExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: DVecTDVecMultExpr.h:206
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2511
#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
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type store(T *address, const sse_int16_t &value)
Aligned store of a vector of 2-byte integral values.
Definition: Store.h:80
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecTDVecMultExpr.h:352
LeftOperand leftOperand() const
Returns the left-hand side dense vector operand.
Definition: DVecTDVecMultExpr.h:571
Header file for the DenseMatrix base class.
BLAZE_ALWAYS_INLINE void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:635
Header file for the Columns type trait.
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DVecTDVecMultExpr.h:197
IntrinsicTrait< ElementType >::Type IntrinsicType
Resulting intrinsic element type.
Definition: DVecTDVecMultExpr.h:200
size_t rows() const
Returns the current number of rows of the matrix.
Definition: DVecTDVecMultExpr.h:551
ReferenceType reference
Reference return type.
Definition: DVecTDVecMultExpr.h:238
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:254
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecTDVecMultExpr.h:363
bool isAligned() const
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecTDVecMultExpr.h:615
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: DVecTDVecMultExpr.h:203
Constraint on the data type.
SelectType< IsExpression< VT2 >::value, const VT2, const VT2 & >::Type RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecTDVecMultExpr.h:212
#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:239
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:218
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecTDVecMultExpr.h:442
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2505
VT1::ReturnType RN1
Return type of the left-hand side dense vector expression.
Definition: DVecTDVecMultExpr.h:105
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:102
Header file for the EnableIf class template.
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecTDVecMultExpr.h:289
Header file for the serial shim.
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecTDVecMultExpr.h:228
IteratorCategory iterator_category
The iterator category.
Definition: DVecTDVecMultExpr.h:235
VT1::ResultType RT1
Result type of the left-hand side dense vector expression.
Definition: DVecTDVecMultExpr.h:101
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:632
#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: StorageOrder.h:81
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2506
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:749
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:150
BLAZE_ALWAYS_INLINE void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:742
RightOperand rightOperand() const
Returns the right-hand side dense vector operand.
Definition: DVecTDVecMultExpr.h:581
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: DVecTDVecMultExpr.h:528
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DVecTDVecMultExpr.h:462
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DVecTDVecMultExpr.h:198
RT2::ElementType ET2
Element type of the right-hand side dense vector expression.
Definition: DVecTDVecMultExpr.h:104
RightOperand rhs_
Right-hand side dense vector of the multiplication expression.
Definition: DVecTDVecMultExpr.h:633
IntrinsicType load() const
Access to the intrinsic elements of the matrix.
Definition: DVecTDVecMultExpr.h:341
VT2::CompositeType CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecTDVecMultExpr.h:108
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: DVecTDVecMultExpr.h:625
Constraint on the data type.
const size_t SMP_DVECTDVECMULT_THRESHOLD
SMP dense vector/dense vector outer product threshold.This threshold specifies when a dense vector/de...
Definition: Thresholds.h:1202
ElementType & ReferenceType
Reference return type.
Definition: DVecTDVecMultExpr.h:231
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DVecTDVecMultExpr.h:496
Constraint on the data type.
Header file for the IsReference type trait.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, sse_int16_t >::Type set(T value)
Sets all values in the vector to the given 2-byte integral value.
Definition: Set.h:73
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:283
Header file for all intrinsic functionality.
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecTDVecMultExpr.h:266
ResultType::ElementType ElementType
Resulting element type.
Definition: DVecTDVecMultExpr.h:199
#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:561
ElementType ValueType
Type of the underlying elements.
Definition: DVecTDVecMultExpr.h:229
Header file for the IsComputation type trait class.
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecTDVecMultExpr.h:331
Iterator over the elements of the dense matrix.
Definition: DVecTDVecMultExpr.h:224
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:2502
PointerType pointer
Pointer return type.
Definition: DVecTDVecMultExpr.h:237
#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: TransposeFlag.h:81
Header file for the SubvectorExprTrait class template.
MultExprTrait< RN1, RN2 >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: DVecTDVecMultExpr.h:131
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecTDVecMultExpr.h:396
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t i, size_t j) const
Access to the intrinsic elements of the matrix.
Definition: DVecTDVecMultExpr.h:511
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecTDVecMultExpr.h:321
System settings for the inline keywords.
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:385
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:209
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
BLAZE_ALWAYS_INLINE void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:849