Blaze  3.6
SMatSMatMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATSMATMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATSMATMULTEXPR_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/MaybeUnused.h>
86 #include <blaze/util/mpl/If.h>
87 #include <blaze/util/SmallArray.h>
88 #include <blaze/util/Types.h>
89 
90 
91 namespace blaze {
92 
93 //=================================================================================================
94 //
95 // CLASS SMATSMATMULTEXPR
96 //
97 //=================================================================================================
98 
99 //*************************************************************************************************
106 template< typename MT1 // Type of the left-hand side sparse matrix
107  , typename MT2 > // Type of the right-hand side sparse matrix
108 class SMatSMatMultExpr
109  : public MatMatMultExpr< SparseMatrix< SMatSMatMultExpr<MT1,MT2>, false > >
110  , private Computation
111 {
112  private:
113  //**Type definitions****************************************************************************
118  //**********************************************************************************************
119 
120  //**********************************************************************************************
122  static constexpr bool evaluateLeft = RequiresEvaluation_v<MT1>;
123  //**********************************************************************************************
124 
125  //**********************************************************************************************
127  static constexpr bool evaluateRight = RequiresEvaluation_v<MT2>;
128  //**********************************************************************************************
129 
130  //**********************************************************************************************
132 
137  template< typename T1, typename T2, typename T3 >
138  static constexpr bool CanExploitSymmetry_v =
139  ( IsColumnMajorMatrix_v<T1> && IsSymmetric_v<T2> && 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,T3> );
153  //**********************************************************************************************
154 
155  public:
156  //**Type definitions****************************************************************************
163  using ReturnType = const ElementType;
164  using CompositeType = const ResultType;
165 
167  using LeftOperand = If_t< IsExpression_v<MT1>, const MT1, const MT1& >;
168 
170  using RightOperand = If_t< IsExpression_v<MT2>, const MT2, const MT2& >;
171  //**********************************************************************************************
172 
173  //**Compilation flags***************************************************************************
175  static constexpr bool smpAssignable =
176  ( !evaluateLeft && MT1::smpAssignable && !evaluateRight && MT2::smpAssignable );
177  //**********************************************************************************************
178 
179  //**Constructor*********************************************************************************
185  explicit inline SMatSMatMultExpr( const MT1& lhs, const MT2& rhs ) noexcept
186  : lhs_( lhs ) // Left-hand side sparse matrix of the multiplication expression
187  , rhs_( rhs ) // Right-hand side sparse matrix of the multiplication expression
188  {
189  BLAZE_INTERNAL_ASSERT( lhs.columns() == rhs.rows(), "Invalid matrix sizes" );
190  }
191  //**********************************************************************************************
192 
193  //**Access operator*****************************************************************************
200  inline ReturnType operator()( size_t i, size_t j ) const {
201  BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
202  BLAZE_INTERNAL_ASSERT( j < rhs_.columns(), "Invalid column access index" );
203 
204  if( IsDiagonal_v<MT1> ) {
205  return lhs_(i,i) * rhs_(i,j);
206  }
207  else if( IsDiagonal_v<MT2> ) {
208  return lhs_(i,j) * rhs_(j,j);
209  }
210  else if( IsTriangular_v<MT1> || IsTriangular_v<MT2> ) {
211  const size_t begin( ( IsUpper_v<MT1> )
212  ?( ( IsLower_v<MT2> )
213  ?( max( ( IsStrictlyUpper_v<MT1> ? i+1UL : i )
214  , ( IsStrictlyLower_v<MT2> ? j+1UL : j ) ) )
215  :( IsStrictlyUpper_v<MT1> ? i+1UL : i ) )
216  :( ( IsLower_v<MT2> )
217  ?( IsStrictlyLower_v<MT2> ? j+1UL : j )
218  :( 0UL ) ) );
219  const size_t end( ( IsLower_v<MT1> )
220  ?( ( IsUpper_v<MT2> )
221  ?( min( ( IsStrictlyLower_v<MT1> ? i : i+1UL )
222  , ( IsStrictlyUpper_v<MT2> ? j : j+1UL ) ) )
223  :( IsStrictlyLower_v<MT1> ? i : i+1UL ) )
224  :( ( IsUpper_v<MT2> )
225  ?( IsStrictlyUpper_v<MT2> ? j : j+1UL )
226  :( lhs_.columns() ) ) );
227 
228  if( begin >= end ) return ElementType();
229 
230  const size_t n( end - begin );
231 
232  return subvector( row( lhs_, i, unchecked ), begin, n, unchecked ) *
233  subvector( column( rhs_, j, unchecked ), begin, n, unchecked );
234  }
235  else {
236  return row( lhs_, i, unchecked ) * column( rhs_, j, unchecked );
237  }
238  }
239  //**********************************************************************************************
240 
241  //**At function*********************************************************************************
249  inline ReturnType at( size_t i, size_t j ) const {
250  if( i >= lhs_.rows() ) {
251  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
252  }
253  if( j >= rhs_.columns() ) {
254  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
255  }
256  return (*this)(i,j);
257  }
258  //**********************************************************************************************
259 
260  //**Rows function*******************************************************************************
265  inline size_t rows() const noexcept {
266  return lhs_.rows();
267  }
268  //**********************************************************************************************
269 
270  //**Columns function****************************************************************************
275  inline size_t columns() const noexcept {
276  return rhs_.columns();
277  }
278  //**********************************************************************************************
279 
280  //**NonZeros function***************************************************************************
285  inline constexpr size_t nonZeros() const noexcept {
286  return 0UL;
287  }
288  //**********************************************************************************************
289 
290  //**NonZeros function***************************************************************************
296  inline size_t nonZeros( size_t i ) const noexcept {
297  MAYBE_UNUSED( i );
298  return 0UL;
299  }
300  //**********************************************************************************************
301 
302  //**Left operand access*************************************************************************
307  inline LeftOperand leftOperand() const noexcept {
308  return lhs_;
309  }
310  //**********************************************************************************************
311 
312  //**Right operand access************************************************************************
317  inline RightOperand rightOperand() const noexcept {
318  return rhs_;
319  }
320  //**********************************************************************************************
321 
322  //**********************************************************************************************
328  template< typename T >
329  inline bool canAlias( const T* alias ) const noexcept {
330  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
331  }
332  //**********************************************************************************************
333 
334  //**********************************************************************************************
340  template< typename T >
341  inline bool isAliased( const T* alias ) const noexcept {
342  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
343  }
344  //**********************************************************************************************
345 
346  //**********************************************************************************************
351  inline bool canSMPAssign() const noexcept {
352  return ( rows() * columns() >= SMP_SMATSMATMULT_THRESHOLD );
353  }
354  //**********************************************************************************************
355 
356  private:
357  //**Member variables****************************************************************************
360  //**********************************************************************************************
361 
362  //**Assignment to dense matrices****************************************************************
375  template< typename MT // Type of the target dense matrix
376  , bool SO > // Storage order of the target dense matrix
377  friend inline auto assign( DenseMatrix<MT,SO>& lhs, const SMatSMatMultExpr& rhs )
379  {
381 
382  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
383  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
384 
385  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
386  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
387 
388  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
389  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
390  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
391  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
392  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
393  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
394 
395  SMatSMatMultExpr::selectAssignKernel( ~lhs, A, B );
396  }
398  //**********************************************************************************************
399 
400  //**Default assignment to dense matrices********************************************************
413  template< typename MT3 // Type of the left-hand side target matrix
414  , typename MT4 // Type of the left-hand side matrix operand
415  , typename MT5 > // Type of the right-hand side matrix operand
416  static inline void selectAssignKernel( MT3& C, const MT4& A, const MT5& B )
417  {
418  for( size_t i=0UL; i<C.rows(); ++i ) {
419  const auto lend( A.end(i) );
420  for( auto lelem=A.begin(i); lelem!=lend; ++lelem ) {
421  const auto rend( B.end( lelem->index() ) );
422  for( auto relem=B.begin( lelem->index() ); relem!=rend; ++relem )
423  {
425  isDefault( C(i,relem->index()) ) ) {
426  C(i,relem->index()) = lelem->value() * relem->value();
427  }
428  else {
429  C(i,relem->index()) += lelem->value() * relem->value();
430  }
431  }
432  }
433  }
434  }
436  //**********************************************************************************************
437 
438  //**Assignment to row-major sparse matrices*****************************************************
451  template< typename MT > // Type of the target sparse matrix
452  friend inline void assign( SparseMatrix<MT,false>& lhs, const SMatSMatMultExpr& rhs )
453  {
455 
456  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
457  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
458 
459  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
460  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
461 
462  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
463  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
464  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
465  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
466  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
467  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
468 
469  // (Over-)Estimating the number of non-zero entries in the resulting matrix
470  size_t nonzeros( 0UL );
471 
472  for( size_t i=0UL; i<(~lhs).rows(); ++i ) {
473  const auto lend( A.end(i) );
474  for( auto lelem=A.begin(i); lelem!=lend; ++lelem ) {
475  nonzeros += B.nonZeros( lelem->index() );
476  }
477  }
478 
479  if( nonzeros > (~lhs).rows() * (~lhs).columns() ) {
480  nonzeros = (~lhs).rows() * (~lhs).columns();
481  }
482 
483  (~lhs).reserve( nonzeros );
484  nonzeros = 0UL;
485 
486  // Performing the matrix-matrix multiplication
487  SmallArray<ElementType,128UL> values ( (~lhs).columns(), ElementType() );
488  SmallArray<bool,128UL> valid ( (~lhs).columns(), false );
489  SmallArray<size_t,128UL> indices( (~lhs).columns(), 0UL );
490  size_t minIndex( inf ), maxIndex( 0UL );
491 
492  for( size_t i=0UL; i<(~lhs).rows(); ++i )
493  {
494  const auto lend( A.end(i) );
495  for( auto lelem=A.begin(i); lelem!=lend; ++lelem )
496  {
497  const auto rend( B.end( lelem->index() ) );
498  for( auto relem=B.begin( lelem->index() ); relem!=rend; ++relem )
499  {
500  if( !valid[relem->index()] ) {
501  values[relem->index()] = lelem->value() * relem->value();
502  valid [relem->index()] = true;
503  indices[nonzeros] = relem->index();
504  ++nonzeros;
505  if( relem->index() < minIndex ) minIndex = relem->index();
506  if( relem->index() > maxIndex ) maxIndex = relem->index();
507  }
508  else {
509  values[relem->index()] += lelem->value() * relem->value();
510  }
511  }
512  }
513 
514  BLAZE_INTERNAL_ASSERT( nonzeros <= (~lhs).columns(), "Invalid number of non-zero elements" );
515 
516  if( nonzeros > 0UL )
517  {
518  BLAZE_INTERNAL_ASSERT( minIndex <= maxIndex, "Invalid index detected" );
519 
520  if( ( nonzeros + nonzeros ) < ( maxIndex - minIndex ) )
521  {
522  std::sort( indices.begin(), indices.begin() + nonzeros );
523 
524  for( size_t j=0UL; j<nonzeros; ++j )
525  {
526  const size_t index( indices[j] );
527  if( !isDefault( values[index] ) ) {
528  (~lhs).append( i, index, values[index] );
529  reset( values[index] );
530  }
531 
532  reset( valid[index] );
533  }
534  }
535  else {
536  for( size_t j=minIndex; j<=maxIndex; ++j )
537  {
538  if( !isDefault( values[j] ) ) {
539  (~lhs).append( i, j, values[j] );
540  reset( values[j] );
541  }
542 
543  reset( valid[j] );
544  }
545  }
546 
547  nonzeros = 0UL;
548  minIndex = inf;
549  maxIndex = 0UL;
550  }
551 
552  (~lhs).finalize( i );
553  }
554  }
556  //**********************************************************************************************
557 
558  //**Assignment to column-major sparse matrices**************************************************
571  template< typename MT > // Type of the target sparse matrix
572  friend inline auto assign( SparseMatrix<MT,true>& lhs, const SMatSMatMultExpr& rhs )
573  -> DisableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
574  {
576 
578 
579  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
580  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
581 
584 
585  const ResultType tmp( serial( rhs ) );
586  (~lhs).reserve( tmp.nonZeros() );
587  assign( ~lhs, tmp );
588  }
590  //**********************************************************************************************
591 
592  //**Restructuring assignment to column-major matrices*******************************************
607  template< typename MT > // Type of the target matrix
608  friend inline auto assign( Matrix<MT,true>& lhs, const SMatSMatMultExpr& rhs )
609  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
610  {
612 
614 
615  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
616  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
617 
618  assign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
619  }
621  //**********************************************************************************************
622 
623  //**Addition assignment to dense matrices*******************************************************
636  template< typename MT // Type of the target dense matrix
637  , bool SO > // Storage order of the target dense matarix
638  friend inline auto addAssign( DenseMatrix<MT,SO>& lhs, const SMatSMatMultExpr& rhs )
639  -> DisableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
640  {
642 
643  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
644  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
645 
646  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
647  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
648 
649  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
650  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
651  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
652  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
653  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
654  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
655 
656  SMatSMatMultExpr::selectAddAssignKernel( ~lhs, A, B );
657  }
659  //**********************************************************************************************
660 
661  //**Default addition assignment to dense matrices***********************************************
675  template< typename MT3 // Type of the left-hand side target matrix
676  , typename MT4 // Type of the left-hand side matrix operand
677  , typename MT5 > // Type of the right-hand side matrix operand
678  static inline void selectAddAssignKernel( MT3& C, const MT4& A, const MT5& B )
679  {
680  for( size_t i=0UL; i<C.rows(); ++i ) {
681  const auto lend( A.end(i) );
682  for( auto lelem=A.begin(i); lelem!=lend; ++lelem ) {
683  const auto rend( B.end( lelem->index() ) );
684  for( auto relem=B.begin( lelem->index() ); relem!=rend; ++relem ) {
685  C(i,relem->index()) += lelem->value() * relem->value();
686  }
687  }
688  }
689  }
691  //**********************************************************************************************
692 
693  //**Restructuring addition assignment to column-major matrices**********************************
708  template< typename MT > // Type of the target matrix
709  friend inline auto addAssign( Matrix<MT,true>& lhs, const SMatSMatMultExpr& rhs )
710  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
711  {
713 
715 
716  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
717  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
718 
719  addAssign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
720  }
722  //**********************************************************************************************
723 
724  //**Addition assignment to sparse matrices******************************************************
725  // No special implementation for the addition assignment to sparse matrices.
726  //**********************************************************************************************
727 
728  //**Subtraction assignment to dense matrices****************************************************
741  template< typename MT // Type of the target dense matrix
742  , bool SO > // Storage order of the target dense matrix
743  friend inline auto subAssign( DenseMatrix<MT,SO>& lhs, const SMatSMatMultExpr& rhs )
744  -> DisableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
745  {
747 
748  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
749  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
750 
751  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
752  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
753 
754  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
755  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
756  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
757  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
758  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
759  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
760 
761  SMatSMatMultExpr::selectSubAssignKernel( ~lhs, A, B );
762  }
764  //**********************************************************************************************
765 
766  //**Default subtraction assignment to dense matrices********************************************
780  template< typename MT3 // Type of the left-hand side target matrix
781  , typename MT4 // Type of the left-hand side matrix operand
782  , typename MT5 > // Type of the right-hand side matrix operand
783  static inline void selectSubAssignKernel( MT3& C, const MT4& A, const MT5& B )
784  {
785  for( size_t i=0UL; i<C.rows(); ++i ) {
786  const auto lend( A.end(i) );
787  for( auto lelem=A.begin(i); lelem!=lend; ++lelem ) {
788  const auto rend( B.end( lelem->index() ) );
789  for( auto relem=B.begin( lelem->index() ); relem!=rend; ++relem ) {
790  C(i,relem->index()) -= lelem->value() * relem->value();
791  }
792  }
793  }
794  }
796  //**********************************************************************************************
797 
798  //**Restructuring subtraction assignment to column-major matrices*******************************
813  template< typename MT > // Type of the target matrix
814  friend inline auto subAssign( Matrix<MT,true>& lhs, const SMatSMatMultExpr& rhs )
815  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
816  {
818 
820 
821  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
822  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
823 
824  subAssign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
825  }
827  //**********************************************************************************************
828 
829  //**Subtraction assignment to sparse matrices***************************************************
830  // No special implementation for the subtraction assignment to sparse matrices.
831  //**********************************************************************************************
832 
833  //**Schur product assignment to dense matrices**************************************************
846  template< typename MT // Type of the target dense matrix
847  , bool SO > // Storage order of the target dense matrix
848  friend inline void schurAssign( DenseMatrix<MT,SO>& lhs, const SMatSMatMultExpr& rhs )
849  {
851 
855 
856  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
857  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
858 
859  const ResultType tmp( serial( rhs ) );
860  schurAssign( ~lhs, tmp );
861  }
863  //**********************************************************************************************
864 
865  //**Schur product assignment to sparse matrices*************************************************
866  // No special implementation for the Schur product assignment to sparse matrices.
867  //**********************************************************************************************
868 
869  //**Multiplication assignment to dense matrices*************************************************
870  // No special implementation for the multiplication assignment to dense matrices.
871  //**********************************************************************************************
872 
873  //**Multiplication assignment to sparse matrices************************************************
874  // No special implementation for the multiplication assignment to sparse matrices.
875  //**********************************************************************************************
876 
877  //**SMP assignment to matrices******************************************************************
892  template< typename MT // Type of the target matrix
893  , bool SO > // Storage order of the target matrix
894  friend inline auto smpAssign( Matrix<MT,SO>& lhs, const SMatSMatMultExpr& rhs )
895  -> EnableIf_t< IsEvaluationRequired_v<MT,MT1,MT2> >
896  {
898 
899  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
900  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
901 
902  CT1 A( rhs.lhs_ ); // Evaluation of the left-hand side sparse matrix operand
903  CT2 B( rhs.rhs_ ); // Evaluation of the right-hand side sparse matrix operand
904 
905  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
906  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
907  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
908  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
909  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
910  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
911 
912  smpAssign( ~lhs, A * B );
913  }
915  //**********************************************************************************************
916 
917  //**Restructuring SMP assignment to column-major matrices***************************************
932  template< typename MT > // Type of the target matrix
933  friend inline auto smpAssign( Matrix<MT,true>& lhs, const SMatSMatMultExpr& rhs )
934  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
935  {
937 
939 
940  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
941  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
942 
943  smpAssign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
944  }
946  //**********************************************************************************************
947 
948  //**SMP addition assignment to dense matrices***************************************************
964  template< typename MT // Type of the target dense matrix
965  , bool SO > // Storage order of the target dense matarix
966  friend inline auto smpAddAssign( DenseMatrix<MT,SO>& lhs, const SMatSMatMultExpr& rhs )
967  -> EnableIf_t< IsEvaluationRequired_v<MT,MT1,MT2> >
968  {
970 
971  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
972  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
973 
974  CT1 A( rhs.lhs_ ); // Evaluation of the left-hand side sparse matrix operand
975  CT2 B( rhs.rhs_ ); // Evaluation of the right-hand side sparse matrix operand
976 
977  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
978  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
979  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
980  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
981  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
982  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
983 
984  smpAddAssign( ~lhs, A * B );
985  }
987  //**********************************************************************************************
988 
989  //**Restructuring SMP addition assignment to column-major matrices******************************
1004  template< typename MT > // Type of the target matrix
1005  friend inline auto smpAddAssign( Matrix<MT,true>& lhs, const SMatSMatMultExpr& rhs )
1006  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
1007  {
1009 
1011 
1012  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1013  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1014 
1015  smpAddAssign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
1016  }
1018  //**********************************************************************************************
1019 
1020  //**SMP addition assignment to sparse matrices**************************************************
1021  // No special implementation for the SMP addition assignment to sparse matrices.
1022  //**********************************************************************************************
1023 
1024  //**SMP subtraction assignment to dense matrices************************************************
1040  template< typename MT // Type of the target dense matrix
1041  , bool SO > // Storage order of the target dense matrix
1042  friend inline auto smpSubAssign( DenseMatrix<MT,SO>& lhs, const SMatSMatMultExpr& rhs )
1043  -> EnableIf_t< IsEvaluationRequired_v<MT,MT1,MT2> >
1044  {
1046 
1047  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1048  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1049 
1050  CT1 A( rhs.lhs_ ); // Evaluation of the left-hand side sparse matrix operand
1051  CT2 B( rhs.rhs_ ); // Evaluation of the right-hand side sparse matrix operand
1052 
1053  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
1054  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
1055  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
1056  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
1057  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
1058  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
1059 
1060  smpSubAssign( ~lhs, A * B );
1061  }
1063  //**********************************************************************************************
1064 
1065  //**Restructuring SMP subtraction assignment to column-major matrices***************************
1080  template< typename MT > // Type of the target matrix
1081  friend inline auto smpSubAssign( Matrix<MT,true>& lhs, const SMatSMatMultExpr& rhs )
1082  -> EnableIf_t< CanExploitSymmetry_v<MT,MT1,MT2> >
1083  {
1085 
1087 
1088  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1089  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1090 
1091  smpSubAssign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
1092  }
1094  //**********************************************************************************************
1095 
1096  //**SMP subtraction assignment to sparse matrices***********************************************
1097  // No special implementation for the SMP subtraction assignment to sparse matrices.
1098  //**********************************************************************************************
1099 
1100  //**SMP Schur product assignment to dense matrices**********************************************
1113  template< typename MT // Type of the target dense matrix
1114  , bool SO > // Storage order of the target dense matrix
1115  friend inline void
1116  smpSchurAssign( DenseMatrix<MT,SO>& lhs, const SMatSMatMultExpr& rhs )
1117  {
1119 
1123 
1124  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1125  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1126 
1127  const ResultType tmp( rhs );
1128  smpSchurAssign( ~lhs, tmp );
1129  }
1131  //**********************************************************************************************
1132 
1133  //**SMP Schur product assignment to sparse matrices*********************************************
1134  // No special implementation for the SMP Schur product assignment to sparse matrices.
1135  //**********************************************************************************************
1136 
1137  //**SMP multiplication assignment to dense matrices*********************************************
1138  // No special implementation for the SMP multiplication assignment to dense matrices.
1139  //**********************************************************************************************
1140 
1141  //**SMP multiplication assignment to sparse matrices********************************************
1142  // No special implementation for the SMP multiplication assignment to sparse matrices.
1143  //**********************************************************************************************
1144 
1145  //**Compile time checks*************************************************************************
1155  //**********************************************************************************************
1156 };
1157 //*************************************************************************************************
1158 
1159 
1160 
1161 
1162 //=================================================================================================
1163 //
1164 // GLOBAL BINARY ARITHMETIC OPERATORS
1165 //
1166 //=================================================================================================
1167 
1168 //*************************************************************************************************
1181 template< typename MT1 // Type of the left-hand side sparse matrix
1182  , typename MT2 // Type of the right-hand side sparse matrix
1183  , DisableIf_t< ( ( IsIdentity_v<MT1> || IsIdentity_v<MT2> ) &&
1184  IsSame_v< ElementType_t<MT1>, ElementType_t<MT2> > ) ||
1185  ( IsIdentity_v<MT1> && IsIdentity_v<MT2> ) ||
1186  ( IsZero_v<MT1> || IsZero_v<MT2> ) >* = nullptr >
1187 inline const SMatSMatMultExpr<MT1,MT2>
1188  smatsmatmult( const SparseMatrix<MT1,false>& lhs, const SparseMatrix<MT2,false>& rhs )
1189 {
1191 
1192  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).rows(), "Invalid matrix sizes" );
1193 
1194  return SMatSMatMultExpr<MT1,MT2>( ~lhs, ~rhs );
1195 }
1197 //*************************************************************************************************
1198 
1199 
1200 //*************************************************************************************************
1214 template< typename MT1 // Type of the left-hand side sparse matrix
1215  , typename MT2 // Type of the right-hand side sparse matrix
1216  , EnableIf_t< !IsIdentity_v<MT1> && IsIdentity_v<MT2> &&
1217  IsSame_v< ElementType_t<MT1>, ElementType_t<MT2> > >* = nullptr >
1218 inline const MT1&
1219  smatsmatmult( const SparseMatrix<MT1,false>& lhs, const SparseMatrix<MT2,false>& rhs )
1220 {
1222 
1223  MAYBE_UNUSED( rhs );
1224 
1225  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).rows(), "Invalid matrix sizes" );
1226 
1227  return (~lhs);
1228 }
1230 //*************************************************************************************************
1231 
1232 
1233 //*************************************************************************************************
1247 template< typename MT1 // Type of the left-hand side sparse matrix
1248  , typename MT2 // Type of the right-hand side sparse matrix
1249  , EnableIf_t< IsIdentity_v<MT1> && !IsIdentity_v<MT2> &&
1250  IsSame_v< ElementType_t<MT1>, ElementType_t<MT2> > >* = nullptr >
1251 inline const MT2&
1252  smatsmatmult( const SparseMatrix<MT1,false>& lhs, const SparseMatrix<MT2,false>& rhs )
1253 {
1255 
1256  MAYBE_UNUSED( lhs );
1257 
1258  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).rows(), "Invalid matrix sizes" );
1259 
1260  return (~rhs);
1261 }
1263 //*************************************************************************************************
1264 
1265 
1266 //*************************************************************************************************
1279 template< typename MT1 // Type of the left-hand side sparse matrix
1280  , typename MT2 // Type of the right-hand side sparse matrix
1281  , EnableIf_t< IsIdentity_v<MT1> && IsIdentity_v<MT2> >* = nullptr >
1282 inline decltype(auto)
1283  smatsmatmult( const SparseMatrix<MT1,false>& lhs, const SparseMatrix<MT2,false>& rhs )
1284 {
1286 
1287  MAYBE_UNUSED( rhs );
1288 
1289  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).rows(), "Invalid matrix sizes" );
1290 
1291  using ReturnType = const MultTrait_t< ResultType_t<MT1>, ResultType_t<MT2> >;
1292 
1295 
1296  return ReturnType( (~lhs).rows() );
1297 }
1299 //*************************************************************************************************
1300 
1301 
1302 //*************************************************************************************************
1315 template< typename MT1 // Type of the left-hand side sparse matrix
1316  , typename MT2 // Type of the right-hand side sparse matrix
1317  , EnableIf_t< IsZero_v<MT1> || IsZero_v<MT2> >* = nullptr >
1318 inline decltype(auto)
1319  smatsmatmult( const SparseMatrix<MT1,false>& lhs, const SparseMatrix<MT2,false>& rhs )
1320 {
1322 
1323  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).rows(), "Invalid matrix sizes" );
1324 
1325  using ReturnType = const MultTrait_t< ResultType_t<MT1>, ResultType_t<MT2> >;
1326 
1328  BLAZE_CONSTRAINT_MUST_BE_ZERO_TYPE( ReturnType );
1329 
1330  return ReturnType( (~lhs).rows(), (~rhs).columns() );
1331 }
1333 //*************************************************************************************************
1334 
1335 
1336 //*************************************************************************************************
1363 template< typename MT1 // Type of the left-hand side sparse matrix
1364  , typename MT2 > // Type of the right-hand side sparse matrix
1365 inline decltype(auto)
1366  operator*( const SparseMatrix<MT1,false>& lhs, const SparseMatrix<MT2,false>& rhs )
1367 {
1369 
1370  if( (~lhs).columns() != (~rhs).rows() ) {
1371  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1372  }
1373 
1374  return smatsmatmult( ~lhs, ~rhs );
1375 }
1376 //*************************************************************************************************
1377 
1378 } // namespace blaze
1379 
1380 #endif
Constraint on the data type.
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatSMatMultExpr.h:200
#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
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatSMatMultExpr.h:329
RightOperand rhs_
Right-hand side sparse matrix of the multiplication expression.
Definition: SMatSMatMultExpr.h:359
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
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
Header file for the IsColumnMajorMatrix type trait.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
CompositeType_t< MT2 > CT2
Composite type of the right-hand side sparse matrix expression.
Definition: SMatSMatMultExpr.h:117
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.
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SMatSMatMultExpr.h:175
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.
Header file for the Computation base class.
Header file for the MatMatMultExpr base class.
Header file for the reset shim.
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatSMatMultExpr.h:341
Constraints on the storage order of matrix types.
Header file for the RequiresEvaluation type trait.
MultTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: SMatSMatMultExpr.h:159
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatSMatMultExpr.h:265
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
If_t< IsExpression_v< MT1 >, const MT1, const MT1 & > LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: SMatSMatMultExpr.h:167
RightOperand rightOperand() const noexcept
Returns the right-hand side sparse matrix operand.
Definition: SMatSMatMultExpr.h:317
Header file for the SparseMatrix base class.
Constraint on the data type.
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.
LeftOperand lhs_
Left-hand side sparse matrix of the multiplication expression.
Definition: SMatSMatMultExpr.h:358
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.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
#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
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatSMatMultExpr.h:249
Numerical infinity for built-in data types.
Header file for the IsLower type trait.
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the IsTriangular type trait.
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse matrix operand.
Definition: SMatSMatMultExpr.h:307
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
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 the EnableIf class template.
Header file for the IsStrictlyLower type trait.
size_t nonZeros(size_t i) const noexcept
Returns the number of non-zero elements in the specified row.
Definition: SMatSMatMultExpr.h:296
#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
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatSMatMultExpr.h:275
#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
#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
Expression object for sparse matrix-sparse matrix multiplications.The SMatSMatMultExpr class represen...
Definition: Forward.h:132
SMatSMatMultExpr(const MT1 &lhs, const MT2 &rhs) noexcept
Constructor for the SMatSMatMultExpr class.
Definition: SMatSMatMultExpr.h:185
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
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< MT2 > RT2
Result type of the right-hand side sparse matrix expression.
Definition: SMatSMatMultExpr.h:115
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatSMatMultExpr.h:161
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.
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: SMatSMatMultExpr.h:162
#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.
const ResultType CompositeType
Data type for composite expression templates.
Definition: SMatSMatMultExpr.h:164
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.
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
CompositeType_t< MT1 > CT1
Composite type of the left-hand side sparse matrix expression.
Definition: SMatSMatMultExpr.h:116
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
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatSMatMultExpr.h:160
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
static constexpr bool evaluateRight
Compilation switch for the composite type of the right-hand side sparse matrix expression.
Definition: SMatSMatMultExpr.h:127
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
const ElementType ReturnType
Return type for expression template evaluations.
Definition: SMatSMatMultExpr.h:163
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
static constexpr bool evaluateLeft
Compilation switch for the composite type of the left-hand side sparse matrix expression.
Definition: SMatSMatMultExpr.h:122
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
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
constexpr size_t nonZeros() const noexcept
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatSMatMultExpr.h:285
ResultType_t< MT1 > RT1
Result type of the left-hand side sparse matrix expression.
Definition: SMatSMatMultExpr.h:114
Constraint on the data type.
Header file for the IsResizable type trait.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatSMatMultExpr.h:351
#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.
If_t< IsExpression_v< MT2 >, const MT2, const MT2 & > RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: SMatSMatMultExpr.h:170