Blaze  3.6
TSMatSMatMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_TSMATSMATMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_TSMATSMATMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
52 #include <blaze/math/Exception.h>
75 #include <blaze/math/views/Check.h>
79 #include <blaze/util/Assert.h>
80 #include <blaze/util/DisableIf.h>
81 #include <blaze/util/EnableIf.h>
84 #include <blaze/util/MaybeUnused.h>
85 #include <blaze/util/mpl/If.h>
86 #include <blaze/util/Types.h>
87 
88 
89 namespace blaze {
90 
91 //=================================================================================================
92 //
93 // CLASS TSMATSMATMULTEXPR
94 //
95 //=================================================================================================
96 
97 //*************************************************************************************************
104 template< typename MT1 // Type of the left-hand side sparse matrix
105  , typename MT2 > // Type of the right-hand side sparse matrix
106 class TSMatSMatMultExpr
107  : public MatMatMultExpr< SparseMatrix< TSMatSMatMultExpr<MT1,MT2>, !IsIdentity_v<MT1> > >
108  , private Computation
109 {
110  private:
111  //**Type definitions****************************************************************************
116  //**********************************************************************************************
117 
118  //**********************************************************************************************
120  static constexpr bool evaluateLeft = RequiresEvaluation_v<MT1>;
121  //**********************************************************************************************
122 
123  //**********************************************************************************************
125  static constexpr bool evaluateRight = RequiresEvaluation_v<MT2>;
126  //**********************************************************************************************
127 
128  //**********************************************************************************************
130 
136  template< typename T1, typename T2, typename T3 >
137  static constexpr bool CanExploitSymmetry_v =
138  ( ( IsRowMajorMatrix_v<T1> && IsSymmetric_v<T2> ) ||
139  ( IsColumnMajorMatrix_v<T1> && IsSymmetric_v<T3> ) );
141  //**********************************************************************************************
142 
143  //**********************************************************************************************
145 
149  template< typename T1, typename T2, typename T3 >
150  static constexpr bool IsEvaluationRequired_v =
151  ( ( evaluateLeft || evaluateRight ) && !CanExploitSymmetry_v<T1,T2,T2> );
153  //**********************************************************************************************
154 
155  public:
156  //**Type definitions****************************************************************************
159 
162 
167  using ReturnType = const ElementType;
168  using CompositeType = const ResultType;
169 
171  using LeftOperand = If_t< IsExpression_v<MT1>, const MT1, const MT1& >;
172 
174  using RightOperand = If_t< IsExpression_v<MT2>, const MT2, const MT2& >;
175  //**********************************************************************************************
176 
177  //**Compilation flags***************************************************************************
179  static constexpr bool smpAssignable =
180  ( !evaluateLeft && MT1::smpAssignable && !evaluateRight && MT2::smpAssignable );
181  //**********************************************************************************************
182 
183  //**Constructor*********************************************************************************
189  explicit inline TSMatSMatMultExpr( const MT1& lhs, const MT2& rhs ) noexcept
190  : lhs_( lhs ) // Left-hand side sparse matrix of the multiplication expression
191  , rhs_( rhs ) // Right-hand side sparse matrix of the multiplication expression
192  {
193  BLAZE_INTERNAL_ASSERT( lhs.columns() == rhs.rows(), "Invalid matrix sizes" );
194  }
195  //**********************************************************************************************
196 
197  //**Access operator*****************************************************************************
204  inline ReturnType operator()( size_t i, size_t j ) const {
205  BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
206  BLAZE_INTERNAL_ASSERT( j < rhs_.columns(), "Invalid column access index" );
207 
208  if( IsDiagonal_v<MT1> ) {
209  return lhs_(i,i) * rhs_(i,j);
210  }
211  else if( IsDiagonal_v<MT2> ) {
212  return lhs_(i,j) * rhs_(j,j);
213  }
214  else if( IsTriangular_v<MT1> || IsTriangular_v<MT2> ) {
215  const size_t begin( ( IsUpper_v<MT1> )
216  ?( ( IsLower_v<MT2> )
217  ?( max( ( IsStrictlyUpper_v<MT1> ? i+1UL : i )
218  , ( IsStrictlyLower_v<MT2> ? j+1UL : j ) ) )
219  :( IsStrictlyUpper_v<MT1> ? i+1UL : i ) )
220  :( ( IsLower_v<MT2> )
221  ?( IsStrictlyLower_v<MT2> ? j+1UL : j )
222  :( 0UL ) ) );
223  const size_t end( ( IsLower_v<MT1> )
224  ?( ( IsUpper_v<MT2> )
225  ?( min( ( IsStrictlyLower_v<MT1> ? i : i+1UL )
226  , ( IsStrictlyUpper_v<MT2> ? j : j+1UL ) ) )
227  :( IsStrictlyLower_v<MT1> ? i : i+1UL ) )
228  :( ( IsUpper_v<MT2> )
229  ?( IsStrictlyUpper_v<MT2> ? j : j+1UL )
230  :( lhs_.columns() ) ) );
231 
232  if( begin >= end ) return ElementType();
233 
234  const size_t n( end - begin );
235 
236  return subvector( row( lhs_, i, unchecked ), begin, n, unchecked ) *
237  subvector( column( rhs_, j, unchecked ), begin, n, unchecked );
238  }
239  else {
240  return row( lhs_, i, unchecked ) * column( rhs_, j, unchecked );
241  }
242  }
243  //**********************************************************************************************
244 
245  //**At function*********************************************************************************
253  inline ReturnType at( size_t i, size_t j ) const {
254  if( i >= lhs_.rows() ) {
255  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
256  }
257  if( j >= rhs_.columns() ) {
258  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
259  }
260  return (*this)(i,j);
261  }
262  //**********************************************************************************************
263 
264  //**Rows function*******************************************************************************
269  inline size_t rows() const noexcept {
270  return lhs_.rows();
271  }
272  //**********************************************************************************************
273 
274  //**Columns function****************************************************************************
279  inline size_t columns() const noexcept {
280  return rhs_.columns();
281  }
282  //**********************************************************************************************
283 
284  //**NonZeros function***************************************************************************
289  inline constexpr size_t nonZeros() const noexcept {
290  return 0UL;
291  }
292  //**********************************************************************************************
293 
294  //**NonZeros function***************************************************************************
300  inline size_t nonZeros( size_t i ) const noexcept {
301  MAYBE_UNUSED( i );
302  return 0UL;
303  }
304  //**********************************************************************************************
305 
306  //**Left operand access*************************************************************************
311  inline LeftOperand leftOperand() const noexcept {
312  return lhs_;
313  }
314  //**********************************************************************************************
315 
316  //**Right operand access************************************************************************
321  inline RightOperand rightOperand() const noexcept {
322  return rhs_;
323  }
324  //**********************************************************************************************
325 
326  //**********************************************************************************************
332  template< typename T >
333  inline bool canAlias( const T* alias ) const noexcept {
334  return ( lhs_.canAlias( alias ) || rhs_.canAlias( alias ) );
335  }
336  //**********************************************************************************************
337 
338  //**********************************************************************************************
344  template< typename T >
345  inline bool isAliased( const T* alias ) const noexcept {
346  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
347  }
348  //**********************************************************************************************
349 
350  //**********************************************************************************************
355  inline bool canSMPAssign() const noexcept {
356  return ( rows() * columns() >= SMP_TSMATSMATMULT_THRESHOLD );
357  }
358  //**********************************************************************************************
359 
360  private:
361  //**Member variables****************************************************************************
364  //**********************************************************************************************
365 
366  //**Assignment to dense matrices****************************************************************
379  template< typename MT // Type of the target dense matrix
380  , bool SO > // Storage order of the target dense matrix
381  friend inline auto assign( DenseMatrix<MT,SO>& lhs, const TSMatSMatMultExpr& rhs )
383  {
385 
386  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
387  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
388 
389  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
390  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
391 
392  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
393  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
394  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
395  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
396  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
397  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
398 
399  TSMatSMatMultExpr::selectAssignKernel( ~lhs, A, B );
400  }
402  //**********************************************************************************************
403 
404  //**Default assignment to dense matrices********************************************************
418  template< typename MT3 // Type of the left-hand side target matrix
419  , typename MT4 // Type of the left-hand side matrix operand
420  , typename MT5 > // Type of the right-hand side matrix operand
421  static inline void selectAssignKernel( MT3& C, const MT4& A, const MT5& B )
422  {
423  for( size_t j=0UL; j<A.columns(); ++j ) {
424  const auto lend( A.end(j) );
425  for( auto lelem=A.begin(j); lelem!=lend; ++lelem ) {
426  const auto rend( B.end(j) );
427  for( auto relem=B.begin(j); relem!=rend; ++relem )
428  {
430  isDefault( C(lelem->index(),relem->index()) ) ) {
431  C(lelem->index(),relem->index()) = lelem->value() * relem->value();
432  }
433  else {
434  C(lelem->index(),relem->index()) += lelem->value() * relem->value();
435  }
436  }
437  }
438  }
439  }
441  //**********************************************************************************************
442 
443  //**Assignment to row-major sparse matrices*****************************************************
456  template< typename MT > // Type of the target sparse matrix
457  friend inline auto assign( SparseMatrix<MT,false>& lhs, const TSMatSMatMultExpr& rhs )
458  -> DisableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
459  {
461 
463 
464  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
465  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
466 
467  BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE( OppositeType_t<MT1> );
468 
469  const OppositeType_t<MT1> tmp( serial( rhs.lhs_ ) );
470  assign( ~lhs, tmp * rhs.rhs_ );
471  }
473  //**********************************************************************************************
474 
475  //**Assignment to column-major sparse matrices**************************************************
488  template< typename MT > // Type of the target sparse matrix
489  friend inline auto assign( SparseMatrix<MT,true>& lhs, const TSMatSMatMultExpr& rhs )
490  -> DisableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
491  {
493 
494  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
495  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
496 
498 
499  const OppositeType_t<MT2> tmp( serial( rhs.rhs_ ) );
500  assign( ~lhs, rhs.lhs_ * tmp );
501  }
503  //**********************************************************************************************
504 
505  //**Restructuring assignment to row-major matrices**********************************************
520  template< typename MT > // Type of the target matrix
521  friend inline auto assign( Matrix<MT,false>& lhs, const TSMatSMatMultExpr& rhs )
522  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
523  {
525 
527 
528  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
529  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
530 
531  assign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
532  }
534  //**********************************************************************************************
535 
536  //**Restructuring assignment to column-major matrices*******************************************
551  template< typename MT > // Type of the target matrix
552  friend inline auto assign( Matrix<MT,true>& lhs, const TSMatSMatMultExpr& rhs )
553  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
554  {
556 
557  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
558  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
559 
560  assign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
561  }
563  //**********************************************************************************************
564 
565  //**Addition assignment to dense matrices*******************************************************
578  template< typename MT // Type of the target dense matrix
579  , bool SO > // Storage order of the target dense matarix
580  friend inline auto addAssign( DenseMatrix<MT,SO>& lhs, const TSMatSMatMultExpr& rhs )
581  -> DisableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
582  {
584 
585  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
586  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
587 
588  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
589  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
590 
591  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
592  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
593  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
594  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
595  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
596  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
597 
598  TSMatSMatMultExpr::selectAddAssignKernel( ~lhs, A, B );
599  }
601  //**********************************************************************************************
602 
603  //**Default addition assignment to dense matrices***********************************************
617  template< typename MT3 // Type of the left-hand side target matrix
618  , typename MT4 // Type of the left-hand side matrix operand
619  , typename MT5 > // Type of the right-hand side matrix operand
620  static inline void selectAddAssignKernel( MT3& C, const MT4& A, const MT5& B )
621  {
622  for( size_t j=0UL; j<A.columns(); ++j ) {
623  const auto lend( A.end(j) );
624  for( auto lelem=A.begin(j); lelem!=lend; ++lelem ) {
625  const auto rend( B.end(j) );
626  for( auto relem=B.begin(j); relem!=rend; ++relem ) {
627  C(lelem->index(),relem->index()) += lelem->value() * relem->value();
628  }
629  }
630  }
631  }
633  //**********************************************************************************************
634 
635  //**Restructuring addition assignment to row-major matrices*************************************
650  template< typename MT > // Type of the target matrix
651  friend inline auto addAssign( Matrix<MT,false>& lhs, const TSMatSMatMultExpr& rhs )
652  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
653  {
655 
657 
658  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
659  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
660 
661  addAssign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
662  }
664  //**********************************************************************************************
665 
666  //**Restructuring addition assignment to column-major matrices**********************************
681  template< typename MT > // Type of the target matrix
682  friend inline auto addAssign( Matrix<MT,true>& lhs, const TSMatSMatMultExpr& rhs )
683  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
684  {
686 
687  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
688  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
689 
690  addAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
691  }
693  //**********************************************************************************************
694 
695  //**Addition assignment to sparse matrices******************************************************
696  // No special implementation for the addition assignment to sparse matrices.
697  //**********************************************************************************************
698 
699  //**Subtraction assignment to dense matrices****************************************************
712  template< typename MT // Type of the target dense matrix
713  , bool SO > // Storage order of the target dense matrix
714  friend inline void subAssign( DenseMatrix<MT,SO>& lhs, const TSMatSMatMultExpr& rhs )
715  {
717 
718  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
719  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
720 
721  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
722  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
723 
724  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
725  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
726  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
727  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
728  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
729  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
730 
731  TSMatSMatMultExpr::selectSubAssignKernel( ~lhs, A, B );
732  }
734  //**********************************************************************************************
735 
736  //**Default subtraction assignment to dense matrices********************************************
750  template< typename MT3 // Type of the left-hand side target matrix
751  , typename MT4 // Type of the left-hand side matrix operand
752  , typename MT5 > // Type of the right-hand side matrix operand
753  static inline void selectSubAssignKernel( MT3& C, const MT4& A, const MT5& B )
754  {
755  for( size_t j=0UL; j<A.columns(); ++j ) {
756  const auto lend( A.end(j) );
757  for( auto lelem=A.begin(j); lelem!=lend; ++lelem ) {
758  const auto rend( B.end(j) );
759  for( auto relem=B.begin(j); relem!=rend; ++relem ) {
760  C(lelem->index(),relem->index()) -= lelem->value() * relem->value();
761  }
762  }
763  }
764  }
766  //**********************************************************************************************
767 
768  //**Restructuring subtraction assignment to row-major matrices**********************************
783  template< typename MT > // Type of the target matrix
784  friend inline auto subAssign( Matrix<MT,false>& lhs, const TSMatSMatMultExpr& rhs )
785  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
786  {
788 
790 
791  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
792  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
793 
794  subAssign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
795  }
797  //**********************************************************************************************
798 
799  //**Restructuring subtraction assignment to column-major matrices*******************************
814  template< typename MT > // Type of the target matrix
815  friend inline auto subAssign( Matrix<MT,true>& lhs, const TSMatSMatMultExpr& rhs )
816  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
817  {
819 
820  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
821  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
822 
823  subAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
824  }
826  //**********************************************************************************************
827 
828  //**Subtraction assignment to sparse matrices***************************************************
829  // No special implementation for the subtraction assignment to sparse matrices.
830  //**********************************************************************************************
831 
832  //**Schur product assignment to dense matrices**************************************************
845  template< typename MT // Type of the target dense matrix
846  , bool SO > // Storage order of the target dense matrix
847  friend inline void schurAssign( DenseMatrix<MT,SO>& lhs, const TSMatSMatMultExpr& rhs )
848  {
850 
853 
854  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
855  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
856 
857  const ResultType tmp( serial( rhs ) );
858  schurAssign( ~lhs, tmp );
859  }
861  //**********************************************************************************************
862 
863  //**Schur product assignment to sparse matrices*************************************************
864  // No special implementation for the Schur product assignment to sparse matrices.
865  //**********************************************************************************************
866 
867  //**Multiplication assignment to dense matrices*************************************************
868  // No special implementation for the multiplication assignment to dense matrices.
869  //**********************************************************************************************
870 
871  //**Multiplication assignment to sparse matrices************************************************
872  // No special implementation for the multiplication assignment to sparse matrices.
873  //**********************************************************************************************
874 
875  //**SMP assignment to matrices******************************************************************
891  template< typename MT // Type of the target matrix
892  , bool SO > // Storage order of the target matrix
893  friend inline auto smpAssign( Matrix<MT,SO>& lhs, const TSMatSMatMultExpr& rhs )
894  -> EnableIf_t< IsEvaluationRequired_v<MT,MT1,MT2> >
895  {
897 
898  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
899  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
900 
901  CT1 A( rhs.lhs_ ); // Evaluation of the left-hand side sparse matrix operand
902  CT2 B( rhs.rhs_ ); // Evaluation of the right-hand side sparse matrix operand
903 
904  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
905  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
906  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
907  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
908  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
909  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
910 
911  smpAssign( ~lhs, A * B );
912  }
914  //**********************************************************************************************
915 
916  //**Restructuring SMP assignment to row-major matrices******************************************
931  template< typename MT > // Type of the target matrix
932  friend inline auto smpAssign( Matrix<MT,false>& lhs, const TSMatSMatMultExpr& rhs )
933  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
934  {
936 
938 
939  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
940  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
941 
942  smpAssign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
943  }
945  //**********************************************************************************************
946 
947  //**Restructuring SMP assignment to column-major matrices***************************************
962  template< typename MT > // Type of the target matrix
963  friend inline auto smpAssign( Matrix<MT,true>& lhs, const TSMatSMatMultExpr& rhs )
964  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
965  {
967 
968  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
969  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
970 
971  smpAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
972  }
974  //**********************************************************************************************
975 
976  //**SMP addition assignment to dense matrices***************************************************
992  template< typename MT // Type of the target dense matrix
993  , bool SO > // Storage order of the target dense matarix
994  friend inline auto smpAddAssign( DenseMatrix<MT,SO>& lhs, const TSMatSMatMultExpr& rhs )
995  -> EnableIf_t< IsEvaluationRequired_v<MT,MT1,MT2> >
996  {
998 
999  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1000  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1001 
1002  CT1 A( rhs.lhs_ ); // Evaluation of the left-hand side sparse matrix operand
1003  CT2 B( rhs.rhs_ ); // Evaluation of the right-hand side sparse matrix operand
1004 
1005  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
1006  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
1007  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
1008  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
1009  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
1010  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
1011 
1012  smpAddAssign( ~lhs, A * B );
1013  }
1015  //**********************************************************************************************
1016 
1017  //**Restructuring SMP addition assignment to row-major matrices*********************************
1032  template< typename MT > // Type of the target matrix
1033  friend inline auto smpAddAssign( Matrix<MT,false>& lhs, const TSMatSMatMultExpr& rhs )
1034  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
1035  {
1037 
1039 
1040  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1041  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1042 
1043  smpAddAssign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
1044  }
1046  //**********************************************************************************************
1047 
1048  //**Restructuring SMP addition assignment to column-major matrices******************************
1063  template< typename MT > // Type of the target matrix
1064  friend inline auto smpAddAssign( Matrix<MT,true>& lhs, const TSMatSMatMultExpr& rhs )
1065  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
1066  {
1068 
1069  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1070  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1071 
1072  smpAddAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
1073  }
1075  //**********************************************************************************************
1076 
1077  //**SMP addition assignment to sparse matrices**************************************************
1078  // No special implementation for the SMP addition assignment to sparse matrices.
1079  //**********************************************************************************************
1080 
1081  //**SMP subtraction assignment to dense matrices************************************************
1097  template< typename MT // Type of the target dense matrix
1098  , bool SO > // Storage order of the target dense matrix
1099  friend inline auto smpSubAssign( DenseMatrix<MT,SO>& lhs, const TSMatSMatMultExpr& rhs )
1100  -> EnableIf_t< IsEvaluationRequired_v<MT,MT1,MT2> >
1101  {
1103 
1104  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1105  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1106 
1107  CT1 A( rhs.lhs_ ); // Evaluation of the left-hand side sparse matrix operand
1108  CT2 B( rhs.rhs_ ); // Evaluation of the right-hand side sparse matrix operand
1109 
1110  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
1111  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
1112  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
1113  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
1114  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
1115  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
1116 
1117  smpSubAssign( ~lhs, A * B );
1118  }
1120  //**********************************************************************************************
1121 
1122  //**Restructuring SMP subtraction assignment to row-major matrices******************************
1137  template< typename MT > // Type of the target matrix
1138  friend inline auto smpSubAssign( Matrix<MT,false>& lhs, const TSMatSMatMultExpr& rhs )
1139  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
1140  {
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  smpSubAssign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
1149  }
1151  //**********************************************************************************************
1152 
1153  //**Restructuring SMP subtraction assignment to column-major matrices***************************
1168  template< typename MT > // Type of the target matrix
1169  friend inline auto smpSubAssign( Matrix<MT,true>& lhs, const TSMatSMatMultExpr& rhs )
1170  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
1171  {
1173 
1174  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1175  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1176 
1177  smpSubAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
1178  }
1180  //**********************************************************************************************
1181 
1182  //**SMP subtraction assignment to sparse matrices***********************************************
1183  // No special implementation for the SMP subtraction assignment to sparse matrices.
1184  //**********************************************************************************************
1185 
1186  //**SMP Schur product assignment to dense matrices**********************************************
1199  template< typename MT // Type of the target dense matrix
1200  , bool SO > // Storage order of the target dense matrix
1201  friend inline void smpSchurAssign( DenseMatrix<MT,SO>& lhs, const TSMatSMatMultExpr& rhs )
1202  {
1204 
1207 
1208  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1209  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1210 
1211  const ResultType tmp( rhs );
1212  smpSchurAssign( ~lhs, tmp );
1213  }
1215  //**********************************************************************************************
1216 
1217  //**SMP Schur product assignment to sparse matrices*********************************************
1218  // No special implementation for the SMP Schur product assignment to sparse matrices.
1219  //**********************************************************************************************
1220 
1221  //**SMP multiplication assignment to dense matrices*********************************************
1222  // No special implementation for the SMP multiplication assignment to dense matrices.
1223  //**********************************************************************************************
1224 
1225  //**SMP multiplication assignment to sparse matrices********************************************
1226  // No special implementation for the SMP multiplication assignment to sparse matrices.
1227  //**********************************************************************************************
1228 
1229  //**Compile time checks*************************************************************************
1239  //**********************************************************************************************
1240 };
1241 //*************************************************************************************************
1242 
1243 
1244 
1245 
1246 //=================================================================================================
1247 //
1248 // GLOBAL BINARY ARITHMETIC OPERATORS
1249 //
1250 //=================================================================================================
1251 
1252 //*************************************************************************************************
1265 template< typename MT1 // Type of the left-hand side sparse matrix
1266  , typename MT2 // Type of the right-hand side sparse matrix
1267  , DisableIf_t< ( ( IsIdentity_v<MT1> || IsIdentity_v<MT2> ) &&
1268  IsSame_v< ElementType_t<MT1>, ElementType_t<MT2> > ) ||
1269  ( IsIdentity_v<MT1> && IsIdentity_v<MT2> ) ||
1270  ( IsZero_v<MT1> || IsZero_v<MT2> ) >* = nullptr >
1271 inline const TSMatSMatMultExpr<MT1,MT2>
1272  tsmatsmatmult( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,false>& rhs )
1273 {
1275 
1276  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).rows(), "Invalid matrix sizes" );
1277 
1278  return TSMatSMatMultExpr<MT1,MT2>( ~lhs, ~rhs );
1279 }
1281 //*************************************************************************************************
1282 
1283 
1284 //*************************************************************************************************
1298 template< typename MT1 // Type of the left-hand side sparse matrix
1299  , typename MT2 // Type of the right-hand side sparse matrix
1300  , EnableIf_t< !IsIdentity_v<MT1> && IsIdentity_v<MT2> &&
1301  IsSame_v< ElementType_t<MT1>, ElementType_t<MT2> > >* = nullptr >
1302 inline const MT1&
1303  tsmatsmatmult( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,false>& rhs )
1304 {
1306 
1307  MAYBE_UNUSED( rhs );
1308 
1309  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).rows(), "Invalid matrix sizes" );
1310 
1311  return (~lhs);
1312 }
1314 //*************************************************************************************************
1315 
1316 
1317 //*************************************************************************************************
1331 template< typename MT1 // Type of the left-hand side sparse matrix
1332  , typename MT2 // Type of the right-hand side sparse matrix
1333  , EnableIf_t< IsIdentity_v<MT1> && !IsIdentity_v<MT2> &&
1334  IsSame_v< ElementType_t<MT1>, ElementType_t<MT2> > >* = nullptr >
1335 inline const MT2&
1336  tsmatsmatmult( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,false>& rhs )
1337 {
1339 
1340  MAYBE_UNUSED( lhs );
1341 
1342  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).rows(), "Invalid matrix sizes" );
1343 
1344  return (~rhs);
1345 }
1347 //*************************************************************************************************
1348 
1349 
1350 //*************************************************************************************************
1363 template< typename MT1 // Type of the left-hand side sparse matrix
1364  , typename MT2 // Type of the right-hand side sparse matrix
1365  , EnableIf_t< IsIdentity_v<MT1> && IsIdentity_v<MT2> >* = nullptr >
1366 inline decltype(auto)
1367  tsmatsmatmult( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,false>& rhs )
1368 {
1370 
1371  MAYBE_UNUSED( rhs );
1372 
1373  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).rows(), "Invalid matrix sizes" );
1374 
1375  using ReturnType = const MultTrait_t< ResultType_t<MT1>, ResultType_t<MT2> >;
1376 
1379 
1380  return ReturnType( (~lhs).rows() );
1381 }
1383 //*************************************************************************************************
1384 
1385 
1386 //*************************************************************************************************
1400 template< typename MT1 // Type of the left-hand side sparse matrix
1401  , typename MT2 // Type of the right-hand side sparse matrix
1402  , EnableIf_t< IsZero_v<MT1> || IsZero_v<MT2> >* = nullptr >
1403 inline decltype(auto)
1404  tsmatsmatmult( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,false>& rhs )
1405 {
1407 
1408  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).rows(), "Invalid matrix sizes" );
1409 
1410  using ReturnType = const MultTrait_t< ResultType_t<MT1>, ResultType_t<MT2> >;
1411 
1412  BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER( ReturnType, IsZero_v<MT1> );
1413  BLAZE_CONSTRAINT_MUST_BE_ZERO_TYPE( ReturnType );
1414 
1415  return ReturnType( (~lhs).rows(), (~rhs).columns() );
1416 }
1418 //*************************************************************************************************
1419 
1420 
1421 //*************************************************************************************************
1451 template< typename MT1 // Type of the left-hand side sparse matrix
1452  , typename MT2 > // Type of the right-hand side sparse matrix
1453 inline decltype(auto)
1454  operator*( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,false>& rhs )
1455 {
1457 
1458  if( (~lhs).columns() != (~rhs).rows() ) {
1459  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1460  }
1461 
1462  return tsmatsmatmult( ~lhs, ~rhs );
1463 }
1464 //*************************************************************************************************
1465 
1466 } // namespace blaze
1467 
1468 #endif
Constraint on the data type.
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
ResultType_t< MT2 > RT2
Result type of the right-hand side sparse matrix expression.
Definition: TSMatSMatMultExpr.h:113
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
#define BLAZE_CONSTRAINT_MUST_BE_IDENTITY_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not an identity matrix type,...
Definition: Identity.h:60
If_t< IsExpression_v< MT2 >, const MT2, const MT2 & > RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: TSMatSMatMultExpr.h:174
CompositeType_t< MT2 > CT2
Composite type of the right-hand side sparse matrix expression.
Definition: TSMatSMatMultExpr.h:115
Header file for basic type definitions.
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias template for the If class template.The If_t alias template provides a convenient shor...
Definition: If.h:109
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: TSMatSMatMultExpr.h:204
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
Header file for the serial shim.
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
Header file for the IsDiagonal type trait.
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
Header file for the IsColumnMajorMatrix type trait.
LeftOperand leftOperand() const noexcept
Returns the left-hand side transpose sparse matrix operand.
Definition: TSMatSMatMultExpr.h:311
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
Constraint on the data type.
decltype(auto) subvector(Vector< VT, TF > &, RSAs...)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:154
Header file for the MAYBE_UNUSED function template.
Header file for the IsIdentity type trait.
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSMatSMatMultExpr.h:168
Header file for the Computation base class.
Header file for the MatMatMultExpr base class.
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: TSMatSMatMultExpr.h:253
Constraints on the storage order of matrix types.
Header file for the RequiresEvaluation type trait.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes....
Definition: DenseMatrix.h:81
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes....
Definition: Forward.h:145
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
Header file for the SparseMatrix base class.
Constraint on the data type.
RightOperand rightOperand() const noexcept
Returns the right-hand side sparse matrix operand.
Definition: TSMatSMatMultExpr.h:321
static constexpr bool evaluateLeft
Compilation switch for the composite type of the left-hand side sparse matrix expression.
Definition: TSMatSMatMultExpr.h:120
constexpr bool IsResizable_v
Auxiliary variable template for the IsResizable type trait.The IsResizable_v variable template provid...
Definition: IsResizable.h:133
Headerfile for the generic max algorithm.
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: TSMatSMatMultExpr.h:179
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: TSMatSMatMultExpr.h:164
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: TSMatSMatMultExpr.h:355
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: ColumnMajorMatrix.h:61
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: TSMatSMatMultExpr.h:269
#define BLAZE_CONSTRAINT_MUST_BE_ZERO_TYPE(T)
Constraint on the data type.In case the given data type T is not a zero vector or matrix type,...
Definition: Zero.h:61
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1162
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TSMatSMatMultExpr.h:165
Header file for the IsLower type trait.
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: TSMatSMatMultExpr.h:279
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TSMatSMatMultExpr.h:345
Header file for the IsTriangular type trait.
Header file for the exception macros of the math module.
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1198
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TSMatSMatMultExpr.h:167
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:438
Constraint on the data type.
constexpr size_t nonZeros() const noexcept
Returns the number of non-zero elements in the sparse matrix.
Definition: TSMatSMatMultExpr.h:289
MultTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: TSMatSMatMultExpr.h:163
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
CompositeType_t< MT1 > CT1
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatSMatMultExpr.h:114
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_MATMATMULTEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid matrix/matrix ...
Definition: MatMatMultExpr.h:103
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.The MultTrait_t alias declaration provid...
Definition: MultTrait.h:240
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.The OppositeType_t alias declaration provi...
Definition: Aliases.h:270
#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,...
Definition: Symmetric.h:79
TSMatSMatMultExpr(const MT1 &lhs, const MT2 &rhs) noexcept
Constructor for the TSMatSMatMultExpr class.
Definition: TSMatSMatMultExpr.h:189
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: RowMajorMatrix.h:61
If_t< IsExpression_v< MT1 >, const MT1, const MT1 & > LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatSMatMultExpr.h:171
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
Header file for run time assertion macros.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TSMatSMatMultExpr.h:333
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
ResultType_t< MT1 > RT1
Result type of the left-hand side sparse matrix expression.
Definition: TSMatSMatMultExpr.h:112
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
Header file for the IsZero type trait.
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
Header file for all forward declarations for expression class templates.
Header file for the isDefault shim.
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
Constraint on the data type.
Constraints on the storage order of matrix types.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
auto smpSchurAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP Schur product assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:194
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
Expression object for transpose sparse matrix-sparse matrix multiplications.The TSMatSMatMultExpr cla...
Definition: Forward.h:184
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
size_t nonZeros(size_t i) const noexcept
Returns the number of non-zero elements in the specified row.
Definition: TSMatSMatMultExpr.h:300
Header file for the IsRowMajorMatrix type trait.
LeftOperand lhs_
Left-hand side sparse matrix of the multiplication expression.
Definition: TSMatSMatMultExpr.h:362
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: TSMatSMatMultExpr.h:166
Header file for the IsComputation type trait class.
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
Header file for the IntegralConstant class template.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
static constexpr bool evaluateRight
Compilation switch for the composite type of the right-hand side sparse matrix expression.
Definition: TSMatSMatMultExpr.h:125
Header file for the IsUpper type trait.
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
Constraint on the data type.
RightOperand rhs_
Right-hand side sparse matrix of the multiplication expression.
Definition: TSMatSMatMultExpr.h:363
Header file for the IsResizable type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ZERO_TYPE(T)
Constraint on the data type.In case the given data type T is a zero vector or matrix type,...
Definition: Zero.h:81
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
constexpr bool IsSame_v
Auxiliary variable template for the IsSame type trait.The IsSame_v variable template provides a conve...
Definition: IsSame.h:159
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type,...
Definition: SparseMatrix.h:61
Header file for the IsExpression type trait class.
Header file for the function trace functionality.