SMatTDMatMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATTDMATMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATTDMATMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
51 #include <blaze/math/Exception.h>
63 #include <blaze/math/shims/Reset.h>
81 #include <blaze/math/views/Check.h>
86 #include <blaze/util/Assert.h>
87 #include <blaze/util/DisableIf.h>
88 #include <blaze/util/EnableIf.h>
90 #include <blaze/util/mpl/And.h>
91 #include <blaze/util/mpl/Bool.h>
92 #include <blaze/util/mpl/If.h>
93 #include <blaze/util/mpl/Or.h>
94 #include <blaze/util/TrueType.h>
95 #include <blaze/util/Types.h>
98 
99 
100 namespace blaze {
101 
102 //=================================================================================================
103 //
104 // CLASS SMATTDMATMULTEXPR
105 //
106 //=================================================================================================
107 
108 //*************************************************************************************************
115 template< typename MT1 // Type of the left-hand side sparse matrix
116  , typename MT2 // Type of the right-hand side dense matrix
117  , bool SF // Symmetry flag
118  , bool HF // Hermitian flag
119  , bool LF // Lower flag
120  , bool UF > // Upper flag
121 class SMatTDMatMultExpr
122  : public MatMatMultExpr< DenseMatrix< SMatTDMatMultExpr<MT1,MT2,SF,HF,LF,UF>, false > >
123  , private Computation
124 {
125  private:
126  //**Type definitions****************************************************************************
133  //**********************************************************************************************
134 
135  //**********************************************************************************************
137  enum : bool { evaluateLeft = IsComputation<MT1>::value || RequiresEvaluation<MT1>::value };
138  //**********************************************************************************************
139 
140  //**********************************************************************************************
142  enum : bool { evaluateRight = IsComputation<MT2>::value || RequiresEvaluation<MT2>::value };
143  //**********************************************************************************************
144 
145  //**********************************************************************************************
147  enum : bool {
148  SYM = ( SF && !( HF || LF || UF ) ),
149  HERM = ( HF && !( LF || UF ) ),
150  LOW = ( LF || ( ( SF || HF ) && UF ) ),
151  UPP = ( UF || ( ( SF || HF ) && LF ) )
152  };
153  //**********************************************************************************************
154 
155  //**********************************************************************************************
157 
162  template< typename T1, typename T2, typename T3 >
163  struct CanExploitSymmetry {
164  enum : bool { value = IsSymmetric<T3>::value };
165  };
167  //**********************************************************************************************
168 
169  //**********************************************************************************************
171 
175  template< typename T1, typename T2, typename T3 >
176  struct IsEvaluationRequired {
177  enum : bool { value = ( evaluateLeft || evaluateRight ) &&
178  CanExploitSymmetry<T1,T2,T3>::value };
179  };
181  //**********************************************************************************************
182 
183  //**********************************************************************************************
185 
188  template< typename T1, typename T2, typename T3 >
189  struct UseOptimizedKernel {
190  enum : bool { value = useOptimizedKernels &&
192  !IsResizable< ElementType_<T1> >::value &&
194  };
196  //**********************************************************************************************
197 
198  //**********************************************************************************************
200 
203  using ForwardFunctor = IfTrue_< HERM
204  , DeclHerm
205  , IfTrue_< SYM
206  , DeclSym
207  , IfTrue_< LOW
208  , IfTrue_< UPP
209  , DeclDiag
210  , DeclLow >
211  , IfTrue_< UPP
212  , DeclUpp
213  , Noop > > > >;
215  //**********************************************************************************************
216 
217  public:
218  //**Type definitions****************************************************************************
221 
226  using ReturnType = const ElementType;
227  using CompositeType = const ResultType;
228 
230  using LeftOperand = If_< IsExpression<MT1>, const MT1, const MT1& >;
231 
233  using RightOperand = If_< IsExpression<MT2>, const MT2, const MT2& >;
234 
237 
240  //**********************************************************************************************
241 
242  //**Compilation flags***************************************************************************
244  enum : bool { simdEnabled = false };
245 
247  enum : bool { smpAssignable = !evaluateLeft && MT1::smpAssignable &&
248  !evaluateRight && MT2::smpAssignable };
249  //**********************************************************************************************
250 
251  //**Constructor*********************************************************************************
257  explicit inline SMatTDMatMultExpr( const MT1& lhs, const MT2& rhs ) noexcept
258  : lhs_( lhs ) // Left-hand side sparse matrix of the multiplication expression
259  , rhs_( rhs ) // Right-hand side dense matrix of the multiplication expression
260  {
261  BLAZE_INTERNAL_ASSERT( lhs.columns() == rhs.rows(), "Invalid matrix sizes" );
262  }
263  //**********************************************************************************************
264 
265  //**Access operator*****************************************************************************
272  inline ReturnType operator()( size_t i, size_t j ) const {
273  BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
274  BLAZE_INTERNAL_ASSERT( j < rhs_.columns(), "Invalid column access index" );
275 
276  if( IsDiagonal<MT1>::value ) {
277  return lhs_(i,i) * rhs_(i,j);
278  }
279  else if( IsDiagonal<MT2>::value ) {
280  return lhs_(i,j) * rhs_(j,j);
281  }
283  const size_t begin( ( IsUpper<MT1>::value )
284  ?( ( IsLower<MT2>::value )
285  ?( max( ( IsStrictlyUpper<MT1>::value ? i+1UL : i )
286  , ( IsStrictlyLower<MT2>::value ? j+1UL : j ) ) )
287  :( IsStrictlyUpper<MT1>::value ? i+1UL : i ) )
288  :( ( IsLower<MT2>::value )
289  ?( IsStrictlyLower<MT2>::value ? j+1UL : j )
290  :( 0UL ) ) );
291  const size_t end( ( IsLower<MT1>::value )
292  ?( ( IsUpper<MT2>::value )
293  ?( min( ( IsStrictlyLower<MT1>::value ? i : i+1UL )
294  , ( IsStrictlyUpper<MT2>::value ? j : j+1UL ) ) )
295  :( IsStrictlyLower<MT1>::value ? i : i+1UL ) )
296  :( ( IsUpper<MT2>::value )
297  ?( IsStrictlyUpper<MT2>::value ? j : j+1UL )
298  :( lhs_.columns() ) ) );
299 
300  if( begin >= end ) return ElementType();
301 
302  const size_t n( end - begin );
303 
304  return subvector( row( lhs_, i, unchecked ), begin, n, unchecked ) *
305  subvector( column( rhs_, j, unchecked ), begin, n, unchecked );
306  }
307  else {
308  return row( lhs_, i, unchecked ) * column( rhs_, j, unchecked );
309  }
310  }
311  //**********************************************************************************************
312 
313  //**At function*********************************************************************************
321  inline ReturnType at( size_t i, size_t j ) const {
322  if( i >= lhs_.rows() ) {
323  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
324  }
325  if( j >= rhs_.columns() ) {
326  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
327  }
328  return (*this)(i,j);
329  }
330  //**********************************************************************************************
331 
332  //**Rows function*******************************************************************************
337  inline size_t rows() const noexcept {
338  return lhs_.rows();
339  }
340  //**********************************************************************************************
341 
342  //**Columns function****************************************************************************
347  inline size_t columns() const noexcept {
348  return rhs_.columns();
349  }
350  //**********************************************************************************************
351 
352  //**Left operand access*************************************************************************
357  inline LeftOperand leftOperand() const noexcept {
358  return lhs_;
359  }
360  //**********************************************************************************************
361 
362  //**Right operand access************************************************************************
367  inline RightOperand rightOperand() const noexcept {
368  return rhs_;
369  }
370  //**********************************************************************************************
371 
372  //**********************************************************************************************
378  template< typename T >
379  inline bool canAlias( const T* alias ) const noexcept {
380  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
381  }
382  //**********************************************************************************************
383 
384  //**********************************************************************************************
390  template< typename T >
391  inline bool isAliased( const T* alias ) const noexcept {
392  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
393  }
394  //**********************************************************************************************
395 
396  //**********************************************************************************************
401  inline bool isAligned() const noexcept {
402  return rhs_.isAligned();
403  }
404  //**********************************************************************************************
405 
406  //**********************************************************************************************
411  inline bool canSMPAssign() const noexcept {
412  return ( rows() * columns() >= SMP_SMATTDMATMULT_THRESHOLD ) && !IsDiagonal<MT2>::value;
413  }
414  //**********************************************************************************************
415 
416  private:
417  //**Member variables****************************************************************************
420  //**********************************************************************************************
421 
422  //**Assignment to dense matrices****************************************************************
435  template< typename MT // Type of the target dense matrix
436  , bool SO > // Storage order of the target dense matrix
438  assign( DenseMatrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
439  {
441 
442  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
443  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
444 
445  LT A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
446  RT B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense matrix operand
447 
448  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
449  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
450  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
451  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
452  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
453  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
454 
455  SMatTDMatMultExpr::selectAssignKernel( ~lhs, A, B );
456  }
458  //**********************************************************************************************
459 
460  //**Default assignment to dense matrices********************************************************
474  template< typename MT3 // Type of the left-hand side target matrix
475  , typename MT4 // Type of the left-hand side matrix operand
476  , typename MT5 > // Type of the right-hand side matrix operand
478  selectAssignKernel( MT3& C, const MT4& A, const MT5& B )
479  {
481 
482  const size_t M( A.rows() );
483  const size_t N( B.columns() );
484 
485  BLAZE_INTERNAL_ASSERT( !( SYM || HERM || LOW || UPP ) || M == N, "Broken invariant detected" );
486 
487  {
488  size_t j( 0UL );
489 
490  for( ; (j+4UL) <= N; j+=4UL ) {
491  for( size_t i=( SYM || HERM || LOW ? j : 0UL ); i<( UPP ? j+4UL : M ); ++i )
492  {
494  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j+4UL) : A.upperBound(i,j+4UL) )
495  :( A.end(i) ) );
497  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
498  :( A.begin(i) ) );
499 
500  if( element == end ) {
501  reset( C(i,j ) );
502  reset( C(i,j+1UL) );
503  reset( C(i,j+2UL) );
504  reset( C(i,j+3UL) );
505  continue;
506  }
507 
508  C(i,j ) = element->value() * B(element->index(),j );
509  C(i,j+1UL) = element->value() * B(element->index(),j+1UL);
510  C(i,j+2UL) = element->value() * B(element->index(),j+2UL);
511  C(i,j+3UL) = element->value() * B(element->index(),j+3UL);
512  ++element;
513  for( ; element!=end; ++element ) {
514  C(i,j ) += element->value() * B(element->index(),j );
515  C(i,j+1UL) += element->value() * B(element->index(),j+1UL);
516  C(i,j+2UL) += element->value() * B(element->index(),j+2UL);
517  C(i,j+3UL) += element->value() * B(element->index(),j+3UL);
518  }
519  }
520  }
521 
522  for( ; (j+2UL) <= N; j+=2UL ) {
523  for( size_t i=( SYM || HERM || LOW ? j : 0UL ); i<( UPP ? j+2UL : M ); ++i )
524  {
526  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j+2UL) : A.upperBound(i,j+2UL) )
527  :( A.end(i) ) );
529  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
530  :( A.begin(i) ) );
531 
532  if( element == end ) {
533  reset( C(i,j ) );
534  reset( C(i,j+1UL) );
535  continue;
536  }
537 
538  C(i,j ) = element->value() * B(element->index(),j );
539  C(i,j+1UL) = element->value() * B(element->index(),j+1UL);
540  ++element;
541  for( ; element!=end; ++element ) {
542  C(i,j ) += element->value() * B(element->index(),j );
543  C(i,j+1UL) += element->value() * B(element->index(),j+1UL);
544  }
545  }
546  }
547 
548  for( ; j<N; ++j ) {
549  for( size_t i=( SYM || HERM || LOW ? j : 0UL ); i<( UPP ? j+1UL : M ); ++i )
550  {
552  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j) : A.upperBound(i,j) )
553  :( A.end(i) ) );
555  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
556  :( A.begin(i) ) );
557 
558  if( element == end ) {
559  reset( C(i,j) );
560  continue;
561  }
562 
563  C(i,j) = element->value() * B(element->index(),j);
564  ++element;
565  for( ; element!=end; ++element ) {
566  C(i,j) += element->value() * B(element->index(),j);
567  }
568  }
569  }
570  }
571 
572  if( SYM || HERM ) {
573  for( size_t j=1UL; j<N; ++j ) {
574  for( size_t i=0UL; i<j; ++i ) {
575  C(i,j) = HERM ? conj( C(j,i) ) : C(j,i);
576  }
577  }
578  }
579  else if( LOW && !UPP ) {
580  for( size_t j=1UL; j<N; ++j ) {
581  for( size_t i=0UL; i<j; ++i ) {
582  reset( C(i,j) );
583  }
584  }
585  }
586  else if( !LOW && UPP ) {
587  for( size_t i=1UL; i<M; ++i ) {
588  for( size_t j=0UL; j<i; ++j ) {
589  reset( C(i,j) );
590  }
591  }
592  }
593  }
595  //**********************************************************************************************
596 
597  //**Optimized assignment to dense matrices******************************************************
611  template< typename MT3 // Type of the left-hand side target matrix
612  , typename MT4 // Type of the left-hand side matrix operand
613  , typename MT5 > // Type of the right-hand side matrix operand
615  selectAssignKernel( MT3& C, const MT4& A, const MT5& B )
616  {
618 
619  const size_t M( A.rows() );
620  const size_t N( B.columns() );
621 
622  BLAZE_INTERNAL_ASSERT( !( SYM || HERM || LOW || UPP ) || M == N, "Broken invariant detected" );
623 
624  reset( C );
625 
626  {
627  size_t j( 0UL );
628 
629  for( ; (j+4UL) <= N; j+=4UL ) {
630  for( size_t i=( SYM || HERM || LOW ? j : 0UL ); i<( UPP ? j+4UL : M ); ++i )
631  {
633  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j+4UL) : A.upperBound(i,j+4UL) )
634  :( A.end(i) ) );
636  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
637  :( A.begin(i) ) );
638 
639  const size_t nonzeros( end - element );
640  const size_t kpos( nonzeros & size_t(-4) );
641  BLAZE_INTERNAL_ASSERT( ( nonzeros - ( nonzeros % 4UL ) ) == kpos, "Invalid end calculation" );
642 
643  for( size_t k=0UL; k<kpos; k+=4UL )
644  {
645  const size_t i1( element->index() );
646  const ET1 v1( element->value() );
647  ++element;
648  const size_t i2( element->index() );
649  const ET1 v2( element->value() );
650  ++element;
651  const size_t i3( element->index() );
652  const ET1 v3( element->value() );
653  ++element;
654  const size_t i4( element->index() );
655  const ET1 v4( element->value() );
656  ++element;
657 
658  BLAZE_INTERNAL_ASSERT( i1 < i2 && i2 < i3 && i3 < i4, "Invalid sparse matrix index detected" );
659 
660  C(i,j ) += v1 * B(i1,j ) + v2 * B(i2,j ) + v3 * B(i3,j ) + v4 * B(i4,j );
661  C(i,j+1UL) += v1 * B(i1,j+1UL) + v2 * B(i2,j+1UL) + v3 * B(i3,j+1UL) + v4 * B(i4,j+1UL);
662  C(i,j+2UL) += v1 * B(i1,j+2UL) + v2 * B(i2,j+2UL) + v3 * B(i3,j+2UL) + v4 * B(i4,j+2UL);
663  C(i,j+3UL) += v1 * B(i1,j+3UL) + v2 * B(i2,j+3UL) + v3 * B(i3,j+3UL) + v4 * B(i4,j+3UL);
664  }
665 
666  for( ; element!=end; ++element )
667  {
668  const size_t i1( element->index() );
669  const ET1 v1( element->value() );
670 
671  C(i,j ) += v1 * B(i1,j );
672  C(i,j+1UL) += v1 * B(i1,j+1UL);
673  C(i,j+2UL) += v1 * B(i1,j+2UL);
674  C(i,j+3UL) += v1 * B(i1,j+3UL);
675  }
676  }
677  }
678 
679  for( ; (j+2UL) <= N; j+=2UL ) {
680  for( size_t i=( SYM || HERM || LOW ? j : 0UL ); i<( UPP ? j+2UL : M ); ++i )
681  {
683  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j+2UL) : A.upperBound(i,j+2UL) )
684  :( A.end(i) ) );
686  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
687  :( A.begin(i) ) );
688 
689  const size_t nonzeros( end - element );
690  const size_t kpos( nonzeros & size_t(-4) );
691  BLAZE_INTERNAL_ASSERT( ( nonzeros - ( nonzeros % 4UL ) ) == kpos, "Invalid end calculation" );
692 
693  for( size_t k=0UL; k<kpos; k+=4UL )
694  {
695  const size_t i1( element->index() );
696  const ET1 v1( element->value() );
697  ++element;
698  const size_t i2( element->index() );
699  const ET1 v2( element->value() );
700  ++element;
701  const size_t i3( element->index() );
702  const ET1 v3( element->value() );
703  ++element;
704  const size_t i4( element->index() );
705  const ET1 v4( element->value() );
706  ++element;
707 
708  BLAZE_INTERNAL_ASSERT( i1 < i2 && i2 < i3 && i3 < i4, "Invalid sparse matrix index detected" );
709 
710  C(i,j ) += v1 * B(i1,j ) + v2 * B(i2,j ) + v3 * B(i3,j ) + v4 * B(i4,j );
711  C(i,j+1UL) += v1 * B(i1,j+1UL) + v2 * B(i2,j+1UL) + v3 * B(i3,j+1UL) + v4 * B(i4,j+1UL);
712  }
713 
714  for( ; element!=end; ++element )
715  {
716  const size_t i1( element->index() );
717  const ET1 v1( element->value() );
718 
719  C(i,j ) += v1 * B(i1,j );
720  C(i,j+1UL) += v1 * B(i1,j+1UL);
721  }
722  }
723  }
724 
725  for( ; j<N; ++j ) {
726  for( size_t i=( SYM || HERM || LOW ? j : 0UL ); i<( UPP ? j+1UL : M ); ++i )
727  {
729  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j) : A.upperBound(i,j) )
730  :( A.end(i) ) );
732  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
733  :( A.begin(i) ) );
734 
735  const size_t nonzeros( end - element );
736  const size_t kpos( nonzeros & size_t(-4) );
737  BLAZE_INTERNAL_ASSERT( ( nonzeros - ( nonzeros % 4UL ) ) == kpos, "Invalid end calculation" );
738 
739  for( size_t k=0UL; k<kpos; k+=4UL )
740  {
741  const size_t i1( element->index() );
742  const ET1 v1( element->value() );
743  ++element;
744  const size_t i2( element->index() );
745  const ET1 v2( element->value() );
746  ++element;
747  const size_t i3( element->index() );
748  const ET1 v3( element->value() );
749  ++element;
750  const size_t i4( element->index() );
751  const ET1 v4( element->value() );
752  ++element;
753 
754  BLAZE_INTERNAL_ASSERT( i1 < i2 && i2 < i3 && i3 < i4, "Invalid sparse matrix index detected" );
755 
756  C(i,j) += v1 * B(i1,j) + v2 * B(i2,j) + v3 * B(i3,j) + v4 * B(i4,j);
757  }
758 
759  for( ; element!=end; ++element )
760  {
761  const size_t i1( element->index() );
762  const ET1 v1( element->value() );
763 
764  C(i,j) += v1 * B(i1,j);
765  }
766  }
767  }
768  }
769 
770  if( SYM || HERM ) {
771  for( size_t j=1UL; j<N; ++j ) {
772  for( size_t i=0UL; i<j; ++i ) {
773  C(i,j) = HERM ? conj( C(j,i) ) : C(j,i);
774  }
775  }
776  }
777  }
779  //**********************************************************************************************
780 
781  //**Assignment to sparse matrices***************************************************************
794  template< typename MT // Type of the target sparse matrix
795  , bool SO > // Storage order of the target sparse matrix
797  assign( SparseMatrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
798  {
800 
802 
809 
810  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
811  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
812 
813  const ForwardFunctor fwd;
814 
815  const TmpType tmp( serial( rhs ) );
816  assign( ~lhs, fwd( tmp ) );
817  }
819  //**********************************************************************************************
820 
821  //**Restructuring assignment********************************************************************
836  template< typename MT // Type of the target matrix
837  , bool SO > // Storage order of the target matrix
839  assign( Matrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
840  {
842 
843  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
844  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
845 
846  const ForwardFunctor fwd;
847 
848  assign( ~lhs, fwd( rhs.lhs_ * trans( rhs.rhs_ ) ) );
849  }
851  //**********************************************************************************************
852 
853  //**Addition assignment to dense matrices*******************************************************
866  template< typename MT // Type of the target dense matrix
867  , bool SO > // Storage order of the target dense matrix
869  addAssign( DenseMatrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
870  {
872 
873  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
874  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
875 
876  LT A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
877  RT B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense matrix operand
878 
879  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
880  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
881  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
882  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
883  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
884  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
885 
886  SMatTDMatMultExpr::selectAddAssignKernel( ~lhs, A, B );
887  }
889  //**********************************************************************************************
890 
891  //**Default addition assignment to dense matrices***********************************************
905  template< typename MT3 // Type of the left-hand side target matrix
906  , typename MT4 // Type of the left-hand side matrix operand
907  , typename MT5 > // Type of the right-hand side matrix operand
909  selectAddAssignKernel( MT3& C, const MT4& A, const MT5& B )
910  {
912 
913  const size_t M( A.rows() );
914  const size_t N( B.columns() );
915 
916  BLAZE_INTERNAL_ASSERT( !( LOW || UPP ) || M == N, "Broken invariant detected" );
917 
918  {
919  size_t j( 0UL );
920 
921  for( ; (j+4UL) <= N; j+=4UL ) {
922  for( size_t i=( LOW ? j : 0UL ); i<( UPP ? j+4UL : M ); ++i )
923  {
925  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j+4UL) : A.upperBound(i,j+4UL) )
926  :( A.end(i) ) );
928  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
929  :( A.begin(i) ) );
930 
931  for( ; element!=end; ++element ) {
932  C(i,j ) += element->value() * B(element->index(),j );
933  C(i,j+1UL) += element->value() * B(element->index(),j+1UL);
934  C(i,j+2UL) += element->value() * B(element->index(),j+2UL);
935  C(i,j+3UL) += element->value() * B(element->index(),j+3UL);
936  }
937  }
938  }
939 
940  for( ; (j+2UL) <= N; j+=2UL ) {
941  for( size_t i=( LOW ? j : 0UL ); i<( UPP ? j+2UL : M ); ++i )
942  {
944  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j+2UL) : A.upperBound(i,j+2UL) )
945  :( A.end(i) ) );
947  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
948  :( A.begin(i) ) );
949 
950  for( ; element!=end; ++element ) {
951  C(i,j ) += element->value() * B(element->index(),j );
952  C(i,j+1UL) += element->value() * B(element->index(),j+1UL);
953  }
954  }
955  }
956 
957  for( ; j<N; ++j ) {
958  for( size_t i=( LOW ? j : 0UL ); i<( UPP ? j+1UL : M ); ++i )
959  {
961  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j) : A.upperBound(i,j) )
962  :( A.end(i) ) );
964  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
965  :( A.begin(i) ) );
966 
967  for( ; element!=end; ++element ) {
968  C(i,j) += element->value() * B(element->index(),j);
969  }
970  }
971  }
972  }
973  }
975  //**********************************************************************************************
976 
977  //**Optimized addition assignment to dense matrices*********************************************
991  template< typename MT3 // Type of the left-hand side target matrix
992  , typename MT4 // Type of the left-hand side matrix operand
993  , typename MT5 > // Type of the right-hand side matrix operand
995  selectAddAssignKernel( MT3& C, const MT4& A, const MT5& B )
996  {
998 
999  const size_t M( A.rows() );
1000  const size_t N( B.columns() );
1001 
1002  BLAZE_INTERNAL_ASSERT( !( LOW || UPP ) || M == N, "Broken invariant detected" );
1003 
1004  {
1005  size_t j( 0UL );
1006 
1007  for( ; (j+4UL) <= N; j+=4UL ) {
1008  for( size_t i=( LOW ? j : 0UL ); i<( UPP ? j+4UL : M ); ++i )
1009  {
1011  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j+4UL) : A.upperBound(i,j+4UL) )
1012  :( A.end(i) ) );
1013  ConstIterator element( ( IsLower<MT5>::value )
1014  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
1015  :( A.begin(i) ) );
1016 
1017  const size_t nonzeros( end - element );
1018  const size_t kpos( nonzeros & size_t(-4) );
1019  BLAZE_INTERNAL_ASSERT( ( nonzeros - ( nonzeros % 4UL ) ) == kpos, "Invalid end calculation" );
1020 
1021  for( size_t k=0UL; k<kpos; k+=4UL )
1022  {
1023  const size_t i1( element->index() );
1024  const ET1 v1( element->value() );
1025  ++element;
1026  const size_t i2( element->index() );
1027  const ET1 v2( element->value() );
1028  ++element;
1029  const size_t i3( element->index() );
1030  const ET1 v3( element->value() );
1031  ++element;
1032  const size_t i4( element->index() );
1033  const ET1 v4( element->value() );
1034  ++element;
1035 
1036  BLAZE_INTERNAL_ASSERT( i1 < i2 && i2 < i3 && i3 < i4, "Invalid sparse matrix index detected" );
1037 
1038  C(i,j ) += v1 * B(i1,j ) + v2 * B(i2,j ) + v3 * B(i3,j ) + v4 * B(i4,j );
1039  C(i,j+1UL) += v1 * B(i1,j+1UL) + v2 * B(i2,j+1UL) + v3 * B(i3,j+1UL) + v4 * B(i4,j+1UL);
1040  C(i,j+2UL) += v1 * B(i1,j+2UL) + v2 * B(i2,j+2UL) + v3 * B(i3,j+2UL) + v4 * B(i4,j+2UL);
1041  C(i,j+3UL) += v1 * B(i1,j+3UL) + v2 * B(i2,j+3UL) + v3 * B(i3,j+3UL) + v4 * B(i4,j+3UL);
1042  }
1043 
1044  for( ; element!=end; ++element )
1045  {
1046  const size_t i1( element->index() );
1047  const ET1 v1( element->value() );
1048 
1049  C(i,j ) += v1 * B(i1,j );
1050  C(i,j+1UL) += v1 * B(i1,j+1UL);
1051  C(i,j+2UL) += v1 * B(i1,j+2UL);
1052  C(i,j+3UL) += v1 * B(i1,j+3UL);
1053  }
1054  }
1055  }
1056 
1057  for( ; (j+2UL) <= N; j+=2UL ) {
1058  for( size_t i=( LOW ? j : 0UL ); i<( UPP ? j+2UL : M ); ++i )
1059  {
1061  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j+2UL) : A.upperBound(i,j+2UL) )
1062  :( A.end(i) ) );
1063  ConstIterator element( ( IsLower<MT5>::value )
1064  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
1065  :( A.begin(i) ) );
1066 
1067  const size_t nonzeros( end - element );
1068  const size_t kpos( nonzeros & size_t(-4) );
1069  BLAZE_INTERNAL_ASSERT( ( nonzeros - ( nonzeros % 4UL ) ) == kpos, "Invalid end calculation" );
1070 
1071  for( size_t k=0UL; k<kpos; k+=4UL )
1072  {
1073  const size_t i1( element->index() );
1074  const ET1 v1( element->value() );
1075  ++element;
1076  const size_t i2( element->index() );
1077  const ET1 v2( element->value() );
1078  ++element;
1079  const size_t i3( element->index() );
1080  const ET1 v3( element->value() );
1081  ++element;
1082  const size_t i4( element->index() );
1083  const ET1 v4( element->value() );
1084  ++element;
1085 
1086  BLAZE_INTERNAL_ASSERT( i1 < i2 && i2 < i3 && i3 < i4, "Invalid sparse matrix index detected" );
1087 
1088  C(i,j ) += v1 * B(i1,j ) + v2 * B(i2,j ) + v3 * B(i3,j ) + v4 * B(i4,j );
1089  C(i,j+1UL) += v1 * B(i1,j+1UL) + v2 * B(i2,j+1UL) + v3 * B(i3,j+1UL) + v4 * B(i4,j+1UL);
1090  }
1091 
1092  for( ; element!=end; ++element )
1093  {
1094  const size_t i1( element->index() );
1095  const ET1 v1( element->value() );
1096 
1097  C(i,j ) += v1 * B(i1,j );
1098  C(i,j+1UL) += v1 * B(i1,j+1UL);
1099  }
1100  }
1101  }
1102 
1103  for( ; j<N; ++j ) {
1104  for( size_t i=( LOW ? j : 0UL ); i<( UPP ? j+1UL : M ); ++i )
1105  {
1107  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j) : A.upperBound(i,j) )
1108  :( A.end(i) ) );
1109  ConstIterator element( ( IsLower<MT5>::value )
1110  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
1111  :( A.begin(i) ) );
1112 
1113  const size_t nonzeros( end - element );
1114  const size_t kpos( nonzeros & size_t(-4) );
1115  BLAZE_INTERNAL_ASSERT( ( nonzeros - ( nonzeros % 4UL ) ) == kpos, "Invalid end calculation" );
1116 
1117  for( size_t k=0UL; k<kpos; k+=4UL )
1118  {
1119  const size_t i1( element->index() );
1120  const ET1 v1( element->value() );
1121  ++element;
1122  const size_t i2( element->index() );
1123  const ET1 v2( element->value() );
1124  ++element;
1125  const size_t i3( element->index() );
1126  const ET1 v3( element->value() );
1127  ++element;
1128  const size_t i4( element->index() );
1129  const ET1 v4( element->value() );
1130  ++element;
1131 
1132  BLAZE_INTERNAL_ASSERT( i1 < i2 && i2 < i3 && i3 < i4, "Invalid sparse matrix index detected" );
1133 
1134  C(i,j) += v1 * B(i1,j) + v2 * B(i2,j) + v3 * B(i3,j) + v4 * B(i4,j);
1135  }
1136 
1137  for( ; element!=end; ++element )
1138  {
1139  const size_t i1( element->index() );
1140  const ET1 v1( element->value() );
1141 
1142  C(i,j) += v1 * B(i1,j);
1143  }
1144  }
1145  }
1146  }
1147  }
1149  //**********************************************************************************************
1150 
1151  //**Restructuring addition assignment***********************************************************
1166  template< typename MT // Type of the target matrix
1167  , bool SO > // Storage order of the target matrix
1169  addAssign( Matrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
1170  {
1172 
1173  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1174  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1175 
1176  const ForwardFunctor fwd;
1177 
1178  addAssign( ~lhs, fwd( rhs.lhs_ * trans( rhs.rhs_ ) ) );
1179  }
1181  //**********************************************************************************************
1182 
1183  //**Addition assignment to sparse matrices******************************************************
1184  // No special implementation for the addition assignment to sparse matrices.
1185  //**********************************************************************************************
1186 
1187  //**Subtraction assignment to dense matrices****************************************************
1200  template< typename MT // Type of the target dense matrix
1201  , bool SO > // Storage order of the target dense matrix
1203  subAssign( DenseMatrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
1204  {
1206 
1207  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1208  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1209 
1210  LT A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
1211  RT B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense matrix operand
1212 
1213  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
1214  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
1215  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
1216  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
1217  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
1218  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
1219 
1220  SMatTDMatMultExpr::selectSubAssignKernel( ~lhs, A, B );
1221  }
1223  //**********************************************************************************************
1224 
1225  //**Default subtraction assignment to dense matrices********************************************
1239  template< typename MT3 // Type of the left-hand side target matrix
1240  , typename MT4 // Type of the left-hand side matrix operand
1241  , typename MT5 > // Type of the right-hand side matrix operand
1243  selectSubAssignKernel( MT3& C, const MT4& A, const MT5& B )
1244  {
1246 
1247  const size_t M( A.rows() );
1248  const size_t N( B.columns() );
1249 
1250  BLAZE_INTERNAL_ASSERT( !( LOW || UPP ) || M == N, "Broken invariant detected" );
1251 
1252  {
1253  size_t j( 0UL );
1254 
1255  for( ; (j+4UL) <= N; j+=4UL ) {
1256  for( size_t i=( LOW ? j : 0UL ); i<( UPP ? j+4UL : M ); ++i )
1257  {
1259  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j+4UL) : A.upperBound(i,j+4UL) )
1260  :( A.end(i) ) );
1261  ConstIterator element( ( IsLower<MT5>::value )
1262  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
1263  :( A.begin(i) ) );
1264 
1265  for( ; element!=end; ++element ) {
1266  C(i,j ) -= element->value() * B(element->index(),j );
1267  C(i,j+1UL) -= element->value() * B(element->index(),j+1UL);
1268  C(i,j+2UL) -= element->value() * B(element->index(),j+2UL);
1269  C(i,j+3UL) -= element->value() * B(element->index(),j+3UL);
1270  }
1271  }
1272  }
1273 
1274  for( ; (j+2UL) <= N; j+=2UL ) {
1275  for( size_t i=( LOW ? j : 0UL ); i<( UPP ? j+2UL : M ); ++i )
1276  {
1278  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j+2UL) : A.upperBound(i,j+2UL) )
1279  :( A.end(i) ) );
1280  ConstIterator element( ( IsLower<MT5>::value )
1281  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
1282  :( A.begin(i) ) );
1283 
1284  for( ; element!=end; ++element ) {
1285  C(i,j ) -= element->value() * B(element->index(),j );
1286  C(i,j+1UL) -= element->value() * B(element->index(),j+1UL);
1287  }
1288  }
1289  }
1290 
1291  for( ; j<N; ++j ) {
1292  for( size_t i=( LOW ? j : 0UL ); i<( UPP ? j+1UL : M ); ++i )
1293  {
1295  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j) : A.upperBound(i,j) )
1296  :( A.end(i) ) );
1297  ConstIterator element( ( IsLower<MT5>::value )
1298  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
1299  :( A.begin(i) ) );
1300 
1301  for( ; element!=end; ++element ) {
1302  C(i,j) -= element->value() * B(element->index(),j);
1303  }
1304  }
1305  }
1306  }
1307  }
1309  //**********************************************************************************************
1310 
1311  //**Optimized subtraction assignment to dense matrices******************************************
1325  template< typename MT3 // Type of the left-hand side target matrix
1326  , typename MT4 // Type of the left-hand side matrix operand
1327  , typename MT5 > // Type of the right-hand side matrix operand
1329  selectSubAssignKernel( MT3& C, const MT4& A, const MT5& B )
1330  {
1332 
1333  const size_t M( A.rows() );
1334  const size_t N( B.columns() );
1335 
1336  BLAZE_INTERNAL_ASSERT( !( LOW || UPP ) || M == N, "Broken invariant detected" );
1337 
1338  {
1339  size_t j( 0UL );
1340 
1341  for( ; (j+4UL) <= N; j+=4UL ) {
1342  for( size_t i=( LOW ? j : 0UL ); i<( UPP ? j+4UL : M ); ++i )
1343  {
1345  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j+4UL) : A.upperBound(i,j+4UL) )
1346  :( A.end(i) ) );
1347  ConstIterator element( ( IsLower<MT5>::value )
1348  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
1349  :( A.begin(i) ) );
1350 
1351  const size_t nonzeros( end - element );
1352  const size_t kpos( nonzeros & size_t(-4) );
1353  BLAZE_INTERNAL_ASSERT( ( nonzeros - ( nonzeros % 4UL ) ) == kpos, "Invalid end calculation" );
1354 
1355  for( size_t k=0UL; k<kpos; k+=4UL )
1356  {
1357  const size_t i1( element->index() );
1358  const ET1 v1( element->value() );
1359  ++element;
1360  const size_t i2( element->index() );
1361  const ET1 v2( element->value() );
1362  ++element;
1363  const size_t i3( element->index() );
1364  const ET1 v3( element->value() );
1365  ++element;
1366  const size_t i4( element->index() );
1367  const ET1 v4( element->value() );
1368  ++element;
1369 
1370  BLAZE_INTERNAL_ASSERT( i1 < i2 && i2 < i3 && i3 < i4, "Invalid sparse matrix index detected" );
1371 
1372  C(i,j ) -= v1 * B(i1,j ) + v2 * B(i2,j ) + v3 * B(i3,j ) + v4 * B(i4,j );
1373  C(i,j+1UL) -= v1 * B(i1,j+1UL) + v2 * B(i2,j+1UL) + v3 * B(i3,j+1UL) + v4 * B(i4,j+1UL);
1374  C(i,j+2UL) -= v1 * B(i1,j+2UL) + v2 * B(i2,j+2UL) + v3 * B(i3,j+2UL) + v4 * B(i4,j+2UL);
1375  C(i,j+3UL) -= v1 * B(i1,j+3UL) + v2 * B(i2,j+3UL) + v3 * B(i3,j+3UL) + v4 * B(i4,j+3UL);
1376  }
1377 
1378  for( ; element!=end; ++element )
1379  {
1380  const size_t i1( element->index() );
1381  const ET1 v1( element->value() );
1382 
1383  C(i,j ) -= v1 * B(i1,j );
1384  C(i,j+1UL) -= v1 * B(i1,j+1UL);
1385  C(i,j+2UL) -= v1 * B(i1,j+2UL);
1386  C(i,j+3UL) -= v1 * B(i1,j+3UL);
1387  }
1388  }
1389  }
1390 
1391  for( ; (j+2UL) <= N; j+=2UL ) {
1392  for( size_t i=( LOW ? j : 0UL ); i<( UPP ? j+2UL : M ); ++i )
1393  {
1395  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j+2UL) : A.upperBound(i,j+2UL) )
1396  :( A.end(i) ) );
1397  ConstIterator element( ( IsLower<MT5>::value )
1398  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
1399  :( A.begin(i) ) );
1400 
1401  const size_t nonzeros( end - element );
1402  const size_t kpos( nonzeros & size_t(-4) );
1403  BLAZE_INTERNAL_ASSERT( ( nonzeros - ( nonzeros % 4UL ) ) == kpos, "Invalid end calculation" );
1404 
1405  for( size_t k=0UL; k<kpos; k+=4UL )
1406  {
1407  const size_t i1( element->index() );
1408  const ET1 v1( element->value() );
1409  ++element;
1410  const size_t i2( element->index() );
1411  const ET1 v2( element->value() );
1412  ++element;
1413  const size_t i3( element->index() );
1414  const ET1 v3( element->value() );
1415  ++element;
1416  const size_t i4( element->index() );
1417  const ET1 v4( element->value() );
1418  ++element;
1419 
1420  BLAZE_INTERNAL_ASSERT( i1 < i2 && i2 < i3 && i3 < i4, "Invalid sparse matrix index detected" );
1421 
1422  C(i,j ) -= v1 * B(i1,j ) + v2 * B(i2,j ) + v3 * B(i3,j ) + v4 * B(i4,j );
1423  C(i,j+1UL) -= v1 * B(i1,j+1UL) + v2 * B(i2,j+1UL) + v3 * B(i3,j+1UL) + v4 * B(i4,j+1UL);
1424  }
1425 
1426  for( ; element!=end; ++element )
1427  {
1428  const size_t i1( element->index() );
1429  const ET1 v1( element->value() );
1430 
1431  C(i,j ) -= v1 * B(i1,j );
1432  C(i,j+1UL) -= v1 * B(i1,j+1UL);
1433  }
1434  }
1435  }
1436 
1437  for( ; j<N; ++j ) {
1438  for( size_t i=( LOW ? j : 0UL ); i<( UPP ? j+1UL : M ); ++i )
1439  {
1441  ?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j) : A.upperBound(i,j) )
1442  :( A.end(i) ) );
1443  ConstIterator element( ( IsLower<MT5>::value )
1444  ?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
1445  :( A.begin(i) ) );
1446 
1447  const size_t nonzeros( end - element );
1448  const size_t kpos( nonzeros & size_t(-4) );
1449  BLAZE_INTERNAL_ASSERT( ( nonzeros - ( nonzeros % 4UL ) ) == kpos, "Invalid end calculation" );
1450 
1451  for( size_t k=0UL; k<kpos; k+=4UL )
1452  {
1453  const size_t i1( element->index() );
1454  const ET1 v1( element->value() );
1455  ++element;
1456  const size_t i2( element->index() );
1457  const ET1 v2( element->value() );
1458  ++element;
1459  const size_t i3( element->index() );
1460  const ET1 v3( element->value() );
1461  ++element;
1462  const size_t i4( element->index() );
1463  const ET1 v4( element->value() );
1464  ++element;
1465 
1466  BLAZE_INTERNAL_ASSERT( i1 < i2 && i2 < i3 && i3 < i4, "Invalid sparse matrix index detected" );
1467 
1468  C(i,j) -= v1 * B(i1,j) + v2 * B(i2,j) + v3 * B(i3,j) + v4 * B(i4,j);
1469  }
1470 
1471  for( ; element!=end; ++element )
1472  {
1473  const size_t i1( element->index() );
1474  const ET1 v1( element->value() );
1475 
1476  C(i,j) -= v1 * B(i1,j);
1477  }
1478  }
1479  }
1480  }
1481  }
1483  //**********************************************************************************************
1484 
1485  //**Restructuring subtraction assignment********************************************************
1500  template< typename MT // Type of the target matrix
1501  , bool SO > // Storage order of the target matrix
1503  subAssign( Matrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
1504  {
1506 
1507  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1508  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1509 
1510  const ForwardFunctor fwd;
1511 
1512  subAssign( ~lhs, fwd( rhs.lhs_ * trans( rhs.rhs_ ) ) );
1513  }
1515  //**********************************************************************************************
1516 
1517  //**Subtraction assignment to sparse matrices***************************************************
1518  // No special implementation for the subtraction assignment to sparse matrices.
1519  //**********************************************************************************************
1520 
1521  //**Schur product assignment to dense matrices**************************************************
1534  template< typename MT // Type of the target dense matrix
1535  , bool SO > // Storage order of the target dense matrix
1536  friend inline void schurAssign( DenseMatrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
1537  {
1539 
1543 
1544  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1545  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1546 
1547  const ResultType tmp( serial( rhs ) );
1548  schurAssign( ~lhs, tmp );
1549  }
1551  //**********************************************************************************************
1552 
1553  //**Schur product assignment to sparse matrices*************************************************
1554  // No special implementation for the Schur product assignment to sparse matrices.
1555  //**********************************************************************************************
1556 
1557  //**Multiplication assignment to dense matrices*************************************************
1558  // No special implementation for the multiplication assignment to dense matrices.
1559  //**********************************************************************************************
1560 
1561  //**Multiplication assignment to sparse matrices************************************************
1562  // No special implementation for the multiplication assignment to sparse matrices.
1563  //**********************************************************************************************
1564 
1565  //**SMP assignment to dense matrices************************************************************
1580  template< typename MT // Type of the target dense matrix
1581  , bool SO > // Storage order of the target dense matrix
1583  smpAssign( DenseMatrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
1584  {
1586 
1587  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1588  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1589 
1590  LT A( rhs.lhs_ ); // Evaluation of the left-hand side sparse matrix operand
1591  RT B( rhs.rhs_ ); // Evaluation of the right-hand side dense matrix operand
1592 
1593  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
1594  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
1595  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
1596  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
1597  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
1598  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
1599 
1600  smpAssign( ~lhs, A * B );
1601  }
1603  //**********************************************************************************************
1604 
1605  //**SMP assignment to sparse matrices***********************************************************
1620  template< typename MT // Type of the target sparse matrix
1621  , bool SO > // Storage order of the target sparse matrix
1623  smpAssign( SparseMatrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
1624  {
1626 
1628 
1635 
1636  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1637  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1638 
1639  const ForwardFunctor fwd;
1640 
1641  const TmpType tmp( rhs );
1642  smpAssign( ~lhs, fwd( tmp ) );
1643  }
1645  //**********************************************************************************************
1646 
1647  //**Restructuring SMP assignment****************************************************************
1662  template< typename MT // Type of the target matrix
1663  , bool SO > // Storage order of the target matrix
1665  smpAssign( Matrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
1666  {
1668 
1669  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1670  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1671 
1672  const ForwardFunctor fwd;
1673 
1674  smpAssign( ~lhs, fwd( rhs.lhs_ * trans( rhs.rhs_ ) ) );
1675  }
1677  //**********************************************************************************************
1678 
1679  //**SMP addition assignment to dense matrices***************************************************
1695  template< typename MT // Type of the target dense matrix
1696  , bool SO > // Storage order of the target dense matrix
1699  {
1701 
1702  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1703  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1704 
1705  LT A( rhs.lhs_ ); // Evaluation of the left-hand side sparse matrix operand
1706  RT B( rhs.rhs_ ); // Evaluation of the right-hand side dense matrix operand
1707 
1708  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
1709  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
1710  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
1711  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
1712  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
1713  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
1714 
1715  smpAddAssign( ~lhs, A * B );
1716  }
1718  //**********************************************************************************************
1719 
1720  //**Restructuring SMP addition assignment*******************************************************
1735  template< typename MT // Type of the target matrix
1736  , bool SO > // Storage order of the target matrix
1738  smpAddAssign( Matrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
1739  {
1741 
1742  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1743  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1744 
1745  const ForwardFunctor fwd;
1746 
1747  smpAddAssign( ~lhs, fwd( rhs.lhs_ * trans( rhs.rhs_ ) ) );
1748  }
1750  //**********************************************************************************************
1751 
1752  //**SMP addition assignment to sparse matrices**************************************************
1753  // No special implementation for the SMP addition assignment to sparse matrices.
1754  //**********************************************************************************************
1755 
1756  //**SMP subtraction assignment to dense matrices************************************************
1772  template< typename MT // Type of the target dense matrix
1773  , bool SO > // Storage order of the target dense matrix
1776  {
1778 
1779  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1780  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1781 
1782  LT A( rhs.lhs_ ); // Evaluation of the left-hand side sparse matrix operand
1783  RT B( rhs.rhs_ ); // Evaluation of the right-hand side dense matrix operand
1784 
1785  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
1786  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
1787  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
1788  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
1789  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
1790  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
1791 
1792  smpSubAssign( ~lhs, A * B );
1793  }
1795  //**********************************************************************************************
1796 
1797  //**Restructuring SMP subtraction assignment****************************************************
1812  template< typename MT // Type of the target matrix
1813  , bool SO > // Storage order of the target matrix
1815  smpSubAssign( Matrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
1816  {
1818 
1819  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1820  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1821 
1822  const ForwardFunctor fwd;
1823 
1824  smpSubAssign( ~lhs, fwd( rhs.lhs_ * trans( rhs.rhs_ ) ) );
1825  }
1827  //**********************************************************************************************
1828 
1829  //**SMP subtraction assignment to sparse matrices***********************************************
1830  // No special implementation for the SMP subtraction assignment to sparse matrices.
1831  //**********************************************************************************************
1832 
1833  //**SMP Schur product assignment to dense matrices**********************************************
1846  template< typename MT // Type of the target dense matrix
1847  , bool SO > // Storage order of the target dense matrix
1848  friend inline void smpSchurAssign( DenseMatrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
1849  {
1851 
1855 
1856  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1857  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1858 
1859  const ResultType tmp( rhs );
1860  smpSchurAssign( ~lhs, tmp );
1861  }
1863  //**********************************************************************************************
1864 
1865  //**SMP Schur product assignment to sparse matrices*********************************************
1866  // No special implementation for the SMP Schur product assignment to sparse matrices.
1867  //**********************************************************************************************
1868 
1869  //**SMP multiplication assignment to dense matrices*********************************************
1870  // No special implementation for the SMP multiplication assignment to dense matrices.
1871  //**********************************************************************************************
1872 
1873  //**SMP multiplication assignment to sparse matrices********************************************
1874  // No special implementation for the SMP multiplication assignment to sparse matrices.
1875  //**********************************************************************************************
1876 
1877  //**Compile time checks*************************************************************************
1885  //**********************************************************************************************
1886 };
1887 //*************************************************************************************************
1888 
1889 
1890 
1891 
1892 //=================================================================================================
1893 //
1894 // GLOBAL BINARY ARITHMETIC OPERATORS
1895 //
1896 //=================================================================================================
1897 
1898 //*************************************************************************************************
1929 template< typename MT1 // Type of the left-hand side sparse matrix
1930  , typename MT2 > // Type of the right-hand side dense matrix
1931 inline decltype(auto)
1932  operator*( const SparseMatrix<MT1,false>& lhs, const DenseMatrix<MT2,true>& rhs )
1933 {
1935 
1936  if( (~lhs).columns() != (~rhs).rows() ) {
1937  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1938  }
1939 
1941  return ReturnType( ~lhs, ~rhs );
1942 }
1943 //*************************************************************************************************
1944 
1945 
1946 
1947 
1948 //=================================================================================================
1949 //
1950 // GLOBAL FUNCTIONS
1951 //
1952 //=================================================================================================
1953 
1954 //*************************************************************************************************
1980 template< typename MT1 // Type of the left-hand side dense matrix
1981  , typename MT2 // Type of the right-hand side dense matrix
1982  , bool SF // Symmetry flag
1983  , bool HF // Hermitian flag
1984  , bool LF // Lower flag
1985  , bool UF > // Upper flag
1986 inline decltype(auto) declsym( const SMatTDMatMultExpr<MT1,MT2,SF,HF,LF,UF>& dm )
1987 {
1989 
1990  if( !isSquare( dm ) ) {
1991  BLAZE_THROW_INVALID_ARGUMENT( "Invalid symmetric matrix specification" );
1992  }
1993 
1995  return ReturnType( dm.leftOperand(), dm.rightOperand() );
1996 }
1998 //*************************************************************************************************
1999 
2000 
2001 //*************************************************************************************************
2027 template< typename MT1 // Type of the left-hand side dense matrix
2028  , typename MT2 // Type of the right-hand side dense matrix
2029  , bool SF // Symmetry flag
2030  , bool HF // Hermitian flag
2031  , bool LF // Lower flag
2032  , bool UF > // Upper flag
2033 inline decltype(auto) declherm( const SMatTDMatMultExpr<MT1,MT2,SF,HF,LF,UF>& dm )
2034 {
2036 
2037  if( !isSquare( dm ) ) {
2038  BLAZE_THROW_INVALID_ARGUMENT( "Invalid Hermitian matrix specification" );
2039  }
2040 
2042  return ReturnType( dm.leftOperand(), dm.rightOperand() );
2043 }
2045 //*************************************************************************************************
2046 
2047 
2048 //*************************************************************************************************
2074 template< typename MT1 // Type of the left-hand side dense matrix
2075  , typename MT2 // Type of the right-hand side dense matrix
2076  , bool SF // Symmetry flag
2077  , bool HF // Hermitian flag
2078  , bool LF // Lower flag
2079  , bool UF > // Upper flag
2080 inline decltype(auto) decllow( const SMatTDMatMultExpr<MT1,MT2,SF,HF,LF,UF>& dm )
2081 {
2083 
2084  if( !isSquare( dm ) ) {
2085  BLAZE_THROW_INVALID_ARGUMENT( "Invalid lower matrix specification" );
2086  }
2087 
2089  return ReturnType( dm.leftOperand(), dm.rightOperand() );
2090 }
2092 //*************************************************************************************************
2093 
2094 
2095 //*************************************************************************************************
2121 template< typename MT1 // Type of the left-hand side dense matrix
2122  , typename MT2 // Type of the right-hand side dense matrix
2123  , bool SF // Symmetry flag
2124  , bool HF // Hermitian flag
2125  , bool LF // Lower flag
2126  , bool UF > // Upper flag
2127 inline decltype(auto) declupp( const SMatTDMatMultExpr<MT1,MT2,SF,HF,LF,UF>& dm )
2128 {
2130 
2131  if( !isSquare( dm ) ) {
2132  BLAZE_THROW_INVALID_ARGUMENT( "Invalid upper matrix specification" );
2133  }
2134 
2136  return ReturnType( dm.leftOperand(), dm.rightOperand() );
2137 }
2139 //*************************************************************************************************
2140 
2141 
2142 //*************************************************************************************************
2168 template< typename MT1 // Type of the left-hand side dense matrix
2169  , typename MT2 // Type of the right-hand side dense matrix
2170  , bool SF // Symmetry flag
2171  , bool HF // Hermitian flag
2172  , bool LF // Lower flag
2173  , bool UF > // Upper flag
2174 inline decltype(auto) decldiag( const SMatTDMatMultExpr<MT1,MT2,SF,HF,LF,UF>& dm )
2175 {
2177 
2178  if( !isSquare( dm ) ) {
2179  BLAZE_THROW_INVALID_ARGUMENT( "Invalid diagonal matrix specification" );
2180  }
2181 
2183  return ReturnType( dm.leftOperand(), dm.rightOperand() );
2184 }
2186 //*************************************************************************************************
2187 
2188 
2189 
2190 
2191 //=================================================================================================
2192 //
2193 // SIZE SPECIALIZATIONS
2194 //
2195 //=================================================================================================
2196 
2197 //*************************************************************************************************
2199 template< typename MT1, typename MT2, bool SF, bool HF, bool LF, bool UF >
2200 struct Size< SMatTDMatMultExpr<MT1,MT2,SF,HF,LF,UF>, 0UL >
2201  : public Size<MT1,0UL>
2202 {};
2203 
2204 template< typename MT1, typename MT2, bool SF, bool HF, bool LF, bool UF >
2205 struct Size< SMatTDMatMultExpr<MT1,MT2,SF,HF,LF,UF>, 1UL >
2206  : public Size<MT2,1UL>
2207 {};
2209 //*************************************************************************************************
2210 
2211 
2212 
2213 
2214 //=================================================================================================
2215 //
2216 // ISALIGNED SPECIALIZATIONS
2217 //
2218 //=================================================================================================
2219 
2220 //*************************************************************************************************
2222 template< typename MT1, typename MT2, bool SF, bool HF, bool LF, bool UF >
2223 struct IsAligned< SMatTDMatMultExpr<MT1,MT2,SF,HF,LF,UF> >
2224  : public IsAligned<MT2>
2225 {};
2227 //*************************************************************************************************
2228 
2229 
2230 
2231 
2232 //=================================================================================================
2233 //
2234 // ISSYMMETRIC SPECIALIZATIONS
2235 //
2236 //=================================================================================================
2237 
2238 //*************************************************************************************************
2240 template< typename MT1, typename MT2, bool SF, bool HF, bool LF, bool UF >
2241 struct IsSymmetric< SMatTDMatMultExpr<MT1,MT2,SF,HF,LF,UF> >
2242  : public Or< Bool<SF>
2243  , And< Bool<HF>
2244  , IsBuiltin< ElementType_< SMatTDMatMultExpr<MT1,MT2,false,true,false,false> > > >
2245  , And< Bool<LF>, Bool<UF> > >
2246 {};
2248 //*************************************************************************************************
2249 
2250 
2251 
2252 
2253 //=================================================================================================
2254 //
2255 // ISHERMITIAN SPECIALIZATIONS
2256 //
2257 //=================================================================================================
2258 
2259 //*************************************************************************************************
2261 template< typename MT1, typename MT2, bool SF, bool LF, bool UF >
2262 struct IsHermitian< SMatTDMatMultExpr<MT1,MT2,SF,true,LF,UF> >
2263  : public TrueType
2264 {};
2266 //*************************************************************************************************
2267 
2268 
2269 
2270 
2271 //=================================================================================================
2272 //
2273 // ISLOWER SPECIALIZATIONS
2274 //
2275 //=================================================================================================
2276 
2277 //*************************************************************************************************
2279 template< typename MT1, typename MT2, bool SF, bool HF, bool LF, bool UF >
2280 struct IsLower< SMatTDMatMultExpr<MT1,MT2,SF,HF,LF,UF> >
2281  : public Or< Bool<LF>
2282  , And< IsLower<MT1>, IsLower<MT2> >
2283  , And< Or< Bool<SF>, Bool<HF> >
2284  , IsUpper<MT1>, IsUpper<MT2> > >
2285 {};
2287 //*************************************************************************************************
2288 
2289 
2290 
2291 
2292 //=================================================================================================
2293 //
2294 // ISUNILOWER SPECIALIZATIONS
2295 //
2296 //=================================================================================================
2297 
2298 //*************************************************************************************************
2300 template< typename MT1, typename MT2, bool SF, bool HF, bool LF, bool UF >
2301 struct IsUniLower< SMatTDMatMultExpr<MT1,MT2,SF,HF,LF,UF> >
2302  : public Or< And< IsUniLower<MT1>, IsUniLower<MT2> >
2303  , And< Or< Bool<SF>, Bool<HF> >
2304  , IsUniUpper<MT1>, IsUniUpper<MT2> > >
2305 {};
2307 //*************************************************************************************************
2308 
2309 
2310 
2311 
2312 //=================================================================================================
2313 //
2314 // ISSTRICTLYLOWER SPECIALIZATIONS
2315 //
2316 //=================================================================================================
2317 
2318 //*************************************************************************************************
2320 template< typename MT1, typename MT2, bool SF, bool HF, bool LF, bool UF >
2321 struct IsStrictlyLower< SMatTDMatMultExpr<MT1,MT2,SF,HF,LF,UF> >
2322  : public Or< And< IsStrictlyLower<MT1>, IsLower<MT2> >
2323  , And< IsStrictlyLower<MT2>, IsLower<MT1> >
2324  , And< Or< Bool<SF>, Bool<HF> >
2325  , Or< And< IsStrictlyUpper<MT1>, IsUpper<MT2> >
2326  , And< IsStrictlyUpper<MT2>, IsUpper<MT1> > > > >
2327 {};
2329 //*************************************************************************************************
2330 
2331 
2332 
2333 
2334 //=================================================================================================
2335 //
2336 // ISUPPER SPECIALIZATIONS
2337 //
2338 //=================================================================================================
2339 
2340 //*************************************************************************************************
2342 template< typename MT1, typename MT2, bool SF, bool HF, bool LF, bool UF >
2343 struct IsUpper< SMatTDMatMultExpr<MT1,MT2,SF,HF,LF,UF> >
2344  : public Or< Bool<UF>
2345  , And< IsUpper<MT1>, IsUpper<MT2> >
2346  , And< Or< Bool<SF>, Bool<HF> >
2347  , IsLower<MT1>, IsLower<MT2> > >
2348 {};
2350 //*************************************************************************************************
2351 
2352 
2353 
2354 
2355 //=================================================================================================
2356 //
2357 // ISUNIUPPER SPECIALIZATIONS
2358 //
2359 //=================================================================================================
2360 
2361 //*************************************************************************************************
2363 template< typename MT1, typename MT2, bool SF, bool HF, bool LF, bool UF >
2364 struct IsUniUpper< SMatTDMatMultExpr<MT1,MT2,SF,HF,LF,UF> >
2365  : public Or< And< IsUniUpper<MT1>, IsUniUpper<MT2> >
2366  , And< Or< Bool<SF>, Bool<HF> >
2367  , IsUniLower<MT1>, IsUniLower<MT2> > >
2368 {};
2370 //*************************************************************************************************
2371 
2372 
2373 
2374 
2375 //=================================================================================================
2376 //
2377 // ISSTRICTLYUPPER SPECIALIZATIONS
2378 //
2379 //=================================================================================================
2380 
2381 //*************************************************************************************************
2383 template< typename MT1, typename MT2, bool SF, bool HF, bool LF, bool UF >
2384 struct IsStrictlyUpper< SMatTDMatMultExpr<MT1,MT2,SF,HF,LF,UF> >
2385  : public Or< And< IsStrictlyUpper<MT1>, IsUpper<MT2> >
2386  , And< IsStrictlyUpper<MT2>, IsUpper<MT1> >
2387  , And< Or< Bool<SF>, Bool<HF> >
2388  , Or< And< IsStrictlyLower<MT1>, IsLower<MT2> >
2389  , And< IsStrictlyLower<MT2>, IsLower<MT1> > > > >
2390 {};
2392 //*************************************************************************************************
2393 
2394 } // namespace blaze
2395 
2396 #endif
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:131
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:71
IfTrue_< evaluateLeft, const RT1, CT1 > LT
Type for the assignment of the left-hand side sparse matrix operand.
Definition: SMatTDMatMultExpr.h:236
decltype(auto) decldiag(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as diagonal.
Definition: DMatDeclDiagExpr.h:996
Header file for the IsUniUpper type trait.
EnableIf_< IsDenseMatrix< MT1 > > smpSchurAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP Schur product assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:196
Compile time check for triangular matrix types.This type trait tests whether or not the given templat...
Definition: IsTriangular.h:86
Header file for basic type definitions.
Flag for upper matrices.
Definition: SMatTDMatMultExpr.h:151
ResultType_< MT2 > RT2
Result type of the right-hand side dense matrix expression.
Definition: SMatTDMatMultExpr.h:128
const ElementType ReturnType
Return type for expression template evaluations.
Definition: SMatTDMatMultExpr.h:226
RightOperand rightOperand() const noexcept
Returns the right-hand side transpose dense matrix operand.
Definition: SMatTDMatMultExpr.h:367
ResultType_< MT1 > RT1
Result type of the left-hand side sparse matrix expression.
Definition: SMatTDMatMultExpr.h:127
Flag for Hermitian matrices.
Definition: SMatTDMatMultExpr.h:149
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:164
Header file for the serial shim.
ElementType_< ResultType > ElementType
Resulting element type.
Definition: SMatTDMatMultExpr.h:225
Header file for the IsDiagonal type trait.
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
Header file for the DeclUpp functor.
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:364
Flag for lower matrices.
Definition: SMatTDMatMultExpr.h:150
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatTDMatMultExpr.h:347
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
Header file for the And class template.
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:87
decltype(auto) declupp(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as upper.
Definition: DMatDeclUppExpr.h:1026
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatTDMatMultExpr.h:391
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatTDMatMultExpr.h:224
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:291
Header file for the Computation base class.
Header file for the MatMatMultExpr base class.
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:87
Constraints on the storage order of matrix types.
Header file for the RequiresEvaluation type trait.
System settings for performance optimizations.
Header file for the IsUniLower type trait.
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1950
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:133
CompositeType_< MT1 > CT1
Composite type of the left-hand side sparse matrix expression.
Definition: SMatTDMatMultExpr.h:131
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatTDMatMultExpr.h:337
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:129
CompositeType_< MT2 > CT2
Composite type of the right-hand side dense matrix expression.
Definition: SMatTDMatMultExpr.h:132
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
Compile time check for the alignment of data types.This type trait tests whether the given data type ...
Definition: IsAligned.h:87
Constraint on the data type.
Constraint on the data type.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:71
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatTDMatMultExpr.h:379
Compile time check for upper unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniUpper.h:86
Headerfile for the generic max algorithm.
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the DeclLow functor.
Header file for the If class template.
#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
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatTDMatMultExpr.h:411
OppositeType_< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatTDMatMultExpr.h:223
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: SMatTDMatMultExpr.h:401
Generic wrapper for the decllow() function.
Definition: DeclLow.h:58
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:102
Header file for the Or class template.
#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
Header file for the DenseMatrix base class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
decltype(auto) decllow(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as lower.
Definition: DMatDeclLowExpr.h:1026
Header file for the IsLower type trait.
LeftOperand lhs_
Left-hand side sparse matrix of the multiplication expression.
Definition: SMatTDMatMultExpr.h:418
Header file for the IsAligned type trait.
Compile time check for diagonal matrices.This type trait tests whether or not the given template para...
Definition: IsDiagonal.h:89
If_< IsExpression< MT2 >, const MT2, const MT2 &> RightOperand
Composite type of the right-hand side dense matrix expression.
Definition: SMatTDMatMultExpr.h:233
Expression object for sparse matrix-transpose dense matrix multiplications.The SMatTDMatMultExpr clas...
Definition: Forward.h:121
const ResultType CompositeType
Data type for composite expression templates.
Definition: SMatTDMatMultExpr.h:227
Generic wrapper for the null function.
Definition: Noop.h:59
Header file for the IsTriangular type trait.
Constraints on the storage order of matrix types.
Compile time check for symmetric matrices.This type trait tests whether or not the given template par...
Definition: IsSymmetric.h:85
Header file for the exception macros of the math module.
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
BLAZE_ALWAYS_INLINE 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:430
Header file for the DeclDiag functor.
ElementType_< RT2 > ET2
Element type of the right-hand side sparse matrix expression.
Definition: SMatTDMatMultExpr.h:130
Constraint on the data type.
Header file for all forward declarations for expression class templates.
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:107
Compile time check for lower unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniLower.h:86
Header file for the conjugate shim.
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
#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
Header file for run time assertion macros.
ElementType_< RT1 > ET1
Element type of the left-hand side dense matrix expression.
Definition: SMatTDMatMultExpr.h:129
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:154
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:131
Header file for the reset shim.
#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
decltype(auto) declsym(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as symmetric.
Definition: DMatDeclSymExpr.h:1028
Compile time check for Hermitian matrices.This type trait tests whether or not the given template par...
Definition: IsHermitian.h:85
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:101
Constraints on the storage order of matrix types.
Generic wrapper for the declherm() function.
Definition: DeclHerm.h:58
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:816
SMatTDMatMultExpr(const MT1 &lhs, const MT2 &rhs) noexcept
Constructor for the SMatTDMatMultExpr class.
Definition: SMatTDMatMultExpr.h:257
Header file for the Noop functor.
#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
Header file for the RemoveReference type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
typename T::OppositeType OppositeType_
Alias declaration for nested OppositeType type definitions.The OppositeType_ alias declaration provid...
Definition: Aliases.h:263
#define BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER(T1, T2)
Constraint on the data type.In case either of the two given data types T1 or T2 is not a matrix type ...
Definition: StorageOrder.h:84
Flag for symmetric matrices.
Definition: SMatTDMatMultExpr.h:148
Generic wrapper for the declupp() function.
Definition: DeclUpp.h:58
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:789
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse matrix operand.
Definition: SMatTDMatMultExpr.h:357
decltype(auto) declherm(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as Hermitian.
Definition: DMatDeclHermExpr.h:1028
Header file for the IsComputation type trait class.
RightOperand rhs_
Right-hand side dense matrix of the multiplication expression.
Definition: SMatTDMatMultExpr.h:419
Header file for the IsBuiltin type trait.
Compile time logical &#39;or&#39; evaluation.The Or alias declaration performs at compile time a logical &#39;or&#39;...
Definition: Or.h:76
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatTDMatMultExpr.h:272
Compile time evaluation of the size of vectors and matrices.The Size type trait evaluates the size of...
Definition: Size.h:80
If_< IsExpression< MT1 >, const MT1, const MT1 &> LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: SMatTDMatMultExpr.h:230
Generic wrapper for the decldiag() function.
Definition: DeclDiag.h:58
Header file for the DeclHerm functor.
IfTrue_< evaluateRight, const RT2, CT2 > RT
Type for the assignment of the right-hand side dense matrix operand.
Definition: SMatTDMatMultExpr.h:239
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:423
Header file for the IsUpper type trait.
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1321
Constraint on the data type.
Generic wrapper for the declsym() function.
Definition: DeclSym.h:58
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:908
Header file for the IsResizable type trait.
MultTrait_< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: SMatTDMatMultExpr.h:222
Header file for the Size type trait.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the Bool class template.
Header file for the DeclSym functor.
#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 TrueType type/value trait base class.
Header file for the IsExpression type trait class.
Header file for the function trace functionality.
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatTDMatMultExpr.h:321