Blaze  3.6
DMatDMatMapExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATDMATMAPEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATDMATMAPEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <utility>
45 #include <blaze/math/Aliases.h>
49 #include <blaze/math/Exception.h>
62 #include <blaze/math/functors/Or.h>
67 #include <blaze/math/SIMD.h>
77 #include <blaze/system/Inline.h>
78 #include <blaze/util/Assert.h>
79 #include <blaze/util/EnableIf.h>
82 #include <blaze/util/mpl/If.h>
83 #include <blaze/util/Types.h>
85 
86 
87 namespace blaze {
88 
89 //=================================================================================================
90 //
91 // CLASS DMATDMATMAPEXPR
92 //
93 //=================================================================================================
94 
95 //*************************************************************************************************
103 template< typename MT1 // Type of the left-hand side dense matrix
104  , typename MT2 // Type of the right-hand side dense matrix
105  , typename OP // Type of the custom operation
106  , bool SO > // Storage order
108  : public MatMatMapExpr< DenseMatrix< DMatDMatMapExpr<MT1,MT2,OP,SO>, SO > >
109  , private Computation
110 {
111  private:
112  //**Type definitions****************************************************************************
121  //**********************************************************************************************
122 
123  //**Serial evaluation strategy******************************************************************
125 
131  static constexpr bool useAssign = ( RequiresEvaluation_v<MT1> || RequiresEvaluation_v<MT2> );
132 
134  template< typename MT >
136  static constexpr bool UseAssign_v = useAssign;
138  //**********************************************************************************************
139 
140  //**Parallel evaluation strategy****************************************************************
142 
148  template< typename MT >
149  static constexpr bool UseSMPAssign_v =
150  ( ( !MT1::smpAssignable || !MT2::smpAssignable ) && useAssign );
152  //**********************************************************************************************
153 
154  public:
155  //**Type definitions****************************************************************************
162 
164  using ReturnType = decltype( std::declval<OP>()( std::declval<RN1>(), std::declval<RN2>() ) );
165 
168 
170  using LeftOperand = If_t< IsExpression_v<MT1>, const MT1, const MT1& >;
171 
173  using RightOperand = If_t< IsExpression_v<MT2>, const MT2, const MT2& >;
174 
176  using Operation = OP;
177 
180 
183  //**********************************************************************************************
184 
185  //**ConstIterator class definition**************************************************************
189  {
190  public:
191  //**Type definitions*************************************************************************
192  using IteratorCategory = std::random_access_iterator_tag;
197 
198  // STL iterator requirements
204 
207 
210  //*******************************************************************************************
211 
212  //**Constructor******************************************************************************
219  explicit inline ConstIterator( LeftIteratorType left, RightIteratorType right, OP op )
220  : left_ ( left ) // Iterator to the current left-hand side element
221  , right_( right ) // Iterator to the current right-hand side element
222  , op_ ( op ) // The custom unary operation
223  {}
224  //*******************************************************************************************
225 
226  //**Addition assignment operator*************************************************************
233  left_ += inc;
234  right_ += inc;
235  return *this;
236  }
237  //*******************************************************************************************
238 
239  //**Subtraction assignment operator**********************************************************
246  left_ -= dec;
247  right_ -= dec;
248  return *this;
249  }
250  //*******************************************************************************************
251 
252  //**Prefix increment operator****************************************************************
258  ++left_;
259  ++right_;
260  return *this;
261  }
262  //*******************************************************************************************
263 
264  //**Postfix increment operator***************************************************************
270  return ConstIterator( left_++, right_++, op_ );
271  }
272  //*******************************************************************************************
273 
274  //**Prefix decrement operator****************************************************************
280  --left_;
281  --right_;
282  return *this;
283  }
284  //*******************************************************************************************
285 
286  //**Postfix decrement operator***************************************************************
292  return ConstIterator( left_--, right_--, op_ );
293  }
294  //*******************************************************************************************
295 
296  //**Element access operator******************************************************************
301  inline ReturnType operator*() const {
302  return op_( *left_, *right_ );
303  }
304  //*******************************************************************************************
305 
306  //**Load function****************************************************************************
311  inline auto load() const noexcept {
312  return op_.load( left_.load(), right_.load() );
313  }
314  //*******************************************************************************************
315 
316  //**Equality operator************************************************************************
322  inline BLAZE_DEVICE_CALLABLE bool operator==( const ConstIterator& rhs ) const {
323  return left_ == rhs.left_;
324  }
325  //*******************************************************************************************
326 
327  //**Inequality operator**********************************************************************
333  inline BLAZE_DEVICE_CALLABLE bool operator!=( const ConstIterator& rhs ) const {
334  return left_ != rhs.left_;
335  }
336  //*******************************************************************************************
337 
338  //**Less-than operator***********************************************************************
344  inline BLAZE_DEVICE_CALLABLE bool operator<( const ConstIterator& rhs ) const {
345  return left_ < rhs.left_;
346  }
347  //*******************************************************************************************
348 
349  //**Greater-than operator********************************************************************
355  inline BLAZE_DEVICE_CALLABLE bool operator>( const ConstIterator& rhs ) const {
356  return left_ > rhs.left_;
357  }
358  //*******************************************************************************************
359 
360  //**Less-or-equal-than operator**************************************************************
366  inline BLAZE_DEVICE_CALLABLE bool operator<=( const ConstIterator& rhs ) const {
367  return left_ <= rhs.left_;
368  }
369  //*******************************************************************************************
370 
371  //**Greater-or-equal-than operator***********************************************************
377  inline BLAZE_DEVICE_CALLABLE bool operator>=( const ConstIterator& rhs ) const {
378  return left_ >= rhs.left_;
379  }
380  //*******************************************************************************************
381 
382  //**Subtraction operator*********************************************************************
389  return left_ - rhs.left_;
390  }
391  //*******************************************************************************************
392 
393  //**Addition operator************************************************************************
400  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
401  return ConstIterator( it.left_ + inc, it.right_ + inc, it.op_ );
402  }
403  //*******************************************************************************************
404 
405  //**Addition operator************************************************************************
412  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
413  return ConstIterator( it.left_ + inc, it.right_ + inc, it.op_ );
414  }
415  //*******************************************************************************************
416 
417  //**Subtraction operator*********************************************************************
424  friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
425  return ConstIterator( it.left_ - dec, it.right_ - dec, it.op_ );
426  }
427  //*******************************************************************************************
428 
429  private:
430  //**Member variables*************************************************************************
433  OP op_;
434  //*******************************************************************************************
435  };
436  //**********************************************************************************************
437 
438  //**Compilation flags***************************************************************************
440  static constexpr bool simdEnabled =
441  ( MT1::simdEnabled && MT2::simdEnabled &&
442  If_t< HasSIMDEnabled_v<OP>, GetSIMDEnabled<OP,ET1,ET2>, HasLoad<OP> >::value );
443 
445  static constexpr bool smpAssignable = ( MT1::smpAssignable && MT2::smpAssignable );
446  //**********************************************************************************************
447 
448  //**SIMD properties*****************************************************************************
450  static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
451  //**********************************************************************************************
452 
453  //**Constructor*********************************************************************************
460  explicit inline DMatDMatMapExpr( const MT1& lhs, const MT2& rhs, OP op ) noexcept
461  : lhs_( lhs ) // Left-hand side dense matrix of the map expression
462  , rhs_( rhs ) // Right-hand side dense matrix of the map expression
463  , op_ ( op ) // The custom unary operation
464  {}
465  //**********************************************************************************************
466 
467  //**Access operator*****************************************************************************
474  inline ReturnType operator()( size_t i, size_t j ) const {
475  BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
476  BLAZE_INTERNAL_ASSERT( j < lhs_.columns(), "Invalid column access index" );
477  return op_( lhs_(i,j), rhs_(i,j) );
478  }
479  //**********************************************************************************************
480 
481  //**At function*********************************************************************************
489  inline ReturnType at( size_t i, size_t j ) const {
490  if( i >= lhs_.rows() ) {
491  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
492  }
493  if( j >= lhs_.columns() ) {
494  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
495  }
496  return (*this)(i,j);
497  }
498  //**********************************************************************************************
499 
500  //**Load function*******************************************************************************
507  BLAZE_ALWAYS_INLINE auto load( size_t i, size_t j ) const noexcept {
508  BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
509  BLAZE_INTERNAL_ASSERT( j < lhs_.columns(), "Invalid column access index" );
510  BLAZE_INTERNAL_ASSERT( !SO || ( i % SIMDSIZE == 0UL ), "Invalid row access index" );
511  BLAZE_INTERNAL_ASSERT( SO || ( j % SIMDSIZE == 0UL ), "Invalid column access index" );
512  return op_.load( lhs_.load(i,j), rhs_.load(i,j) );
513  }
514  //**********************************************************************************************
515 
516  //**Begin function******************************************************************************
522  inline ConstIterator begin( size_t i ) const {
523  return ConstIterator( lhs_.begin(i), rhs_.begin(i), op_ );
524  }
525  //**********************************************************************************************
526 
527  //**End function********************************************************************************
533  inline ConstIterator end( size_t i ) const {
534  return ConstIterator( lhs_.end(i), rhs_.end(i), op_ );
535  }
536  //**********************************************************************************************
537 
538  //**Rows function*******************************************************************************
543  inline size_t rows() const noexcept {
544  return lhs_.rows();
545  }
546  //**********************************************************************************************
547 
548  //**Columns function****************************************************************************
553  inline size_t columns() const noexcept {
554  return lhs_.columns();
555  }
556  //**********************************************************************************************
557 
558  //**Left operand access*************************************************************************
563  inline LeftOperand leftOperand() const noexcept {
564  return lhs_;
565  }
566  //**********************************************************************************************
567 
568  //**Right operand access************************************************************************
573  inline RightOperand rightOperand() const noexcept {
574  return rhs_;
575  }
576  //**********************************************************************************************
577 
578  //**Operation access****************************************************************************
583  inline Operation operation() const {
584  return op_;
585  }
586  //**********************************************************************************************
587 
588  //**********************************************************************************************
594  template< typename T >
595  inline bool canAlias( const T* alias ) const noexcept {
596  return ( IsExpression_v<MT1> && lhs_.canAlias( alias ) ) ||
597  ( IsExpression_v<MT2> && rhs_.canAlias( alias ) );
598  }
599  //**********************************************************************************************
600 
601  //**********************************************************************************************
607  template< typename T >
608  inline bool isAliased( const T* alias ) const noexcept {
609  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
610  }
611  //**********************************************************************************************
612 
613  //**********************************************************************************************
618  inline bool isAligned() const noexcept {
619  return lhs_.isAligned() && rhs_.isAligned();
620  }
621  //**********************************************************************************************
622 
623  //**********************************************************************************************
628  inline bool canSMPAssign() const noexcept {
629  return lhs_.canSMPAssign() && rhs_.canSMPAssign();
630  }
631  //**********************************************************************************************
632 
633  private:
634  //**Member variables****************************************************************************
638  //**********************************************************************************************
639 
640  //**Assignment to dense matrices****************************************************************
654  template< typename MT // Type of the target dense matrix
655  , bool SO2 > // Storage order of the target dense matrix
656  friend inline auto assign( DenseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
658  {
660 
661  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
662  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
663 
664  LT A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense matrix operand
665  RT B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense matrix operand
666 
667  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
668  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
669  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
670  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
671  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
672  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
673 
674  assign( ~lhs, map( A, B, rhs.op_ ) );
675  }
677  //**********************************************************************************************
678 
679  //**Assignment to sparse matrices***************************************************************
693  template< typename MT // Type of the target sparse matrix
694  , bool SO2 > // Storage order of the target sparse matrix
695  friend inline auto assign( SparseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
697  {
699 
701 
708 
709  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
710  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
711 
712  const TmpType tmp( serial( rhs ) );
713  assign( ~lhs, tmp );
714  }
716  //**********************************************************************************************
717 
718  //**Addition assignment to dense matrices*******************************************************
732  template< typename MT // Type of the target dense matrix
733  , bool SO2 > // Storage order of the target dense matrix
734  friend inline auto addAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
735  -> EnableIf_t< UseAssign_v<MT> >
736  {
738 
739  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
740  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
741 
742  LT A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense matrix operand
743  RT B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense matrix operand
744 
745  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
746  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
747  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
748  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
749  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
750  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
751 
752  addAssign( ~lhs, map( A, B, rhs.op_ ) );
753  }
755  //**********************************************************************************************
756 
757  //**Addition assignment to sparse matrices******************************************************
758  // No special implementation for the addition assignment to sparse matrices.
759  //**********************************************************************************************
760 
761  //**Subtraction assignment to dense matrices****************************************************
775  template< typename MT // Type of the target dense matrix
776  , bool SO2 > // Storage order of the target dense matrix
777  friend inline auto subAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
778  -> EnableIf_t< UseAssign_v<MT> >
779  {
781 
782  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
783  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
784 
785  LT A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense matrix operand
786  RT B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense matrix operand
787 
788  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
789  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
790  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
791  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
792  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
793  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
794 
795  subAssign( ~lhs, map( A, B, rhs.op_ ) );
796  }
798  //**********************************************************************************************
799 
800  //**Subtraction assignment to sparse matrices***************************************************
801  // No special implementation for the subtraction assignment to sparse matrices.
802  //**********************************************************************************************
803 
804  //**Schur product assignment to dense matrices**************************************************
818  template< typename MT // Type of the target dense matrix
819  , bool SO2 > // Storage order of the target dense matrix
820  friend inline auto schurAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
821  -> EnableIf_t< UseAssign_v<MT> >
822  {
824 
825  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
826  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
827 
828  LT A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense matrix operand
829  RT B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense matrix operand
830 
831  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
832  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
833  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
834  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
835  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
836  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
837 
838  schurAssign( ~lhs, map( A, B, rhs.op_ ) );
839  }
841  //**********************************************************************************************
842 
843  //**Schur product assignment to sparse matrices*************************************************
844  // No special implementation for the Schur product assignment to sparse matrices.
845  //**********************************************************************************************
846 
847  //**Multiplication assignment to dense matrices*************************************************
848  // No special implementation for the multiplication assignment to dense matrices.
849  //**********************************************************************************************
850 
851  //**Multiplication assignment to sparse matrices************************************************
852  // No special implementation for the multiplication assignment to sparse matrices.
853  //**********************************************************************************************
854 
855  //**SMP assignment to dense matrices************************************************************
869  template< typename MT // Type of the target dense matrix
870  , bool SO2 > // Storage order of the target dense matrix
871  friend inline auto smpAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
872  -> EnableIf_t< UseSMPAssign_v<MT> >
873  {
875 
876  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
877  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
878 
879  LT A( rhs.lhs_ ); // Evaluation of the left-hand side dense matrix operand
880  RT B( rhs.rhs_ ); // Evaluation of the right-hand side dense matrix operand
881 
882  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
883  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
884  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
885  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
886  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
887  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
888 
889  smpAssign( ~lhs, map( A, B, rhs.op_ ) );
890  }
892  //**********************************************************************************************
893 
894  //**SMP assignment to sparse matrices***********************************************************
908  template< typename MT // Type of the target sparse matrix
909  , bool SO2 > // Storage order of the target sparse matrix
910  friend inline auto smpAssign( SparseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
911  -> EnableIf_t< UseSMPAssign_v<MT> >
912  {
914 
915  using TmpType = If_t< SO == SO2, ResultType, OppositeType >;
916 
923 
924  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
925  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
926 
927  const TmpType tmp( rhs );
928  smpAssign( ~lhs, tmp );
929  }
931  //**********************************************************************************************
932 
933  //**SMP addition assignment to dense matrices***************************************************
948  template< typename MT // Type of the target dense matrix
949  , bool SO2 > // Storage order of the target dense matrix
950  friend inline auto smpAddAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
951  -> EnableIf_t< UseSMPAssign_v<MT> >
952  {
954 
955  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
956  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
957 
958  LT A( rhs.lhs_ ); // Evaluation of the left-hand side dense matrix operand
959  RT B( rhs.rhs_ ); // Evaluation of the right-hand side dense matrix operand
960 
961  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
962  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
963  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
964  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
965  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
966  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
967 
968  smpAddAssign( ~lhs, map( A, B, rhs.op_ ) );
969  }
971  //**********************************************************************************************
972 
973  //**SMP addition assignment to sparse matrices**************************************************
974  // No special implementation for the SMP addition assignment to sparse matrices.
975  //**********************************************************************************************
976 
977  //**SMP subtraction assignment to dense matrices************************************************
992  template< typename MT // Type of the target dense matrix
993  , bool SO2 > // Storage order of the target dense matrix
994  friend inline auto smpSubAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
995  -> EnableIf_t< UseSMPAssign_v<MT> >
996  {
998 
999  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1000  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1001 
1002  LT A( rhs.lhs_ ); // Evaluation of the left-hand side dense matrix operand
1003  RT B( rhs.rhs_ ); // Evaluation of the right-hand side dense matrix operand
1004 
1005  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
1006  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
1007  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
1008  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
1009  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
1010  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
1011 
1012  smpSubAssign( ~lhs, map( A, B, rhs.op_ ) );
1013  }
1015  //**********************************************************************************************
1016 
1017  //**SMP subtraction assignment to sparse matrices***********************************************
1018  // No special implementation for the SMP subtraction assignment to sparse matrices.
1019  //**********************************************************************************************
1020 
1021  //**SMP Schur product assignment to dense matrices**********************************************
1036  template< typename MT // Type of the target dense matrix
1037  , bool SO2 > // Storage order of the target dense matrix
1038  friend inline auto smpSchurAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatMapExpr& rhs )
1039  -> EnableIf_t< UseSMPAssign_v<MT> >
1040  {
1042 
1043  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1044  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1045 
1046  LT A( rhs.lhs_ ); // Evaluation of the left-hand side dense matrix operand
1047  RT B( rhs.rhs_ ); // Evaluation of the right-hand side dense matrix operand
1048 
1049  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
1050  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
1051  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
1052  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
1053  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
1054  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
1055 
1056  smpSchurAssign( ~lhs, map( A, B, rhs.op_ ) );
1057  }
1059  //**********************************************************************************************
1060 
1061  //**SMP Schur product assignment to sparse matrices*********************************************
1062  // No special implementation for the SMP Schur product assignment to sparse matrices.
1063  //**********************************************************************************************
1064 
1065  //**SMP multiplication assignment to dense matrices*********************************************
1066  // No special implementation for the SMP multiplication assignment to dense matrices.
1067  //**********************************************************************************************
1068 
1069  //**SMP multiplication assignment to sparse matrices********************************************
1070  // No special implementation for the SMP multiplication assignment to sparse matrices.
1071  //**********************************************************************************************
1072 
1073  //**Compile time checks*************************************************************************
1079  //**********************************************************************************************
1080 };
1081 //*************************************************************************************************
1082 
1083 
1084 
1085 
1086 //=================================================================================================
1087 //
1088 // GLOBAL FUNCTIONS
1089 //
1090 //=================================================================================================
1091 
1092 //*************************************************************************************************
1116 template< typename MT1 // Type of the left-hand side dense matrix
1117  , typename MT2 // Type of the right-hand side dense matrix
1118  , bool SO // Storage order
1119  , typename OP > // Type of the custom operation
1120 inline decltype(auto)
1121  map( const DenseMatrix<MT1,SO>& lhs, const DenseMatrix<MT2,SO>& rhs, OP op )
1122 {
1124 
1125  if( (~lhs).rows() != (~rhs).rows() || (~lhs).columns() != (~rhs).columns() ) {
1126  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1127  }
1128 
1129  using ReturnType = const DMatDMatMapExpr<MT1,MT2,OP,SO>;
1130  return ReturnType( ~lhs, ~rhs, op );
1131 }
1132 //*************************************************************************************************
1133 
1134 
1135 //*************************************************************************************************
1157 template< typename MT1 // Type of the left-hand side dense matrix
1158  , bool SO1 // Storage order of the left-hand side dense matrix
1159  , typename MT2 // Type of the right-hand side dense matrix
1160  , bool SO2 > // Storage order of the right-hand side dense matrix
1161 inline decltype(auto)
1162  min( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1163 {
1165 
1166  return map( ~lhs, ~rhs, Min() );
1167 }
1168 //*************************************************************************************************
1169 
1170 
1171 //*************************************************************************************************
1193 template< typename MT1 // Type of the left-hand side dense matrix
1194  , bool SO1 // Storage order of the left-hand side dense matrix
1195  , typename MT2 // Type of the right-hand side dense matrix
1196  , bool SO2 > // Storage order of the right-hand side dense matrix
1197 inline decltype(auto)
1198  max( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1199 {
1201 
1202  return map( ~lhs, ~rhs, Max() );
1203 }
1204 //*************************************************************************************************
1205 
1206 
1207 //*************************************************************************************************
1230 template< typename MT1 // Type of the left-hand side dense matrix
1231  , bool SO1 // Storage order of the left-hand side dense matrix
1232  , typename MT2 // Type of the right-hand side dense matrix
1233  , bool SO2 > // Storage order of the right-hand side dense matrix
1234 inline decltype(auto)
1235  hypot( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1236 {
1238 
1239  return map( ~lhs, ~rhs, Hypot() );
1240 }
1241 //*************************************************************************************************
1242 
1243 
1244 //*************************************************************************************************
1266 template< typename MT1 // Type of the left-hand side dense matrix
1267  , bool SO1 // Storage order of the left-hand side dense matrix
1268  , typename MT2 // Type of the right-hand side dense matrix
1269  , bool SO2 > // Storage order of the right-hand side dense matrix
1270 inline decltype(auto)
1271  pow( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1272 {
1274 
1275  return map( ~lhs, ~rhs, Pow() );
1276 }
1277 //*************************************************************************************************
1278 
1279 
1280 //*************************************************************************************************
1302 template< typename MT1 // Type of the left-hand side dense matrix
1303  , bool SO1 // Storage order of the left-hand side dense matrix
1304  , typename MT2 // Type of the right-hand side dense matrix
1305  , bool SO2 > // Storage order of the right-hand side dense matrix
1306 inline decltype(auto)
1307  atan2( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1308 {
1310 
1311  return map( ~lhs, ~rhs, Atan2() );
1312 }
1313 //*************************************************************************************************
1314 
1315 
1316 
1317 
1318 //=================================================================================================
1319 //
1320 // GLOBAL BINARY ARITHMETIC OPERATORS
1321 //
1322 //=================================================================================================
1323 
1324 //*************************************************************************************************
1344 template< typename MT1 // Type of the left-hand side dense matrix
1345  , bool SO1 // Storage order of the left-hand side dense matrix
1346  , typename MT2 // Type of the right-hand side dense matrix
1347  , bool SO2 > // Storage order of the right-hand side dense matrix
1348 inline decltype(auto)
1349  operator<<( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1350 {
1352 
1353  return map( ~lhs, ~rhs, ShiftLV() );
1354 }
1355 //*************************************************************************************************
1356 
1357 
1358 //*************************************************************************************************
1378 template< typename MT1 // Type of the left-hand side dense matrix
1379  , bool SO1 // Storage order of the left-hand side dense matrix
1380  , typename MT2 // Type of the right-hand side dense matrix
1381  , bool SO2 > // Storage order of the right-hand side dense matrix
1382 inline decltype(auto)
1383  operator>>( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1384 {
1386 
1387  return map( ~lhs, ~rhs, ShiftRV() );
1388 }
1389 //*************************************************************************************************
1390 
1391 
1392 //*************************************************************************************************
1412 template< typename MT1 // Type of the left-hand side dense matrix
1413  , bool SO1 // Storage order of the left-hand side dense matrix
1414  , typename MT2 // Type of the right-hand side dense matrix
1415  , bool SO2 > // Storage order of the right-hand side dense matrix
1416 inline decltype(auto)
1417  operator&( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1418 {
1420 
1421  return map( ~lhs, ~rhs, Bitand() );
1422 }
1423 //*************************************************************************************************
1424 
1425 
1426 //*************************************************************************************************
1446 template< typename MT1 // Type of the left-hand side dense matrix
1447  , bool SO1 // Storage order of the left-hand side dense matrix
1448  , typename MT2 // Type of the right-hand side dense matrix
1449  , bool SO2 > // Storage order of the right-hand side dense matrix
1450 inline decltype(auto)
1451  operator|( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1452 {
1454 
1455  return map( ~lhs, ~rhs, Bitor() );
1456 }
1457 //*************************************************************************************************
1458 
1459 
1460 //*************************************************************************************************
1480 template< typename MT1 // Type of the left-hand side dense matrix
1481  , bool SO1 // Storage order of the left-hand side dense matrix
1482  , typename MT2 // Type of the right-hand side dense matrix
1483  , bool SO2 > // Storage order of the right-hand side dense matrix
1484 inline decltype(auto)
1485  operator^( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1486 {
1488 
1489  return map( ~lhs, ~rhs, Bitxor() );
1490 }
1491 //*************************************************************************************************
1492 
1493 
1494 
1495 
1496 //=================================================================================================
1497 //
1498 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
1499 //
1500 //=================================================================================================
1501 
1502 //*************************************************************************************************
1516 template< typename MT1 // Type of the left-hand side dense matrix
1517  , typename MT2 // Type of the middle dense matrix
1518  , bool SO1 // Storage order of the left-hand side left-shift expression
1519  , typename MT3 // Type of the right-hand side dense matrix
1520  , bool SO2 > // Storage order of the right-hand side dense matrix
1521 inline decltype(auto)
1522  operator<<( const DMatDMatMapExpr<MT1,MT2,ShiftLV,SO1>& lhs, const DenseMatrix<MT3,SO2>& rhs )
1523 {
1525 
1526  return map( lhs.leftOperand(), lhs.rightOperand() + (~rhs), lhs.operation() );
1527 }
1529 //*************************************************************************************************
1530 
1531 
1532 //*************************************************************************************************
1546 template< typename MT1 // Type of the left-hand side dense matrix
1547  , typename MT2 // Type of the middle dense matrix
1548  , bool SO1 // Storage order of the left-hand side right-shift expression
1549  , typename MT3 // Type of the right-hand side dense matrix
1550  , bool SO2 > // Storage order of the right-hand side dense matrix
1551 inline decltype(auto)
1552  operator>>( const DMatDMatMapExpr<MT1,MT2,ShiftRV,SO1>& lhs, const DenseMatrix<MT3,SO2>& rhs )
1553 {
1555 
1556  return map( lhs.leftOperand(), lhs.rightOperand() + (~rhs), lhs.operation() );
1557 }
1559 //*************************************************************************************************
1560 
1561 
1562 
1563 
1564 //=================================================================================================
1565 //
1566 // GLOBAL LOGICAL ARITHMETIC OPERATORS
1567 //
1568 //=================================================================================================
1569 
1570 //*************************************************************************************************
1590 template< typename MT1 // Type of the left-hand side dense matrix
1591  , bool SO1 // Storage order of the left-hand side dense matrix
1592  , typename MT2 // Type of the right-hand side dense matrix
1593  , bool SO2 > // Storage order of the right-hand side dense matrix
1594 inline decltype(auto)
1595  operator&&( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1596 {
1598 
1599  return map( ~lhs, ~rhs, And{} );
1600 }
1601 //*************************************************************************************************
1602 
1603 
1604 //*************************************************************************************************
1624 template< typename MT1 // Type of the left-hand side dense matrix
1625  , bool SO1 // Storage order of the left-hand side dense matrix
1626  , typename MT2 // Type of the right-hand side dense matrix
1627  , bool SO2 > // Storage order of the right-hand side dense matrix
1628 inline decltype(auto)
1629  operator||( const DenseMatrix<MT1,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1630 {
1632 
1633  return map( ~lhs, ~rhs, Or{} );
1634 }
1635 //*************************************************************************************************
1636 
1637 
1638 
1639 
1640 //=================================================================================================
1641 //
1642 // ISALIGNED SPECIALIZATIONS
1643 //
1644 //=================================================================================================
1645 
1646 //*************************************************************************************************
1648 template< typename MT1, typename MT2, typename OP, bool SO >
1649 struct IsAligned< DMatDMatMapExpr<MT1,MT2,OP,SO> >
1650  : public BoolConstant< IsAligned_v<MT1> && IsAligned_v<MT2> >
1651 {};
1653 //*************************************************************************************************
1654 
1655 
1656 
1657 
1658 //=================================================================================================
1659 //
1660 // ISPADDED SPECIALIZATIONS
1661 //
1662 //=================================================================================================
1663 
1664 //*************************************************************************************************
1666 template< typename MT1, typename MT2, typename OP, bool SO >
1667 struct IsPadded< DMatDMatMapExpr<MT1,MT2,OP,SO> >
1668  : public BoolConstant< IsPadded_v<MT1> && IsPadded_v<MT2> && IsPaddingEnabled_v<OP> >
1669 {};
1671 //*************************************************************************************************
1672 
1673 } // namespace blaze
1674 
1675 #endif
Header file for the Pow functor.
#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 the IsPaddingEnabled type trait.
Pointer difference type of the Blaze library.
IteratorCategory iterator_category
The iterator category.
Definition: DMatDMatMapExpr.h:199
Header file for auxiliary alias declarations.
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DMatDMatMapExpr.h:440
Header file for the ShiftRV functor.
Base class for all binary matrix map expression templates.The MatMatMapExpr class serves as a tag for...
Definition: MatMatMapExpr.h:66
DMatDMatMapExpr(const MT1 &lhs, const MT2 &rhs, OP op) noexcept
Constructor for the DMatDMatMapExpr class.
Definition: DMatDMatMapExpr.h:460
Header file for the HasLoad type trait.
Header file for basic type definitions.
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition: DMatDMatMapExpr.h:279
decltype(auto) hypot(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise hypotenous for the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1235
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
Operation operation() const
Returns a copy of the custom operation.
Definition: DMatDMatMapExpr.h:583
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition: DMatDMatMapExpr.h:257
ResultType_t< MT1 > RT1
Result type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:113
BLAZE_DEVICE_CALLABLE bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:355
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DMatDMatMapExpr.h:553
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
decltype(std::declval< OP >()(std::declval< RN1 >(), std::declval< RN2 >())) ReturnType
Return type for expression template evaluations.
Definition: DMatDMatMapExpr.h:164
Header file for the Hypot functor.
Header file for the serial shim.
Generic wrapper for the atan2() function.
Definition: Atan2.h:78
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
Generic wrapper for the bitwise OR ('|') operator.
Definition: Bitor.h:80
Header file for the Bitor functor.
If_t< useAssign, const ResultType, const DMatDMatMapExpr & > CompositeType
Data type for composite expression templates.
Definition: DMatDMatMapExpr.h:167
typename MapTrait< Args... >::Type MapTrait_t
Auxiliary alias declaration for the MapTrait class template.The MapTrait_t alias declaration provides...
Definition: MapTrait.h:160
#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
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DMatDMatMapExpr.h:161
Header file for the And functor.
decltype(auto) pow(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise exponential value for the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1271
Generic wrapper for the elementwise right-shift operation.
Definition: ShiftRV.h:75
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatDMatMapExpr.h:618
BLAZE_DEVICE_CALLABLE bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:366
LeftOperand lhs_
Left-hand side dense matrix of the map expression.
Definition: DMatDMatMapExpr.h:635
Header file for the Computation base class.
Header file for the ShiftLV functor.
ElementType * PointerType
Pointer return type.
Definition: DMatDMatMapExpr.h:194
ResultType_t< MT2 > RT2
Result type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:114
Header file for the RequiresEvaluation type trait.
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
RightOperand rightOperand() const noexcept
Returns the right-hand side dense matrix operand.
Definition: DMatDMatMapExpr.h:573
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DMatDMatMapExpr.h:628
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
Generic wrapper for the elementwise left-shift operation.
Definition: ShiftLV.h:75
PointerType pointer
Pointer return type.
Definition: DMatDMatMapExpr.h:201
Header file for the Bitxor functor.
ElementType & ReferenceType
Reference return type.
Definition: DMatDMatMapExpr.h:195
BLAZE_DEVICE_CALLABLE bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:377
Constraint on the data type.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
BLAZE_ALWAYS_INLINE auto load(size_t i, size_t j) const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatDMatMapExpr.h:507
ReturnType_t< MT2 > RN2
Return type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:118
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DMatDMatMapExpr.h:232
OP Operation
Data type of the custom unary operation.
Definition: DMatDMatMapExpr.h:176
ReturnType operator *() const
Direct access to the element at the current iterator position.
Definition: DMatDMatMapExpr.h:301
ConstIterator_t< MT2 > RightIteratorType
ConstIterator type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:209
Iterator over the elements of the dense matrix map expression.
Definition: DMatDMatMapExpr.h:188
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for the If class template.
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense matrix operand.
Definition: DMatDMatMapExpr.h:563
CompositeType_t< MT1 > CT1
Composite type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:119
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
Header file for the DenseMatrix base class.
Header file for all SIMD functionality.
auto load() const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatDMatMapExpr.h:311
Header file for the IsAligned type trait.
ConstIterator_t< MT1 > LeftIteratorType
ConstIterator type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:206
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DMatDMatMapExpr.h:192
If_t< RequiresEvaluation_v< MT2 >, const RT2, CT2 > RT
Type for the assignment of the right-hand side dense matrix operand.
Definition: DMatDMatMapExpr.h:182
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DMatDMatMapExpr.h:450
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DMatDMatMapExpr.h:432
Constraints on the storage order of matrix types.
If_t< IsExpression_v< MT2 >, const MT2, const MT2 & > RightOperand
Composite type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:173
Header file for the exception macros of the math module.
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DMatDMatMapExpr.h:412
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
decltype(auto) atan2(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the multi-valued inverse tangent of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1307
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
Generic wrapper for the bitwise XOR ('^') operator.
Definition: Bitxor.h:66
ReturnType_t< MT1 > RN1
Return type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:117
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DMatDMatMapExpr.h:489
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.The OppositeType_t alias declaration provi...
Definition: Aliases.h:270
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DMatDMatMapExpr.h:445
OP op_
The custom unary operation.
Definition: DMatDMatMapExpr.h:433
Header file for the IsSIMDEnabled type trait.
ElementType ValueType
Type of the underlying elements.
Definition: DMatDMatMapExpr.h:193
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.
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatDMatMapExpr.h:474
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
MapTrait_t< RT1, RT2, OP > ResultType
Result type for expression template evaluations.
Definition: DMatDMatMapExpr.h:158
Generic wrapper for the pow() function.
Definition: Pow.h:63
Generic wrapper for the max() function.
Definition: Max.h:80
BLAZE_DEVICE_CALLABLE bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:344
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DMatDMatMapExpr.h:424
Header file for the Or functor.
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
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DMatDMatMapExpr.h:431
Generic wrapper for the bitwise AND ('&') operator.
Definition: Bitand.h:80
Expression object for the dense matrix-dense matrix map() function.The DMatDMatMapExpr class represen...
Definition: DMatDMatMapExpr.h:107
BLAZE_DEVICE_CALLABLE bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:333
ValueType value_type
Type of the underlying elements.
Definition: DMatDMatMapExpr.h:200
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition: DMatDMatMapExpr.h:269
Header file for the Atan2 functor.
ElementType_t< MT1 > ET1
Element type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:115
RightOperand rhs_
Right-hand side dense matrix of the map expression.
Definition: DMatDMatMapExpr.h:636
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:295
#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.
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DMatDMatMapExpr.h:400
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the map expression.
Definition: DMatDMatMapExpr.h:131
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
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
Header file for the HasMember type traits.
#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< MT2 > CT2
Composite type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:120
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant alias template represents ...
Definition: IntegralConstant.h:110
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DMatDMatMapExpr.h:543
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
Header file for the Bitand functor.
#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
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition: DMatDMatMapExpr.h:291
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: DMatDMatMapExpr.h:533
Operation op_
The custom unary operation.
Definition: DMatDMatMapExpr.h:637
Generic wrapper for the min() function.
Definition: Min.h:80
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
Header file for the Min functor.
If_t< IsExpression_v< MT1 >, const MT1, const MT1 & > LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:170
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DMatDMatMapExpr.h:160
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatDMatMapExpr.h:159
ReferenceType reference
Reference return type.
Definition: DMatDMatMapExpr.h:202
ElementType_t< MT2 > ET2
Element type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:116
Macro for CUDA compatibility.
BLAZE_DEVICE_CALLABLE bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:322
Header file for the MatMatMapExpr base 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
ConstIterator(LeftIteratorType left, RightIteratorType right, OP op)
Constructor for the ConstIterator class.
Definition: DMatDMatMapExpr.h:219
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:66
Generic wrapper for the logical OR operator.
Definition: Or.h:58
Generic wrapper for the hypot() function.
Definition: Hypot.h:78
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DMatDMatMapExpr.h:595
BLAZE_DEVICE_CALLABLE DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DMatDMatMapExpr.h:388
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: DMatDMatMapExpr.h:522
Header file for the IntegralConstant class template.
Header file for the map trait.
Generic wrapper for the logical AND operator.
Definition: And.h:58
Header file for the Max functor.
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition: HostDevice.h:94
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DMatDMatMapExpr.h:245
System settings for the inline keywords.
#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
If_t< RequiresEvaluation_v< MT1 >, const RT1, CT1 > LT
Type for the assignment of the left-hand side dense matrix operand.
Definition: DMatDMatMapExpr.h:179
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DMatDMatMapExpr.h:608
Header file for the IsExpression type trait class.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DMatDMatMapExpr.h:196
Header file for the function trace functionality.
decltype(auto) map(const DenseMatrix< MT1, SO > &lhs, const DenseMatrix< MT2, SO > &rhs, OP op)
Evaluates the given binary operation on each single element of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1121