TSMatTSMatMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_TSMATTSMATMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_TSMATTSMATMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <algorithm>
44 #include <blaze/math/Aliases.h>
52 #include <blaze/math/Exception.h>
57 #include <blaze/math/Infinity.h>
59 #include <blaze/math/shims/Reset.h>
76 #include <blaze/math/views/Check.h>
80 #include <blaze/util/Assert.h>
81 #include <blaze/util/DisableIf.h>
82 #include <blaze/util/EnableIf.h>
85 #include <blaze/util/mpl/If.h>
86 #include <blaze/util/SmallArray.h>
87 #include <blaze/util/Types.h>
89 #include <blaze/util/Unused.h>
90 
91 
92 namespace blaze {
93 
94 //=================================================================================================
95 //
96 // CLASS TSMATTSMATMULTEXPR
97 //
98 //=================================================================================================
99 
100 //*************************************************************************************************
107 template< typename MT1 // Type of the left-hand side sparse matrix
108  , typename MT2 > // Type of the right-hand side sparse matrix
109 class TSMatTSMatMultExpr
110  : public MatMatMultExpr< SparseMatrix< TSMatTSMatMultExpr<MT1,MT2>, true > >
111  , private Computation
112 {
113  private:
114  //**Type definitions****************************************************************************
119  //**********************************************************************************************
120 
121  //**********************************************************************************************
123  static constexpr bool evaluateLeft = RequiresEvaluation_v<MT1>;
124  //**********************************************************************************************
125 
126  //**********************************************************************************************
128  static constexpr bool evaluateRight = RequiresEvaluation_v<MT2>;
129  //**********************************************************************************************
130 
131  //**********************************************************************************************
133 
138  template< typename T1, typename T2, typename T3 >
139  static constexpr bool CanExploitSymmetry_v =
140  ( IsRowMajorMatrix_v<T1> && IsSymmetric_v<T2> && IsSymmetric_v<T3> );
142  //**********************************************************************************************
143 
144  //**********************************************************************************************
146 
150  template< typename T1, typename T2, typename T3 >
151  static constexpr bool IsEvaluationRequired_v =
152  ( ( evaluateLeft || evaluateRight ) && !CanExploitSymmetry_v<T1,T2,T3> );
154  //**********************************************************************************************
155 
156  public:
157  //**Type definitions****************************************************************************
164  using ReturnType = const ElementType;
165  using CompositeType = const ResultType;
166 
168  using LeftOperand = If_t< IsExpression_v<MT1>, const MT1, const MT1& >;
169 
171  using RightOperand = If_t< IsExpression_v<MT2>, const MT2, const MT2& >;
172  //**********************************************************************************************
173 
174  //**Compilation flags***************************************************************************
176  static constexpr bool smpAssignable =
178  //**********************************************************************************************
179 
180  //**Constructor*********************************************************************************
186  explicit inline TSMatTSMatMultExpr( const MT1& lhs, const MT2& rhs ) noexcept
187  : lhs_( lhs ) // Left-hand side sparse matrix of the multiplication expression
188  , rhs_( rhs ) // Right-hand side sparse matrix of the multiplication expression
189  {
190  BLAZE_INTERNAL_ASSERT( lhs.columns() == rhs.rows(), "Invalid matrix sizes" );
191  }
192  //**********************************************************************************************
193 
194  //**Access operator*****************************************************************************
201  inline ReturnType operator()( size_t i, size_t j ) const {
202  BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
203  BLAZE_INTERNAL_ASSERT( j < rhs_.columns(), "Invalid column access index" );
204 
205  if( IsDiagonal_v<MT1> ) {
206  return lhs_(i,i) * rhs_(i,j);
207  }
208  else if( IsDiagonal_v<MT2> ) {
209  return lhs_(i,j) * rhs_(j,j);
210  }
211  else if( IsTriangular_v<MT1> || IsTriangular_v<MT2> ) {
212  const size_t begin( ( IsUpper_v<MT1> )
213  ?( ( IsLower_v<MT2> )
214  ?( max( ( IsStrictlyUpper_v<MT1> ? i+1UL : i )
215  , ( IsStrictlyLower_v<MT2> ? j+1UL : j ) ) )
216  :( IsStrictlyUpper_v<MT1> ? i+1UL : i ) )
217  :( ( IsLower_v<MT2> )
218  ?( IsStrictlyLower_v<MT2> ? j+1UL : j )
219  :( 0UL ) ) );
220  const size_t end( ( IsLower_v<MT1> )
221  ?( ( IsUpper_v<MT2> )
222  ?( min( ( IsStrictlyLower_v<MT1> ? i : i+1UL )
223  , ( IsStrictlyUpper_v<MT2> ? j : j+1UL ) ) )
224  :( IsStrictlyLower_v<MT1> ? i : i+1UL ) )
225  :( ( IsUpper_v<MT2> )
226  ?( IsStrictlyUpper_v<MT2> ? j : j+1UL )
227  :( lhs_.columns() ) ) );
228 
229  if( begin >= end ) return ElementType();
230 
231  const size_t n( end - begin );
232 
233  return subvector( row( lhs_, i, unchecked ), begin, n, unchecked ) *
234  subvector( column( rhs_, j, unchecked ), begin, n, unchecked );
235  }
236  else {
237  return row( lhs_, i, unchecked ) * column( rhs_, j, unchecked );
238  }
239  }
240  //**********************************************************************************************
241 
242  //**At function*********************************************************************************
250  inline ReturnType at( size_t i, size_t j ) const {
251  if( i >= lhs_.rows() ) {
252  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
253  }
254  if( j >= rhs_.columns() ) {
255  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
256  }
257  return (*this)(i,j);
258  }
259  //**********************************************************************************************
260 
261  //**Rows function*******************************************************************************
266  inline size_t rows() const noexcept {
267  return lhs_.rows();
268  }
269  //**********************************************************************************************
270 
271  //**Columns function****************************************************************************
276  inline size_t columns() const noexcept {
277  return rhs_.columns();
278  }
279  //**********************************************************************************************
280 
281  //**NonZeros function***************************************************************************
286  inline constexpr size_t nonZeros() const noexcept {
287  return 0UL;
288  }
289  //**********************************************************************************************
290 
291  //**NonZeros function***************************************************************************
297  inline size_t nonZeros( size_t i ) const noexcept {
298  UNUSED_PARAMETER( i );
299  return 0UL;
300  }
301  //**********************************************************************************************
302 
303  //**Left operand access*************************************************************************
308  inline LeftOperand leftOperand() const noexcept {
309  return lhs_;
310  }
311  //**********************************************************************************************
312 
313  //**Right operand access************************************************************************
318  inline RightOperand rightOperand() const noexcept {
319  return rhs_;
320  }
321  //**********************************************************************************************
322 
323  //**********************************************************************************************
329  template< typename T >
330  inline bool canAlias( const T* alias ) const noexcept {
331  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
332  }
333  //**********************************************************************************************
334 
335  //**********************************************************************************************
341  template< typename T >
342  inline bool isAliased( const T* alias ) const noexcept {
343  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
344  }
345  //**********************************************************************************************
346 
347  //**********************************************************************************************
352  inline bool canSMPAssign() const noexcept {
353  return ( rows() * columns() >= SMP_TSMATTSMATMULT_THRESHOLD );
354  }
355  //**********************************************************************************************
356 
357  private:
358  //**Member variables****************************************************************************
361  //**********************************************************************************************
362 
363  //**Assignment to dense matrices****************************************************************
376  template< typename MT // Type of the target dense matrix
377  , bool SO > // Storage order of the target dense matrix
378  friend inline auto assign( DenseMatrix<MT,SO>& lhs, const TSMatTSMatMultExpr& rhs )
380  {
382 
383  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
384  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
385 
386  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
387  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
388 
389  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
390  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
391  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
392  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
393  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
394  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
395 
396  TSMatTSMatMultExpr::selectAssignKernel( ~lhs, A, B );
397  }
399  //**********************************************************************************************
400 
401  //**Default assignment to dense matrices********************************************************
415  template< typename MT3 // Type of the left-hand side target matrix
416  , typename MT4 // Type of the left-hand side matrix operand
417  , typename MT5 > // Type of the right-hand side matrix operand
418  static inline void selectAssignKernel( MT3& C, const MT4& A, const MT5& B )
419  {
420  for( size_t j=0UL; j<C.columns(); ++j ) {
421  const auto rend( B.end(j) );
422  for( auto relem=B.begin(j); relem!=rend; ++relem ) {
423  const auto lend( A.end( relem->index() ) );
424  for( auto lelem=A.begin( relem->index() ); lelem!=lend; ++lelem )
425  {
427  isDefault( C(lelem->index(),j) ) ) {
428  C(lelem->index(),j) = lelem->value() * relem->value();
429  }
430  else {
431  C(lelem->index(),j) += lelem->value() * relem->value();
432  }
433  }
434  }
435  }
436  }
438  //**********************************************************************************************
439 
440  //**Assignment to row-major sparse matrices*****************************************************
453  template< typename MT > // Type of the target sparse matrix
454  friend inline auto assign( SparseMatrix<MT,false>& lhs, const TSMatTSMatMultExpr& rhs )
455  -> DisableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
456  {
458 
460 
461  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
462  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
463 
466 
467  const ResultType tmp( serial( rhs ) );
468  (~lhs).reserve( tmp.nonZeros() );
469  assign( ~lhs, tmp );
470  }
472  //**********************************************************************************************
473 
474  //**Assignment to column-major sparse matrices**************************************************
487  template< typename MT > // Type of the target sparse matrix
488  friend inline void assign( SparseMatrix<MT,true>& lhs, const TSMatTSMatMultExpr& rhs )
489  {
491 
492  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
493  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
494 
495  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
496  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
497 
498  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
499  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
500  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
501  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
502  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
503  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
504 
505  // (Over-)Estimating the number of non-zero entries in the resulting matrix
506  size_t nonzeros( 0UL );
507 
508  for( size_t j=0UL; j<(~lhs).columns(); ++j ) {
509  const auto rend( B.end(j) );
510  for( auto relem=B.begin(j); relem!=rend; ++relem ) {
511  nonzeros += A.nonZeros( relem->index() );
512  }
513  }
514 
515  if( nonzeros > (~lhs).rows() * (~lhs).columns() ) {
516  nonzeros = (~lhs).rows() * (~lhs).columns();
517  }
518 
519  (~lhs).reserve( nonzeros );
520  nonzeros = 0UL;
521 
522  // Performing the matrix-matrix multiplication
523  SmallArray<ElementType,128UL> values ( (~lhs).rows(), ElementType() );
524  SmallArray<bool,128UL> valid ( (~lhs).rows(), false );
525  SmallArray<size_t,128UL> indices( (~lhs).rows(), 0UL );
526  size_t minIndex( inf ), maxIndex( 0UL );
527 
528  for( size_t j=0UL; j<(~lhs).columns(); ++j )
529  {
530  const auto rend( B.end(j) );
531  for( auto relem=B.begin(j); relem!=rend; ++relem )
532  {
533  const auto lend( A.end( relem->index() ) );
534  for( auto lelem=A.begin( relem->index() ); lelem!=lend; ++lelem )
535  {
536  if( !valid[lelem->index()] ) {
537  values[lelem->index()] = lelem->value() * relem->value();
538  valid [lelem->index()] = true;
539  indices[nonzeros] = lelem->index();
540  ++nonzeros;
541  if( lelem->index() < minIndex ) minIndex = lelem->index();
542  if( lelem->index() > maxIndex ) maxIndex = lelem->index();
543  }
544  else {
545  values[lelem->index()] += lelem->value() * relem->value();
546  }
547  }
548  }
549 
550  BLAZE_INTERNAL_ASSERT( nonzeros <= (~lhs).rows(), "Invalid number of non-zero elements" );
551 
552  if( nonzeros > 0UL )
553  {
554  BLAZE_INTERNAL_ASSERT( minIndex <= maxIndex, "Invalid index detected" );
555 
556  if( ( nonzeros + nonzeros ) < ( maxIndex - minIndex ) )
557  {
558  std::sort( indices.begin(), indices.begin() + nonzeros );
559 
560  for( size_t i=0UL; i<nonzeros; ++i )
561  {
562  const size_t index( indices[i] );
563  if( !isDefault( values[index] ) ) {
564  (~lhs).append( index, j, values[index] );
565  reset( values[index] );
566  }
567 
568  reset( valid[index] );
569  }
570  }
571  else {
572  for( size_t i=minIndex; i<=maxIndex; ++i )
573  {
574  if( !isDefault( values[i] ) ) {
575  (~lhs).append( i, j, values[i] );
576  reset( values[i] );
577  }
578 
579  reset( valid[i] );
580  }
581  }
582 
583  nonzeros = 0UL;
584  minIndex = inf;
585  maxIndex = 0UL;
586  }
587 
588  (~lhs).finalize( j );
589  }
590  }
592  //**********************************************************************************************
593 
594  //**Restructuring assignment to row-major matrices**********************************************
609  template< typename MT > // Type of the target matrix
610  friend inline auto assign( Matrix<MT,false>& lhs, const TSMatTSMatMultExpr& rhs )
611  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
612  {
614 
616 
617  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
618  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
619 
620  assign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
621  }
623  //**********************************************************************************************
624 
625  //**Addition assignment to dense matrices*******************************************************
638  template< typename MT // Type of the target dense matrix
639  , bool SO > // Storage order of the target dense matarix
640  friend inline auto addAssign( DenseMatrix<MT,SO>& lhs, const TSMatTSMatMultExpr& rhs )
641  -> DisableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
642  {
644 
645  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
646  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
647 
648  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
649  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
650 
651  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
652  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
653  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
654  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
655  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
656  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
657 
658  TSMatTSMatMultExpr::selectAddAssignKernel( ~lhs, A, B );
659  }
661  //**********************************************************************************************
662 
663  //**Default addition assignment to dense matrices***********************************************
677  template< typename MT3 // Type of the left-hand side target matrix
678  , typename MT4 // Type of the left-hand side matrix operand
679  , typename MT5 > // Type of the right-hand side matrix operand
680  static inline void selectAddAssignKernel( MT3& C, const MT4& A, const MT5& B )
681  {
682  for( size_t j=0UL; j<C.columns(); ++j ) {
683  const auto rend( B.end(j) );
684  for( auto relem=B.begin(j); relem!=rend; ++relem ) {
685  const auto lend( A.end( relem->index() ) );
686  for( auto lelem=A.begin( relem->index() ); lelem!=lend; ++lelem ) {
687  C(lelem->index(),j) += lelem->value() * relem->value();
688  }
689  }
690  }
691  }
693  //**********************************************************************************************
694 
695  //**Restructuring addition assignment to row-major matrices*************************************
710  template< typename MT > // Type of the target matrix
711  friend inline auto addAssign( Matrix<MT,false>& lhs, const TSMatTSMatMultExpr& rhs )
712  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
713  {
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  addAssign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
722  }
724  //**********************************************************************************************
725 
726  //**Addition assignment to sparse matrices******************************************************
727  // No special implementation for the addition assignment to sparse matrices.
728  //**********************************************************************************************
729 
730  //**Subtraction assignment to dense matrices****************************************************
743  template< typename MT // Type of the target dense matrix
744  , bool SO > // Storage order of the target dense matarix
745  friend inline auto subAssign( DenseMatrix<MT,SO>& lhs, const TSMatTSMatMultExpr& rhs )
746  -> DisableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
747  {
749 
750  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
751  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
752 
753  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
754  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
755 
756  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
757  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
758  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
759  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
760  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
761  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
762 
763  TSMatTSMatMultExpr::selectSubAssignKernel( ~lhs, A, B );
764  }
766  //**********************************************************************************************
767 
768  //**Default subtraction assignment to dense matrices********************************************
782  template< typename MT3 // Type of the left-hand side target matrix
783  , typename MT4 // Type of the left-hand side matrix operand
784  , typename MT5 > // Type of the right-hand side matrix operand
785  static inline void selectSubAssignKernel( MT3& C, const MT4& A, const MT5& B )
786  {
787  for( size_t j=0UL; j<C.columns(); ++j ) {
788  const auto rend( B.end(j) );
789  for( auto relem=B.begin(j); relem!=rend; ++relem ) {
790  const auto lend( A.end( relem->index() ) );
791  for( auto lelem=A.begin( relem->index() ); lelem!=lend; ++lelem ) {
792  C(lelem->index(),j) -= lelem->value() * relem->value();
793  }
794  }
795  }
796  }
798  //**********************************************************************************************
799 
800  //**Restructuring subtraction assignment to row-major matrices**********************************
816  template< typename MT > // Type of the target matrix
817  friend inline auto subAssign( Matrix<MT,false>& lhs, const TSMatTSMatMultExpr& rhs )
818  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
819  {
821 
823 
824  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
825  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
826 
827  subAssign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
828  }
830  //**********************************************************************************************
831 
832  //**Subtraction assignment to sparse matrices***************************************************
833  // No special implementation for the subtraction assignment to sparse matrices.
834  //**********************************************************************************************
835 
836  //**Schur product assignment to dense matrices**************************************************
849  template< typename MT // Type of the target dense matrix
850  , bool SO > // Storage order of the target dense matarix
851  friend inline void schurAssign( DenseMatrix<MT,SO>& lhs, const TSMatTSMatMultExpr& rhs )
852  {
854 
858 
859  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
860  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
861 
862  const ResultType tmp( serial( rhs ) );
863  schurAssign( ~lhs, tmp );
864  }
866  //**********************************************************************************************
867 
868  //**Schur product assignment to sparse matrices*************************************************
869  // No special implementation for the Schur product assignment to sparse matrices.
870  //**********************************************************************************************
871 
872  //**Multiplication assignment to dense matrices*************************************************
873  // No special implementation for the multiplication assignment to dense matrices.
874  //**********************************************************************************************
875 
876  //**Multiplication assignment to sparse matrices************************************************
877  // No special implementation for the multiplication assignment to sparse matrices.
878  //**********************************************************************************************
879 
880  //**SMP assignment to matrices******************************************************************
896  template< typename MT // Type of the target matrix
897  , bool SO > // Storage order of the target matrix
898  friend inline auto smpAssign( Matrix<MT,SO>& lhs, const TSMatTSMatMultExpr& rhs )
899  -> EnableIf_t< IsEvaluationRequired_v<MT,MT1,MT2> >
900  {
902 
903  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
904  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
905 
906  CT1 A( rhs.lhs_ ); // Evaluation of the left-hand side sparse matrix operand
907  CT2 B( rhs.rhs_ ); // Evaluation of the right-hand side sparse matrix operand
908 
909  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
910  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
911  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
912  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
913  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
914  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
915 
916  smpAssign( ~lhs, A * B );
917  }
919  //**********************************************************************************************
920 
921  //**Restructuring SMP assignment to row-major matrices******************************************
936  template< typename MT > // Type of the target matrix
937  friend inline auto smpAssign( Matrix<MT,false>& lhs, const TSMatTSMatMultExpr& rhs )
938  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
939  {
941 
943 
944  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
945  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
946 
947  smpAssign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
948  }
950  //**********************************************************************************************
951 
952  //**SMP addition assignment to dense matrices***************************************************
968  template< typename MT // Type of the target dense matrix
969  , bool SO > // Storage order of the target dense matarix
970  friend inline auto smpAddAssign( DenseMatrix<MT,SO>& lhs, const TSMatTSMatMultExpr& rhs )
971  -> EnableIf_t< IsEvaluationRequired_v<MT,MT1,MT2> >
972  {
974 
975  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
976  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
977 
978  CT1 A( rhs.lhs_ ); // Evaluation of the left-hand side sparse matrix operand
979  CT2 B( rhs.rhs_ ); // Evaluation of the right-hand side sparse matrix operand
980 
981  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
982  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
983  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
984  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
985  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
986  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
987 
988  smpAddAssign( ~lhs, A * B );
989  }
991  //**********************************************************************************************
992 
993  //**Restructuring SMP addition assignment to row-major matrices*********************************
1009  template< typename MT > // Type of the target matrix
1010  friend inline auto smpAddAssign( Matrix<MT,false>& lhs, const TSMatTSMatMultExpr& rhs )
1011  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
1012  {
1014 
1016 
1017  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1018  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1019 
1020  smpAddAssign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
1021  }
1023  //**********************************************************************************************
1024 
1025  //**SMP addition assignment to sparse matrices**************************************************
1026  // No special implementation for the SMP addition assignment to sparse matrices.
1027  //**********************************************************************************************
1028 
1029  //**SMP subtraction assignment to dense matrices************************************************
1045  template< typename MT // Type of the target dense matrix
1046  , bool SO > // Storage order of the target dense matarix
1047  friend inline auto smpSubAssign( DenseMatrix<MT,SO>& lhs, const TSMatTSMatMultExpr& rhs )
1048  -> EnableIf_t< IsEvaluationRequired_v<MT,MT1,MT2> >
1049  {
1051 
1052  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1053  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1054 
1055  CT1 A( rhs.lhs_ ); // Evaluation of the left-hand side sparse matrix operand
1056  CT2 B( rhs.rhs_ ); // Evaluation of the right-hand side sparse matrix operand
1057 
1058  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
1059  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
1060  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
1061  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
1062  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
1063  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
1064 
1065  smpSubAssign( ~lhs, A * B );
1066  }
1068  //**********************************************************************************************
1069 
1070  //**Restructuring SMP subtraction assignment to row-major matrices******************************
1086  template< typename MT > // Type of the target matrix
1087  friend inline auto smpSubAssign( Matrix<MT,false>& lhs, const TSMatTSMatMultExpr& rhs )
1088  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
1089  {
1091 
1093 
1094  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1095  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1096 
1097  smpSubAssign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
1098  }
1100  //**********************************************************************************************
1101 
1102  //**SMP subtraction assignment to sparse matrices***********************************************
1103  // No special implementation for the SMP subtraction assignment to sparse matrices.
1104  //**********************************************************************************************
1105 
1106  //**SMP Schur product assignment to dense matrices**********************************************
1119  template< typename MT // Type of the target dense matrix
1120  , bool SO > // Storage order of the target dense matarix
1121  friend inline void smpSchurAssign( DenseMatrix<MT,SO>& lhs, const TSMatTSMatMultExpr& rhs )
1122  {
1124 
1128 
1129  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1130  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1131 
1132  const ResultType tmp( rhs );
1133  smpSchurAssign( ~lhs, tmp );
1134  }
1136  //**********************************************************************************************
1137 
1138  //**SMP Schur product assignment to sparse matrices*********************************************
1139  // No special implementation for the SMP Schur product assignment to sparse matrices.
1140  //**********************************************************************************************
1141 
1142  //**SMP multiplication assignment to dense matrices*********************************************
1143  // No special implementation for the SMP multiplication assignment to dense matrices.
1144  //**********************************************************************************************
1145 
1146  //**SMP multiplication assignment to sparse matrices********************************************
1147  // No special implementation for the SMP multiplication assignment to sparse matrices.
1148  //**********************************************************************************************
1149 
1150  //**Compile time checks*************************************************************************
1160  //**********************************************************************************************
1161 };
1162 //*************************************************************************************************
1163 
1164 
1165 
1166 
1167 //=================================================================================================
1168 //
1169 // GLOBAL BINARY ARITHMETIC OPERATORS
1170 //
1171 //=================================================================================================
1172 
1173 //*************************************************************************************************
1186 template< typename MT1 // Type of the left-hand side sparse matrix
1187  , typename MT2 // Type of the right-hand side sparse matrix
1188  , DisableIf_t< ( ( IsIdentity_v<MT1> || IsIdentity_v<MT2> ) &&
1189  IsSame_v< ElementType_t<MT1>, ElementType_t<MT2> > ) ||
1190  ( IsIdentity_v<MT1> && IsIdentity_v<MT2> ) ||
1191  ( IsZero_v<MT1> || IsZero_v<MT2> ) >* = nullptr >
1192 inline const TSMatTSMatMultExpr<MT1,MT2>
1193  tsmattsmatmult( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,true>& rhs )
1194 {
1196 
1197  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).rows(), "Invalid matrix sizes" );
1198 
1199  return TSMatTSMatMultExpr<MT1,MT2>( ~lhs, ~rhs );
1200 }
1202 //*************************************************************************************************
1203 
1204 
1205 //*************************************************************************************************
1219 template< typename MT1 // Type of the left-hand side sparse matrix
1220  , typename MT2 // Type of the right-hand side sparse matrix
1221  , EnableIf_t< !IsIdentity_v<MT1> && IsIdentity_v<MT2> &&
1222  IsSame_v< ElementType_t<MT1>, ElementType_t<MT2> > >* = nullptr >
1223 inline const MT1&
1224  tsmattsmatmult( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,true>& rhs )
1225 {
1227 
1228  UNUSED_PARAMETER( rhs );
1229 
1230  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).rows(), "Invalid matrix sizes" );
1231 
1232  return (~lhs);
1233 }
1235 //*************************************************************************************************
1236 
1237 
1238 //*************************************************************************************************
1252 template< typename MT1 // Type of the left-hand side sparse matrix
1253  , typename MT2 // Type of the right-hand side sparse matrix
1254  , EnableIf_t< IsIdentity_v<MT1> && !IsIdentity_v<MT2> &&
1255  IsSame_v< ElementType_t<MT1>, ElementType_t<MT2> > >* = nullptr >
1256 inline const MT2&
1257  tsmattsmatmult( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,true>& rhs )
1258 {
1260 
1261  UNUSED_PARAMETER( lhs );
1262 
1263  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).rows(), "Invalid matrix sizes" );
1264 
1265  return (~rhs);
1266 }
1268 //*************************************************************************************************
1269 
1270 
1271 //*************************************************************************************************
1284 template< typename MT1 // Type of the left-hand side sparse matrix
1285  , typename MT2 // Type of the right-hand side sparse matrix
1286  , EnableIf_t< IsIdentity_v<MT1> && IsIdentity_v<MT2> >* = nullptr >
1287 inline decltype(auto)
1288  tsmattsmatmult( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,true>& rhs )
1289 {
1291 
1292  UNUSED_PARAMETER( rhs );
1293 
1294  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).rows(), "Invalid matrix sizes" );
1295 
1296  using ReturnType = const MultTrait_t< ResultType_t<MT1>, ResultType_t<MT2> >;
1297 
1300 
1301  return ReturnType( (~lhs).rows() );
1302 }
1304 //*************************************************************************************************
1305 
1306 
1307 //*************************************************************************************************
1321 template< typename MT1 // Type of the left-hand side sparse matrix
1322  , typename MT2 // Type of the right-hand side sparse matrix
1323  , EnableIf_t< IsZero_v<MT1> || IsZero_v<MT2> >* = nullptr >
1324 inline decltype(auto)
1325  tsmattsmatmult( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,true>& rhs )
1326 {
1328 
1329  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).rows(), "Invalid matrix sizes" );
1330 
1331  using ReturnType = const MultTrait_t< ResultType_t<MT1>, ResultType_t<MT2> >;
1332 
1335 
1336  return ReturnType( (~lhs).rows(), (~rhs).columns() );
1337 }
1339 //*************************************************************************************************
1340 
1341 
1342 //*************************************************************************************************
1369 template< typename MT1 // Type of the left-hand side sparse matrix
1370  , typename MT2 > // Type of the right-hand side sparse matrix
1371 inline decltype(auto)
1372  operator*( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,true>& rhs )
1373 {
1375 
1376  if( (~lhs).columns() != (~rhs).rows() ) {
1377  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1378  }
1379 
1380  return tsmattsmatmult( ~lhs, ~rhs );
1381 }
1382 //*************************************************************************************************
1383 
1384 } // namespace blaze
1385 
1386 #endif
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:329
#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.
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
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: TSMatTSMatMultExpr.h:266
Header file for the UNUSED_PARAMETER function template.
TSMatTSMatMultExpr(const MT1 &lhs, const MT2 &rhs) noexcept
Constructor for the TSMatTSMatMultExpr class.
Definition: TSMatTSMatMultExpr.h:186
Header file for basic type definitions.
static constexpr bool evaluateLeft
Compilation switch for the composite type of the left-hand side sparse matrix expression.
Definition: TSMatTSMatMultExpr.h:123
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias declaration for the If class template.The If_t alias declaration provides a convenien...
Definition: If.h:109
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TSMatTSMatMultExpr.h:164
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.
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
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
LeftOperand leftOperand() const noexcept
Returns the left-hand side transpose sparse matrix operand.
Definition: TSMatTSMatMultExpr.h:308
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.
Header file for the IsIdentity type trait.
Header file for the Computation base class.
Header file for the MatMatMultExpr base class.
Header file for the reset shim.
Header file for the RequiresEvaluation type trait.
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
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:80
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:137
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: TSMatTSMatMultExpr.h:352
Header file for the SparseMatrix base class.
Constraint on the data type.
CompositeType_t< MT1 > CT1
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatTSMatMultExpr.h:117
Headerfile for the generic max algorithm.
Header file for the DisableIf class template.
Header file for the SmallArray implementation.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: TSMatTSMatMultExpr.h:176
constexpr bool IsResizable_v
Auxiliary variable template for the IsResizable type trait.The IsResizable_v variable template provid...
Definition: IsResizable.h:134
constexpr size_t nonZeros() const noexcept
Returns the number of non-zero elements in the sparse matrix.
Definition: TSMatTSMatMultExpr.h:286
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
static constexpr bool evaluateRight
Compilation switch for the composite type of the right-hand side sparse matrix expression.
Definition: TSMatTSMatMultExpr.h:128
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: TSMatTSMatMultExpr.h:276
If_t< IsExpression_v< MT2 >, const MT2, const MT2 &> RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: TSMatTSMatMultExpr.h:171
#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
MultTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: TSMatTSMatMultExpr.h:160
#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:1147
#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
Numerical infinity for built-in data types.
RightOperand rhs_
Right-hand side sparse matrix of the multiplication expression.
Definition: TSMatTSMatMultExpr.h:360
Expression object for transpose sparse matrix-transpose sparse matrix multiplications.The TSMatTSMatMultExpr class represents the compile time expression for multiplications between two column-major sparse matrices.
Definition: Forward.h:179
Header file for the IsLower type trait.
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: TSMatTSMatMultExpr.h:161
LeftOperand lhs_
Left-hand side sparse matrix of the multiplication expression.
Definition: TSMatTSMatMultExpr.h:359
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: TSMatTSMatMultExpr.h:250
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:1179
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.
Header file for all forward declarations for expression class templates.
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TSMatTSMatMultExpr.h:162
ResultType_t< MT1 > RT1
Result type of the left-hand side sparse matrix expression.
Definition: TSMatTSMatMultExpr.h:115
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
#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
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TSMatTSMatMultExpr.h:330
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
size_t nonZeros(size_t i) const noexcept
Returns the number of non-zero elements in the specified row.
Definition: TSMatTSMatMultExpr.h:297
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
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
If_t< IsExpression_v< MT1 >, const MT1, const MT1 &> LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatTSMatMultExpr.h:168
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
RightOperand rightOperand() const noexcept
Returns the right-hand side transpose sparse matrix operand.
Definition: TSMatTSMatMultExpr.h:318
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TSMatTSMatMultExpr.h:342
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 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
ResultType_t< MT2 > RT2
Result type of the right-hand side sparse matrix expression.
Definition: TSMatTSMatMultExpr.h:116
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSMatTSMatMultExpr.h:165
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
Header file for the IsRowMajorMatrix type trait.
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
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
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: TSMatTSMatMultExpr.h:201
Header file for the IntegralConstant class template.
constexpr Infinity inf
Global Infinity instance.The blaze::inf instance can be used wherever a built-in data type is expecte...
Definition: Infinity.h:1080
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: TSMatTSMatMultExpr.h:163
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.
CompositeType_t< MT2 > CT2
Composite type of the right-hand side sparse matrix expression.
Definition: TSMatTSMatMultExpr.h:118
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:161
#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
#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.