All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TDMatTSMatMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_TDMATTSMATMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_TDMATTSMATMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <stdexcept>
51 #include <blaze/math/Intrinsics.h>
53 #include <blaze/math/shims/Reset.h>
77 #include <blaze/util/Assert.h>
79 #include <blaze/util/DisableIf.h>
80 #include <blaze/util/EnableIf.h>
81 #include <blaze/util/InvalidType.h>
83 #include <blaze/util/SelectType.h>
84 #include <blaze/util/Types.h>
86 
87 
88 namespace blaze {
89 
90 //=================================================================================================
91 //
92 // CLASS TDMATTSMATMULTEXPR
93 //
94 //=================================================================================================
95 
96 //*************************************************************************************************
103 template< typename MT1 // Type of the left-hand side dense matrix
104  , typename MT2 > // Type of the right-hand side sparse matrix
105 class TDMatTSMatMultExpr : public DenseMatrix< TDMatTSMatMultExpr<MT1,MT2>, true >
106  , private MatMatMultExpr
107  , private Computation
108 {
109  private:
110  //**Type definitions****************************************************************************
111  typedef typename MT1::ResultType RT1;
112  typedef typename MT2::ResultType RT2;
113  typedef typename MT1::ElementType ET1;
114  typedef typename MT2::ElementType ET2;
115  typedef typename MT1::CompositeType CT1;
116  typedef typename MT2::CompositeType CT2;
117  //**********************************************************************************************
118 
119  //**********************************************************************************************
121 
124  template< typename T1, typename T2, typename T3 >
125  struct UseVectorizedKernel {
126  enum { value = T1::vectorizable && T2::vectorizable &&
133  };
135  //**********************************************************************************************
136 
137  //**********************************************************************************************
139 
143  template< typename T1, typename T2, typename T3 >
144  struct UseOptimizedKernel {
145  enum { value = !UseVectorizedKernel<T1,T2,T3>::value &&
148  };
150  //**********************************************************************************************
151 
152  //**********************************************************************************************
154 
157  template< typename T1, typename T2, typename T3 >
158  struct UseDefaultKernel {
159  enum { value = !UseVectorizedKernel<T1,T2,T3>::value &&
160  !UseOptimizedKernel<T1,T2,T3>::value };
161  };
163  //**********************************************************************************************
164 
165  public:
166  //**Type definitions****************************************************************************
173  typedef const ElementType ReturnType;
174  typedef const ResultType CompositeType;
175 
177  typedef typename SelectType< IsExpression<MT1>::value, const MT1, const MT1& >::Type LeftOperand;
178 
180  typedef typename SelectType< IsExpression<MT2>::value, const MT2, const MT2& >::Type RightOperand;
181 
183  typedef typename SelectType< IsComputation<MT1>::value, const RT1, CT1 >::Type LT;
184 
186  typedef typename SelectType< IsComputation<MT2>::value, const RT2, CT2 >::Type RT;
187  //**********************************************************************************************
188 
189  //**Compilation flags***************************************************************************
191  enum { vectorizable = 0 };
192  //**********************************************************************************************
193 
194  //**Constructor*********************************************************************************
200  explicit inline TDMatTSMatMultExpr( const MT1& lhs, const MT2& rhs )
201  : lhs_( lhs ) // Left-hand side dense matrix of the multiplication expression
202  , rhs_( rhs ) // Right-hand side sparse matrix of the multiplication expression
203  {
204  BLAZE_INTERNAL_ASSERT( lhs.columns() == rhs.rows(), "Invalid matrix sizes" );
205  }
206  //**********************************************************************************************
207 
208  //**Access operator*****************************************************************************
215  inline ReturnType operator()( size_t i, size_t j ) const {
216  BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
217  BLAZE_INTERNAL_ASSERT( j < rhs_.columns(), "Invalid column access index" );
218 
220 
221  ElementType tmp = ElementType();
222 
223  // Early exit
224  if( lhs_.columns() == 0UL )
225  return tmp;
226 
227  // Fast computation in case the right-hand side sparse matrix directly provides iterators
229  {
230  CT2 B( rhs_ ); // Evaluation of the right-hand side sparse matrix operand
231 
232  const ConstIterator end( B.end(j) );
233  ConstIterator element( B.begin(j) );
234 
235  // Early exit in case column j is empty
236  if( element == end )
237  return tmp;
238 
239  // Calculating element (i,j)
240  tmp = lhs_(i,element->index()) * element->value();
241  ++element;
242  for( ; element!=end; ++element )
243  tmp += lhs_(i,element->index()) * element->value();
244  }
245 
246  // Default computation in case the right-hand side sparse matrix doesn't provide iterators
247  else {
248  tmp = lhs_(i,0UL) * rhs_(0UL,j);
249  for( size_t k=1UL; k<lhs_.columns(); ++k ) {
250  tmp += lhs_(i,k) * rhs_(k,j);
251  }
252  }
253 
254  return tmp;
255  }
256  //**********************************************************************************************
257 
258  //**Rows function*******************************************************************************
263  inline size_t rows() const {
264  return lhs_.rows();
265  }
266  //**********************************************************************************************
267 
268  //**Columns function****************************************************************************
273  inline size_t columns() const {
274  return rhs_.columns();
275  }
276  //**********************************************************************************************
277 
278  //**Left operand access*************************************************************************
283  inline LeftOperand leftOperand() const {
284  return lhs_;
285  }
286  //**********************************************************************************************
287 
288  //**Right operand access************************************************************************
293  inline RightOperand rightOperand() const {
294  return rhs_;
295  }
296  //**********************************************************************************************
297 
298  //**********************************************************************************************
304  template< typename T >
305  inline bool canAlias( const T* alias ) const {
306  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
307  }
308  //**********************************************************************************************
309 
310  //**********************************************************************************************
316  template< typename T >
317  inline bool isAliased( const T* alias ) const {
318  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
319  }
320  //**********************************************************************************************
321 
322  private:
323  //**Member variables****************************************************************************
326  //**********************************************************************************************
327 
328  //**Assignment to dense matrices****************************************************************
341  template< typename MT // Type of the target dense matrix
342  , bool SO > // Storage order of the target dense matrix
343  friend inline void assign( DenseMatrix<MT,SO>& lhs, const TDMatTSMatMultExpr& rhs )
344  {
346 
347  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
348  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
349 
350  LT A( rhs.lhs_ ); // Evaluation of the left-hand side dense matrix operand
351  RT B( rhs.rhs_ ); // Evaluation of the right-hand side sparse matrix operand
352 
353  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
354  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
355  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
356  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
357  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
358  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
359 
360  TDMatTSMatMultExpr::selectAssignKernel( ~lhs, A, B );
361  }
363  //**********************************************************************************************
364 
365  //**Default assignment to row-major dense matrices**********************************************
379  template< typename MT3 // Type of the left-hand side target matrix
380  , typename MT4 // Type of the left-hand side matrix operand
381  , typename MT5 > // Type of the right-hand side matrix operand
382  static inline void
383  selectAssignKernel( DenseMatrix<MT3,false>& C, const MT4& A, const MT5& B )
384  {
386 
387  const size_t iend( A.rows() & size_t(-4) );
388  BLAZE_INTERNAL_ASSERT( ( A.rows() - ( A.rows() % 4UL ) ) == iend, "Invalid end calculation" );
389 
390  for( size_t i=0UL; i<iend; i+=4UL ) {
391  for( size_t j=0UL; j<B.columns(); ++j )
392  {
393  ConstIterator element( B.begin(j) );
394  const ConstIterator end( B.end(j) );
395 
396  if( element == end ) {
397  reset( (~C)(i ,j) );
398  reset( (~C)(i+1UL,j) );
399  reset( (~C)(i+2UL,j) );
400  reset( (~C)(i+3UL,j) );
401  continue;
402  }
403 
404  (~C)(i ,j) = A(i ,element->index()) * element->value();
405  (~C)(i+1UL,j) = A(i+1UL,element->index()) * element->value();
406  (~C)(i+2UL,j) = A(i+2UL,element->index()) * element->value();
407  (~C)(i+3UL,j) = A(i+3UL,element->index()) * element->value();
408  ++element;
409  for( ; element!=end; ++element ) {
410  (~C)(i ,j) += A(i ,element->index()) * element->value();
411  (~C)(i+1UL,j) += A(i+1UL,element->index()) * element->value();
412  (~C)(i+2UL,j) += A(i+2UL,element->index()) * element->value();
413  (~C)(i+3UL,j) += A(i+3UL,element->index()) * element->value();
414  }
415  }
416  }
417 
418  for( size_t i=iend; i<A.rows(); ++i ) {
419  for( size_t j=0UL; j<B.columns(); ++j )
420  {
421  ConstIterator element( B.begin(j) );
422  const ConstIterator end( B.end(j) );
423 
424  if( element == end ) {
425  reset( (~C)(i,j) );
426  continue;
427  }
428 
429  (~C)(i,j) = A(i,element->index()) * element->value();
430  ++element;
431  for( ; element!=end; ++element )
432  (~C)(i,j) += A(i,element->index()) * element->value();
433  }
434  }
435  }
437  //**********************************************************************************************
438 
439  //**Default assignment to column-major dense matrices*******************************************
453  template< typename MT3 // Type of the left-hand side target matrix
454  , typename MT4 // Type of the left-hand side matrix operand
455  , typename MT5 > // Type of the right-hand side matrix operand
456  static inline typename EnableIf< UseDefaultKernel<MT3,MT4,MT5> >::Type
457  selectAssignKernel( DenseMatrix<MT3,true>& C, const MT4& A, const MT5& B )
458  {
460 
461  for( size_t j=0UL; j<B.columns(); ++j ) {
462  for( size_t i=0UL; i<(~C).rows(); ++i ) {
463  reset( (~C)(i,j) );
464  }
465  ConstIterator element( B.begin(j) );
466  const ConstIterator end( B.end(j) );
467  for( ; element!=end; ++element ) {
468  for( size_t i=0UL; i<A.rows(); ++i ) {
469  if( isDefault( (~C)(i,j) ) )
470  (~C)(i,j) = A(i,element->index()) * element->value();
471  else
472  (~C)(i,j) += A(i,element->index()) * element->value();
473  }
474  }
475  }
476  }
478  //**********************************************************************************************
479 
480  //**Optimized assignment to column-major dense matrices*****************************************
494  template< typename MT3 // Type of the left-hand side target matrix
495  , typename MT4 // Type of the left-hand side matrix operand
496  , typename MT5 > // Type of the right-hand side matrix operand
497  static inline typename EnableIf< UseOptimizedKernel<MT3,MT4,MT5> >::Type
498  selectAssignKernel( DenseMatrix<MT3,true>& C, const MT4& A, const MT5& B )
499  {
501 
502  const size_t iend( A.rows() & size_t(-4) );
503  BLAZE_INTERNAL_ASSERT( ( A.rows() - ( A.rows() % 4UL ) ) == iend, "Invalid end calculation" );
504 
505  reset( ~C );
506 
507  for( size_t j=0UL; j<B.columns(); ++j )
508  {
509  const ConstIterator end( B.end(j) );
510  ConstIterator element( B.begin(j) );
511 
512  const size_t kend( B.nonZeros(j) & size_t(-4) );
513 
514  for( size_t k=0UL; k<kend; k+=4UL ) {
515  const size_t j1( element->index() );
516  const ET2 v1( element->value() );
517  ++element;
518  const size_t j2( element->index() );
519  const ET2 v2( element->value() );
520  ++element;
521  const size_t j3( element->index() );
522  const ET2 v3( element->value() );
523  ++element;
524  const size_t j4( element->index() );
525  const ET2 v4( element->value() );
526  ++element;
527 
528  for( size_t i=0UL; i<iend; i+=4UL ) {
529  (~C)(i ,j) += A(i ,j1) * v1 + A(i ,j2) * v2 + A(i ,j3) * v3 + A(i ,j4) * v4;
530  (~C)(i+1UL,j) += A(i+1UL,j1) * v1 + A(i+1UL,j2) * v2 + A(i+1UL,j3) * v3 + A(i+1UL,j4) * v4;
531  (~C)(i+2UL,j) += A(i+2UL,j1) * v1 + A(i+2UL,j2) * v2 + A(i+2UL,j3) * v3 + A(i+2UL,j4) * v4;
532  (~C)(i+3UL,j) += A(i+3UL,j1) * v1 + A(i+3UL,j2) * v2 + A(i+3UL,j3) * v3 + A(i+3UL,j4) * v4;
533  }
534  for( size_t i=iend; i<A.rows(); ++i ) {
535  (~C)(i,j) += A(i,j1) * v1 + A(i,j2) * v2 + A(i,j3) * v3 + A(i,j4) * v4;
536  }
537  }
538 
539  for( ; element!=end; ++element ) {
540  for( size_t i=0UL; i<iend; i+=4UL ) {
541  (~C)(i ,j) += A(i ,element->index()) * element->value();
542  (~C)(i+1UL,j) += A(i+1UL,element->index()) * element->value();
543  (~C)(i+2UL,j) += A(i+2UL,element->index()) * element->value();
544  (~C)(i+3UL,j) += A(i+3UL,element->index()) * element->value();
545  }
546  for( size_t i=iend; i<A.rows(); ++i ) {
547  (~C)(i,j) += A(i,element->index()) * element->value();
548  }
549  }
550  }
551  }
553  //**********************************************************************************************
554 
555  //**Vectorized assignment to column-major dense matrices****************************************
569  template< typename MT3 // Type of the left-hand side target matrix
570  , typename MT4 // Type of the left-hand side matrix operand
571  , typename MT5 > // Type of the right-hand side matrix operand
572  static inline typename EnableIf< UseVectorizedKernel<MT3,MT4,MT5> >::Type
573  selectAssignKernel( DenseMatrix<MT3,true>& C, const MT4& A, const MT5& B )
574  {
575  typedef IntrinsicTrait<ElementType> IT;
577 
578  const size_t M( A.rows() );
579 
580  reset( ~C );
581 
582  for( size_t j=0UL; j<B.columns(); ++j )
583  {
584  const ConstIterator end( B.end(j) );
585  ConstIterator element( B.begin(j) );
586 
587  const size_t kend( B.nonZeros(j) & size_t(-4) );
588 
589  for( size_t k=0UL; k<kend; k+=4UL ) {
590  const size_t j1( element->index() );
591  const IntrinsicType v1( set( element->value() ) );
592  ++element;
593  const size_t j2( element->index() );
594  const IntrinsicType v2( set( element->value() ) );
595  ++element;
596  const size_t j3( element->index() );
597  const IntrinsicType v3( set( element->value() ) );
598  ++element;
599  const size_t j4( element->index() );
600  const IntrinsicType v4( set( element->value() ) );
601  ++element;
602 
603  for( size_t i=0UL; i<M; i+=IT::size ) {
604  (~C).store( i, j, (~C).load(i,j) + A.load(i,j1) * v1 + A.load(i,j2) * v2 + A.load(i,j3) * v3 + A.load(i,j4) * v4 );
605  }
606  }
607 
608  for( ; element!=end; ++element ) {
609  const size_t j1( element->index() );
610  const IntrinsicType v1( set( element->value() ) );
611 
612  for( size_t i=0UL; i<M; i+=IT::size ) {
613  (~C).store( i, j, (~C).load(i,j) + A.load(i,j1) * v1 );
614  }
615  }
616  }
617  }
619  //**********************************************************************************************
620 
621  //**Assignment to sparse matrices***************************************************************
633  template< typename MT // Type of the target sparse matrix
634  , bool SO > // Storage order of the target sparse matrix
635  friend inline void assign( SparseMatrix<MT,SO>& lhs, const TDMatTSMatMultExpr& rhs )
636  {
638 
639  typedef typename SelectType< SO, ResultType, OppositeType >::Type TmpType;
640 
647 
648  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
649  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
650 
651  const TmpType tmp( rhs );
652  assign( ~lhs, tmp );
653  }
655  //**********************************************************************************************
656 
657  //**Addition assignment to dense matrices*******************************************************
670  template< typename MT // Type of the target dense matrix
671  , bool SO > // Storage order of the target dense matrix
672  friend inline void addAssign( DenseMatrix<MT,SO>& lhs, const TDMatTSMatMultExpr& rhs )
673  {
675 
676  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
677  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
678 
679  LT A( rhs.lhs_ ); // Evaluation of the left-hand side dense matrix operand
680  RT B( rhs.rhs_ ); // Evaluation of the right-hand side sparse matrix operand
681 
682  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
683  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
684  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
685  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
686  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
687  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
688 
689  TDMatTSMatMultExpr::selectAddAssignKernel( ~lhs, A, B );
690  }
692  //**********************************************************************************************
693 
694  //**Default addition assignment to row-major dense matrices*************************************
708  template< typename MT3 // Type of the left-hand side target matrix
709  , typename MT4 // Type of the left-hand side matrix operand
710  , typename MT5 > // Type of the right-hand side matrix operand
711  static inline void
712  selectAddAssignKernel( DenseMatrix<MT3,false>& C, const MT4& A, const MT5& B )
713  {
715 
716  const size_t iend( A.rows() & size_t(-4) );
717  BLAZE_INTERNAL_ASSERT( ( A.rows() - ( A.rows() % 4UL ) ) == iend, "Invalid end calculation" );
718 
719  for( size_t i=0UL; i<iend; i+=4UL ) {
720  for( size_t j=0UL; j<B.columns(); ++j )
721  {
722  ConstIterator element( B.begin(j) );
723  const ConstIterator end( B.end(j) );
724 
725  for( ; element!=end; ++element ) {
726  (~C)(i ,j) += A(i ,element->index()) * element->value();
727  (~C)(i+1UL,j) += A(i+1UL,element->index()) * element->value();
728  (~C)(i+2UL,j) += A(i+2UL,element->index()) * element->value();
729  (~C)(i+3UL,j) += A(i+3UL,element->index()) * element->value();
730  }
731  }
732  }
733 
734  for( size_t i=iend; i<A.rows(); ++i ) {
735  for( size_t j=0UL; j<B.columns(); ++j )
736  {
737  ConstIterator element( B.begin(j) );
738  const ConstIterator end( B.end(j) );
739 
740  for( ; element!=end; ++element )
741  (~C)(i,j) += A(i,element->index()) * element->value();
742  }
743  }
744  }
746  //**********************************************************************************************
747 
748  //**Default addition assignment to column-major dense matrices**********************************
762  template< typename MT3 // Type of the left-hand side target matrix
763  , typename MT4 // Type of the left-hand side matrix operand
764  , typename MT5 > // Type of the right-hand side matrix operand
765  static inline typename EnableIf< UseDefaultKernel<MT3,MT4,MT5> >::Type
766  selectAddAssignKernel( DenseMatrix<MT3,true>& C, const MT4& A, const MT5& B )
767  {
769 
770  for( size_t j=0UL; j<B.columns(); ++j ) {
771  ConstIterator element( B.begin(j) );
772  const ConstIterator end( B.end(j) );
773  for( ; element!=end; ++element ) {
774  for( size_t i=0UL; i<A.rows(); ++i ) {
775  if( isDefault( (~C)(i,j) ) )
776  (~C)(i,j) = A(i,element->index()) * element->value();
777  else
778  (~C)(i,j) += A(i,element->index()) * element->value();
779  }
780  }
781  }
782  }
784  //**********************************************************************************************
785 
786  //**Optimized addition assignment to column-major dense matrices********************************
800  template< typename MT3 // Type of the left-hand side target matrix
801  , typename MT4 // Type of the left-hand side matrix operand
802  , typename MT5 > // Type of the right-hand side matrix operand
803  static inline typename EnableIf< UseOptimizedKernel<MT3,MT4,MT5> >::Type
804  selectAddAssignKernel( DenseMatrix<MT3,true>& C, const MT4& A, const MT5& B )
805  {
807 
808  const size_t iend( A.rows() & size_t(-4) );
809  BLAZE_INTERNAL_ASSERT( ( A.rows() - ( A.rows() % 4UL ) ) == iend, "Invalid end calculation" );
810 
811  for( size_t j=0UL; j<B.columns(); ++j )
812  {
813  const ConstIterator end( B.end(j) );
814  ConstIterator element( B.begin(j) );
815 
816  const size_t kend( B.nonZeros(j) & size_t(-4) );
817 
818  for( size_t k=0UL; k<kend; k+=4UL ) {
819  const size_t j1( element->index() );
820  const ET2 v1( element->value() );
821  ++element;
822  const size_t j2( element->index() );
823  const ET2 v2( element->value() );
824  ++element;
825  const size_t j3( element->index() );
826  const ET2 v3( element->value() );
827  ++element;
828  const size_t j4( element->index() );
829  const ET2 v4( element->value() );
830  ++element;
831 
832  for( size_t i=0UL; i<iend; i+=4UL ) {
833  (~C)(i ,j) += A(i ,j1) * v1 + A(i ,j2) * v2 + A(i ,j3) * v3 + A(i ,j4) * v4;
834  (~C)(i+1UL,j) += A(i+1UL,j1) * v1 + A(i+1UL,j2) * v2 + A(i+1UL,j3) * v3 + A(i+1UL,j4) * v4;
835  (~C)(i+2UL,j) += A(i+2UL,j1) * v1 + A(i+2UL,j2) * v2 + A(i+2UL,j3) * v3 + A(i+2UL,j4) * v4;
836  (~C)(i+3UL,j) += A(i+3UL,j1) * v1 + A(i+3UL,j2) * v2 + A(i+3UL,j3) * v3 + A(i+3UL,j4) * v4;
837  }
838  for( size_t i=iend; i<A.rows(); ++i ) {
839  (~C)(i,j) += A(i,j1) * v1 + A(i,j2) * v2 + A(i,j3) * v3 + A(i,j4) * v4;
840  }
841  }
842 
843  for( ; element!=end; ++element ) {
844  for( size_t i=0UL; i<iend; i+=4UL ) {
845  (~C)(i ,j) += A(i ,element->index()) * element->value();
846  (~C)(i+1UL,j) += A(i+1UL,element->index()) * element->value();
847  (~C)(i+2UL,j) += A(i+2UL,element->index()) * element->value();
848  (~C)(i+3UL,j) += A(i+3UL,element->index()) * element->value();
849  }
850  for( size_t i=iend; i<A.rows(); ++i ) {
851  (~C)(i,j) += A(i,element->index()) * element->value();
852  }
853  }
854  }
855  }
857  //**********************************************************************************************
858 
859  //**Vectorized addition assignment to column-major dense matrices*******************************
873  template< typename MT3 // Type of the left-hand side target matrix
874  , typename MT4 // Type of the left-hand side matrix operand
875  , typename MT5 > // Type of the right-hand side matrix operand
876  static inline typename EnableIf< UseVectorizedKernel<MT3,MT4,MT5> >::Type
877  selectAddAssignKernel( DenseMatrix<MT3,true>& C, const MT4& A, const MT5& B )
878  {
879  typedef IntrinsicTrait<ElementType> IT;
881 
882  const size_t M( A.rows() );
883 
884  for( size_t j=0UL; j<B.columns(); ++j )
885  {
886  const ConstIterator end( B.end(j) );
887  ConstIterator element( B.begin(j) );
888 
889  const size_t kend( B.nonZeros(j) & size_t(-4) );
890 
891  for( size_t k=0UL; k<kend; k+=4UL ) {
892  const size_t j1( element->index() );
893  const IntrinsicType v1( set( element->value() ) );
894  ++element;
895  const size_t j2( element->index() );
896  const IntrinsicType v2( set( element->value() ) );
897  ++element;
898  const size_t j3( element->index() );
899  const IntrinsicType v3( set( element->value() ) );
900  ++element;
901  const size_t j4( element->index() );
902  const IntrinsicType v4( set( element->value() ) );
903  ++element;
904 
905  for( size_t i=0UL; i<M; i+=IT::size ) {
906  (~C).store( i, j, (~C).load(i,j) + A.load(i,j1) * v1 + A.load(i,j2) * v2 + A.load(i,j3) * v3 + A.load(i,j4) * v4 );
907  }
908  }
909 
910  for( ; element!=end; ++element ) {
911  const size_t j1( element->index() );
912  const IntrinsicType v1( set( element->value() ) );
913 
914  for( size_t i=0UL; i<M; i+=IT::size ) {
915  (~C).store( i, j, (~C).load(i,j) + A.load(i,j1) * v1 );
916  }
917  }
918  }
919  }
921  //**********************************************************************************************
922 
923  //**Addition assignment to sparse matrices******************************************************
924  // No special implementation for the addition assignment to sparse matrices.
925  //**********************************************************************************************
926 
927  //**Subtraction assignment to dense matrices****************************************************
940  template< typename MT // Type of the target dense matrix
941  , bool SO > // Storage order of the target dense matrix
942  friend inline void subAssign( DenseMatrix<MT,SO>& lhs, const TDMatTSMatMultExpr& rhs )
943  {
945 
946  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
947  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
948 
949  LT A( rhs.lhs_ ); // Evaluation of the left-hand side dense matrix operand
950  RT B( rhs.rhs_ ); // Evaluation of the right-hand side sparse matrix operand
951 
952  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
953  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
954  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
955  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
956  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
957  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
958 
959  TDMatTSMatMultExpr::selectSubAssignKernel( ~lhs, A, B );
960  }
962  //**********************************************************************************************
963 
964  //**Default subtraction assignment to row-major dense matrices**********************************
978  template< typename MT3 // Type of the left-hand side target matrix
979  , typename MT4 // Type of the left-hand side matrix operand
980  , typename MT5 > // Type of the right-hand side matrix operand
981  static inline void
982  selectSubAssignKernel( DenseMatrix<MT3,false>& C, const MT4& A, const MT5& B )
983  {
985 
986  const size_t iend( A.rows() & size_t(-4) );
987  BLAZE_INTERNAL_ASSERT( ( A.rows() - ( A.rows() % 4UL ) ) == iend, "Invalid end calculation" );
988 
989  for( size_t i=0UL; i<iend; i+=4UL ) {
990  for( size_t j=0UL; j<B.columns(); ++j )
991  {
992  ConstIterator element( B.begin(j) );
993  const ConstIterator end( B.end(j) );
994 
995  for( ; element!=end; ++element ) {
996  (~C)(i ,j) -= A(i ,element->index()) * element->value();
997  (~C)(i+1UL,j) -= A(i+1UL,element->index()) * element->value();
998  (~C)(i+2UL,j) -= A(i+2UL,element->index()) * element->value();
999  (~C)(i+3UL,j) -= A(i+3UL,element->index()) * element->value();
1000  }
1001  }
1002  }
1003 
1004  for( size_t i=iend; i<A.rows(); ++i ) {
1005  for( size_t j=0UL; j<B.columns(); ++j )
1006  {
1007  ConstIterator element( B.begin(j) );
1008  const ConstIterator end( B.end(j) );
1009 
1010  for( ; element!=end; ++element )
1011  (~C)(i,j) -= A(i,element->index()) * element->value();
1012  }
1013  }
1014  }
1016  //**********************************************************************************************
1017 
1018  //**Default subtraction assignment to column-major dense matrices*******************************
1032  template< typename MT3 // Type of the left-hand side target matrix
1033  , typename MT4 // Type of the left-hand side matrix operand
1034  , typename MT5 > // Type of the right-hand side matrix operand
1035  static inline typename EnableIf< UseDefaultKernel<MT3,MT4,MT5> >::Type
1036  selectSubAssignKernel( DenseMatrix<MT3,true>& C, const MT4& A, const MT5& B )
1037  {
1039 
1040  for( size_t j=0UL; j<B.columns(); ++j ) {
1041  ConstIterator element( B.begin(j) );
1042  const ConstIterator end( B.end(j) );
1043  for( ; element!=end; ++element ) {
1044  for( size_t i=0UL; i<A.rows(); ++i ) {
1045  if( isDefault( (~C)(i,j) ) )
1046  (~C)(i,j) = -A(i,element->index()) * element->value();
1047  else
1048  (~C)(i,j) -= A(i,element->index()) * element->value();
1049  }
1050  }
1051  }
1052  }
1054  //**********************************************************************************************
1055 
1056  //**Optimized subtraction assignment to column-major dense matrices*****************************
1070  template< typename MT3 // Type of the left-hand side target matrix
1071  , typename MT4 // Type of the left-hand side matrix operand
1072  , typename MT5 > // Type of the right-hand side matrix operand
1073  static inline typename EnableIf< UseOptimizedKernel<MT3,MT4,MT5> >::Type
1074  selectSubAssignKernel( DenseMatrix<MT3,true>& C, const MT4& A, const MT5& B )
1075  {
1077 
1078  const size_t iend( A.rows() & size_t(-4) );
1079  BLAZE_INTERNAL_ASSERT( ( A.rows() - ( A.rows() % 4UL ) ) == iend, "Invalid end calculation" );
1080 
1081  for( size_t j=0UL; j<B.columns(); ++j )
1082  {
1083  const ConstIterator end( B.end(j) );
1084  ConstIterator element( B.begin(j) );
1085 
1086  const size_t kend( B.nonZeros(j) & size_t(-4) );
1087 
1088  for( size_t k=0UL; k<kend; k+=4UL ) {
1089  const size_t j1( element->index() );
1090  const ET2 v1( element->value() );
1091  ++element;
1092  const size_t j2( element->index() );
1093  const ET2 v2( element->value() );
1094  ++element;
1095  const size_t j3( element->index() );
1096  const ET2 v3( element->value() );
1097  ++element;
1098  const size_t j4( element->index() );
1099  const ET2 v4( element->value() );
1100  ++element;
1101 
1102  for( size_t i=0UL; i<iend; i+=4UL ) {
1103  (~C)(i ,j) -= A(i ,j1) * v1 + A(i ,j2) * v2 + A(i ,j3) * v3 + A(i ,j4) * v4;
1104  (~C)(i+1UL,j) -= A(i+1UL,j1) * v1 + A(i+1UL,j2) * v2 + A(i+1UL,j3) * v3 + A(i+1UL,j4) * v4;
1105  (~C)(i+2UL,j) -= A(i+2UL,j1) * v1 + A(i+2UL,j2) * v2 + A(i+2UL,j3) * v3 + A(i+2UL,j4) * v4;
1106  (~C)(i+3UL,j) -= A(i+3UL,j1) * v1 + A(i+3UL,j2) * v2 + A(i+3UL,j3) * v3 + A(i+3UL,j4) * v4;
1107  }
1108  for( size_t i=iend; i<A.rows(); ++i ) {
1109  (~C)(i,j) -= A(i,j1) * v1 + A(i,j2) * v2 + A(i,j3) * v3 + A(i,j4) * v4;
1110  }
1111  }
1112 
1113  for( ; element!=end; ++element ) {
1114  for( size_t i=0UL; i<iend; i+=4UL ) {
1115  (~C)(i ,j) -= A(i ,element->index()) * element->value();
1116  (~C)(i+1UL,j) -= A(i+1UL,element->index()) * element->value();
1117  (~C)(i+2UL,j) -= A(i+2UL,element->index()) * element->value();
1118  (~C)(i+3UL,j) -= A(i+3UL,element->index()) * element->value();
1119  }
1120  for( size_t i=iend; i<A.rows(); ++i ) {
1121  (~C)(i,j) -= A(i,element->index()) * element->value();
1122  }
1123  }
1124  }
1125  }
1127  //**********************************************************************************************
1128 
1129  //**Vectorized subtraction assignment to column-major dense matrices****************************
1143  template< typename MT3 // Type of the left-hand side target matrix
1144  , typename MT4 // Type of the left-hand side matrix operand
1145  , typename MT5 > // Type of the right-hand side matrix operand
1146  static inline typename EnableIf< UseVectorizedKernel<MT3,MT4,MT5> >::Type
1147  selectSubAssignKernel( DenseMatrix<MT3,true>& C, const MT4& A, const MT5& B )
1148  {
1149  typedef IntrinsicTrait<ElementType> IT;
1151 
1152  const size_t M( A.rows() );
1153 
1154  for( size_t j=0UL; j<B.columns(); ++j )
1155  {
1156  const ConstIterator end( B.end(j) );
1157  ConstIterator element( B.begin(j) );
1158 
1159  const size_t kend( B.nonZeros(j) & size_t(-4) );
1160 
1161  for( size_t k=0UL; k<kend; k+=4UL ) {
1162  const size_t j1( element->index() );
1163  const IntrinsicType v1( set( element->value() ) );
1164  ++element;
1165  const size_t j2( element->index() );
1166  const IntrinsicType v2( set( element->value() ) );
1167  ++element;
1168  const size_t j3( element->index() );
1169  const IntrinsicType v3( set( element->value() ) );
1170  ++element;
1171  const size_t j4( element->index() );
1172  const IntrinsicType v4( set( element->value() ) );
1173  ++element;
1174 
1175  for( size_t i=0UL; i<M; i+=IT::size ) {
1176  (~C).store( i, j, (~C).load(i,j) - A.load(i,j1) * v1 - A.load(i,j2) * v2 - A.load(i,j3) * v3 - A.load(i,j4) * v4 );
1177  }
1178  }
1179 
1180  for( ; element!=end; ++element ) {
1181  const size_t j1( element->index() );
1182  const IntrinsicType v1( set( element->value() ) );
1183 
1184  for( size_t i=0UL; i<M; i+=IT::size ) {
1185  (~C).store( i, j, (~C).load(i,j) - A.load(i,j1) * v1 );
1186  }
1187  }
1188  }
1189  }
1191  //**********************************************************************************************
1192 
1193  //**Subtraction assignment to sparse matrices***************************************************
1194  // No special implementation for the subtraction assignment to sparse matrices.
1195  //**********************************************************************************************
1196 
1197  //**Multiplication assignment to dense matrices*************************************************
1198  // No special implementation for the multiplication assignment to dense matrices.
1199  //**********************************************************************************************
1200 
1201  //**Multiplication assignment to sparse matrices************************************************
1202  // No special implementation for the multiplication assignment to sparse matrices.
1203  //**********************************************************************************************
1204 
1205  //**Compile time checks*************************************************************************
1212  //**********************************************************************************************
1213 };
1214 //*************************************************************************************************
1215 
1216 
1217 
1218 
1219 //=================================================================================================
1220 //
1221 // GLOBAL BINARY ARITHMETIC OPERATORS
1222 //
1223 //=================================================================================================
1224 
1225 //*************************************************************************************************
1254 template< typename T1 // Type of the left-hand side dense matrix
1255  , typename T2 > // Type of the right-hand side sparse matrix
1256 inline const TDMatTSMatMultExpr<T1,T2>
1258 {
1260 
1261  if( (~lhs).columns() != (~rhs).rows() )
1262  throw std::invalid_argument( "Matrix sizes do not match" );
1263 
1264  return TDMatTSMatMultExpr<T1,T2>( ~lhs, ~rhs );
1265 }
1266 //*************************************************************************************************
1267 
1268 
1269 
1270 
1271 //=================================================================================================
1272 //
1273 // EXPRESSION TRAIT SPECIALIZATIONS
1274 //
1275 //=================================================================================================
1276 
1277 //*************************************************************************************************
1279 template< typename MT1, typename MT2, typename VT >
1280 struct TDMatDVecMultExprTrait< TDMatTSMatMultExpr<MT1,MT2>, VT >
1281 {
1282  public:
1283  //**********************************************************************************************
1284  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1285  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1286  IsDenseVector<VT>::value && IsColumnVector<VT>::value
1287  , typename TDMatDVecMultExprTrait< MT1, typename TSMatDVecMultExprTrait<MT2,VT>::Type >::Type
1288  , INVALID_TYPE >::Type Type;
1289  //**********************************************************************************************
1290 };
1292 //*************************************************************************************************
1293 
1294 
1295 //*************************************************************************************************
1297 template< typename MT1, typename MT2, typename VT >
1298 struct TDMatSVecMultExprTrait< TDMatTSMatMultExpr<MT1,MT2>, VT >
1299 {
1300  public:
1301  //**********************************************************************************************
1302  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1303  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1304  IsSparseVector<VT>::value && IsColumnVector<VT>::value
1305  , typename TDMatDVecMultExprTrait< MT1, typename TSMatDVecMultExprTrait<MT2,VT>::Type >::Type
1306  , INVALID_TYPE >::Type Type;
1307  //**********************************************************************************************
1308 };
1310 //*************************************************************************************************
1311 
1312 
1313 //*************************************************************************************************
1315 template< typename VT, typename MT1, typename MT2 >
1316 struct TDVecTDMatMultExprTrait< VT, TDMatTSMatMultExpr<MT1,MT2> >
1317 {
1318  public:
1319  //**********************************************************************************************
1320  typedef typename SelectType< IsDenseVector<VT>::value && IsRowVector<VT>::value &&
1321  IsDenseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1322  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value
1323  , typename TDVecTSMatMultExprTrait< typename TDVecTDMatMultExprTrait<VT,MT1>::Type, MT2 >::Type
1324  , INVALID_TYPE >::Type Type;
1325  //**********************************************************************************************
1326 };
1328 //*************************************************************************************************
1329 
1330 
1331 //*************************************************************************************************
1333 template< typename VT, typename MT1, typename MT2 >
1334 struct TSVecTDMatMultExprTrait< VT, TDMatTSMatMultExpr<MT1,MT2> >
1335 {
1336  public:
1337  //**********************************************************************************************
1338  typedef typename SelectType< IsSparseVector<VT>::value && IsRowVector<VT>::value &&
1339  IsDenseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1340  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value
1341  , typename TDVecTSMatMultExprTrait< typename TSVecTDMatMultExprTrait<VT,MT1>::Type, MT2 >::Type
1342  , INVALID_TYPE >::Type Type;
1343  //**********************************************************************************************
1344 };
1346 //*************************************************************************************************
1347 
1348 
1349 //*************************************************************************************************
1351 template< typename MT1, typename MT2 >
1352 struct SubmatrixExprTrait< TDMatTSMatMultExpr<MT1,MT2> >
1353 {
1354  public:
1355  //**********************************************************************************************
1356  typedef typename MultExprTrait< typename SubmatrixExprTrait<const MT1>::Type
1357  , typename SubmatrixExprTrait<const MT2>::Type >::Type Type;
1358  //**********************************************************************************************
1359 };
1361 //*************************************************************************************************
1362 
1363 
1364 //*************************************************************************************************
1366 template< typename MT1, typename MT2 >
1367 struct RowExprTrait< TDMatTSMatMultExpr<MT1,MT2> >
1368 {
1369  public:
1370  //**********************************************************************************************
1371  typedef typename MultExprTrait< typename RowExprTrait<const MT1>::Type, MT2 >::Type Type;
1372  //**********************************************************************************************
1373 };
1375 //*************************************************************************************************
1376 
1377 
1378 //*************************************************************************************************
1380 template< typename MT1, typename MT2 >
1381 struct ColumnExprTrait< TDMatTSMatMultExpr<MT1,MT2> >
1382 {
1383  public:
1384  //**********************************************************************************************
1385  typedef typename MultExprTrait< MT1, typename ColumnExprTrait<const MT2>::Type >::Type Type;
1386  //**********************************************************************************************
1387 };
1389 //*************************************************************************************************
1390 
1391 } // namespace blaze
1392 
1393 #endif
MT1::ElementType ET1
Element type of the left-hand side dense matrix expression.
Definition: TDMatTSMatMultExpr.h:113
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4512
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:3703
Expression object for transpose dense matrix-transpose sparse matrix multiplications.The TDMatTSMatMultExpr class represents the compile time expression for multiplications between a column-major dense matrix and a column-major sparse matrix.
Definition: Forward.h:128
Header file for the IsSparseMatrix type trait.
bool isDefault(const DynamicMatrix< Type, SO > &m)
Returns whether the given dense matrix is in default state.
Definition: DynamicMatrix.h:4555
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:196
#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.
Header file for the IsColumnMajorMatrix type trait.
const ResultType CompositeType
Data type for composite expression templates.
Definition: TDMatTSMatMultExpr.h:174
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2375
Header file for the IsRowVector type trait.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:248
Header file for the Computation base class.
Header file for the MatMatMultExpr base class.
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
Header file for the RequiresEvaluation type trait.
SelectType< IsExpression< MT1 >::value, const MT1, const MT1 & >::Type LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: TDMatTSMatMultExpr.h:177
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:104
size_t rows() const
Returns the current number of rows of the matrix.
Definition: TDMatTSMatMultExpr.h:263
Constraint on the data type.
TDMatTSMatMultExpr(const MT1 &lhs, const MT2 &rhs)
Constructor for the TDMatTSMatMultExpr class.
Definition: TDMatTSMatMultExpr.h:200
Constraint on the data type.
Constraint on the data type.
Header file for the MultExprTrait class template.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
IntrinsicTrait< ElementType >::Type IntrinsicType
Resulting intrinsic element type.
Definition: TDMatTSMatMultExpr.h:172
MT2::CompositeType CT2
Composite type of the right-hand side sparse matrix expression.
Definition: TDMatTSMatMultExpr.h:116
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 DisableIf class template.
MT1::CompositeType CT1
Composite type of the left-hand side dense matrix expression.
Definition: TDMatTSMatMultExpr.h:115
Header file for the multiplication trait.
#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
Header file for the TSVecTDMatMultExprTrait class template.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2379
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: TDMatTSMatMultExpr.h:215
Header file for the TDMatSVecMultExprTrait class template.
Header file for the TDVecTSMatMultExprTrait class template.
Header file for the DenseMatrix base class.
Header file for the TSMatDVecMultExprTrait class template.
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:179
LeftOperand leftOperand() const
Returns the left-hand side transpose dense matrix operand.
Definition: TDMatTSMatMultExpr.h:283
#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
RightOperand rightOperand() const
Returns the right-hand side transpose sparse matrix operand.
Definition: TDMatTSMatMultExpr.h:293
Constraints on the storage order of matrix types.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2373
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 IsDenseMatrix type trait.
SelectType< IsComputation< MT2 >::value, const RT2, CT2 >::Type RT
Type for the assignment of the right-hand side sparse matrix operand.
Definition: TDMatTSMatMultExpr.h:186
ResultType::ElementType ElementType
Resulting element type.
Definition: TDMatTSMatMultExpr.h:171
Header file for the EnableIf class template.
LeftOperand lhs_
Left-hand side dense matrix of the multiplication expression.
Definition: TDMatTSMatMultExpr.h:324
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
Header file for the IsSparseVector type trait.
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
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:648
SelectType< IsComputation< MT1 >::value, const RT1, CT1 >::Type LT
Type for the assignment of the left-hand side dense matrix operand.
Definition: TDMatTSMatMultExpr.h:183
Header file for run time assertion macros.
Compile time check for column-major matrix types.This type trait tests whether or not the given templ...
Definition: IsColumnMajorMatrix.h:104
Utility type for generic codes.
Base template for the MultTrait class.
Definition: MultTrait.h:141
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TDMatTSMatMultExpr.h:173
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:209
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: TDMatTSMatMultExpr.h:170
Header file for the reset shim.
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:239
Header file for the isDefault shim.
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: TDMatTSMatMultExpr.h:305
MT1::ResultType RT1
Result type of the left-hand side dense matrix expression.
Definition: TDMatTSMatMultExpr.h:111
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: TDMatTSMatMultExpr.h:169
Header file for the RemoveReference type trait.
#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 the IsDenseVector type trait.
Header file for all intrinsic functionality.
TDMatTSMatMultExpr< MT1, MT2 > This
Type of this TDMatTSMatMultExpr instance.
Definition: TDMatTSMatMultExpr.h:167
MT2::ResultType RT2
Result type of the right-hand side sparse matrix expression.
Definition: TDMatTSMatMultExpr.h:112
Header file for the IsComputation type trait class.
Header file for the TDMatDVecMultExprTrait class template.
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: TDMatTSMatMultExpr.h:317
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2370
size_t columns(const Matrix< MT, SO > &m)
Returns the current number of columns of the matrix.
Definition: Matrix.h:154
Header file for basic type definitions.
MT2::ElementType ET2
Element type of the right-hand side sparse matrix expression.
Definition: TDMatTSMatMultExpr.h:114
SelectType< IsExpression< MT2 >::value, const MT2, const MT2 & >::Type RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: TDMatTSMatMultExpr.h:180
RightOperand rhs_
Right-hand side sparse matrix of the multiplication expression.
Definition: TDMatTSMatMultExpr.h:325
Header file for the IsColumnVector type trait.
Header file for the IsResizable type trait.
Size type of the Blaze library.
size_t rows(const Matrix< MT, SO > &m)
Returns the current number of rows of the matrix.
Definition: Matrix.h:138
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the TDVecTDMatMultExprTrait class template.
EnableIf< IsIntegral< T >, Set< T, sizeof(T)> >::Type::Type set(T value)
Sets all values in the vector to the given integral value.
Definition: Set.h:209
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:79
void store(float *address, const sse_float_t &value)
Aligned store of a vector of &#39;float&#39; values.
Definition: Store.h:242
Header file for the IsExpression type trait class.
Header file for the TSMatSVecMultExprTrait class template.
Header file for the FunctionTrace class.
MultTrait< RT1, RT2 >::Type ResultType
Result type for expression template evaluations.
Definition: TDMatTSMatMultExpr.h:168
size_t columns() const
Returns the current number of columns of the matrix.
Definition: TDMatTSMatMultExpr.h:273