Blaze  3.6
DMatMapExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATMAPEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATMAPEXPR_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>
54 #include <blaze/math/Functors.h>
56 #include <blaze/math/SIMD.h>
73 #include <blaze/system/Inline.h>
74 #include <blaze/util/Assert.h>
75 #include <blaze/util/EnableIf.h>
78 #include <blaze/util/mpl/If.h>
79 #include <blaze/util/Types.h>
84 
85 
86 namespace blaze {
87 
88 //=================================================================================================
89 //
90 // CLASS DMATMAPEXPR
91 //
92 //=================================================================================================
93 
94 //*************************************************************************************************
101 template< typename MT // Type of the dense matrix
102  , typename OP // Type of the custom operation
103  , bool SO > // Storage order
105  : public MatMapExpr< DenseMatrix< DMatMapExpr<MT,OP,SO>, SO > >
106  , private Computation
107 {
108  private:
109  //**Type definitions****************************************************************************
114  //**********************************************************************************************
115 
116  //**Serial evaluation strategy******************************************************************
118 
124  static constexpr bool useAssign = ( IsComputation_v<MT> && RequiresEvaluation_v<MT> );
125 
127  template< typename MT2 >
129  static constexpr bool UseAssign_v = useAssign;
131  //**********************************************************************************************
132 
133  //**Parallel evaluation strategy****************************************************************
135 
141  template< typename MT2 >
142  static constexpr bool UseSMPAssign_v =
143  ( ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign );
145  //**********************************************************************************************
146 
147  public:
148  //**Type definitions****************************************************************************
155 
157  using ReturnType = decltype( std::declval<OP>()( std::declval<RN>() ) );
158 
161 
163  using Operand = If_t< IsExpression_v<MT>, const MT, const MT& >;
164 
166  using Operation = OP;
167  //**********************************************************************************************
168 
169  //**ConstIterator class definition**************************************************************
173  {
174  public:
175  //**Type definitions*************************************************************************
176  using IteratorCategory = std::random_access_iterator_tag;
181 
182  // STL iterator requirements
188 
191  //*******************************************************************************************
192 
193  //**Constructor******************************************************************************
199  explicit inline BLAZE_DEVICE_CALLABLE ConstIterator( IteratorType it, OP op )
200  : it_( it ) // Iterator to the current matrix element
201  , op_( op ) // The custom unary operation
202  {}
203  //*******************************************************************************************
204 
205  //**Addition assignment operator*************************************************************
212  it_ += inc;
213  return *this;
214  }
215  //*******************************************************************************************
216 
217  //**Subtraction assignment operator**********************************************************
224  it_ -= dec;
225  return *this;
226  }
227  //*******************************************************************************************
228 
229  //**Prefix increment operator****************************************************************
235  ++it_;
236  return *this;
237  }
238  //*******************************************************************************************
239 
240  //**Postfix increment operator***************************************************************
246  return ConstIterator( it_++, op_ );
247  }
248  //*******************************************************************************************
249 
250  //**Prefix decrement operator****************************************************************
256  --it_;
257  return *this;
258  }
259  //*******************************************************************************************
260 
261  //**Postfix decrement operator***************************************************************
267  return ConstIterator( it_--, op_ );
268  }
269  //*******************************************************************************************
270 
271  //**Element access operator******************************************************************
277  return op_( *it_ );
278  }
279  //*******************************************************************************************
280 
281  //**Load function****************************************************************************
286  inline auto load() const noexcept {
287  return op_.load( it_.load() );
288  }
289  //*******************************************************************************************
290 
291  //**Equality operator************************************************************************
297  inline BLAZE_DEVICE_CALLABLE bool operator==( const ConstIterator& rhs ) const {
298  return it_ == rhs.it_;
299  }
300  //*******************************************************************************************
301 
302  //**Inequality operator**********************************************************************
308  inline BLAZE_DEVICE_CALLABLE bool operator!=( const ConstIterator& rhs ) const {
309  return it_ != rhs.it_;
310  }
311  //*******************************************************************************************
312 
313  //**Less-than operator***********************************************************************
319  inline BLAZE_DEVICE_CALLABLE bool operator<( const ConstIterator& rhs ) const {
320  return it_ < rhs.it_;
321  }
322  //*******************************************************************************************
323 
324  //**Greater-than operator********************************************************************
330  inline BLAZE_DEVICE_CALLABLE bool operator>( const ConstIterator& rhs ) const {
331  return it_ > rhs.it_;
332  }
333  //*******************************************************************************************
334 
335  //**Less-or-equal-than operator**************************************************************
341  inline BLAZE_DEVICE_CALLABLE bool operator<=( const ConstIterator& rhs ) const {
342  return it_ <= rhs.it_;
343  }
344  //*******************************************************************************************
345 
346  //**Greater-or-equal-than operator***********************************************************
352  inline BLAZE_DEVICE_CALLABLE bool operator>=( const ConstIterator& rhs ) const {
353  return it_ >= rhs.it_;
354  }
355  //*******************************************************************************************
356 
357  //**Subtraction operator*********************************************************************
364  return it_ - rhs.it_;
365  }
366  //*******************************************************************************************
367 
368  //**Addition operator************************************************************************
375  friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
376  return ConstIterator( it.it_ + inc, it.op_ );
377  }
378  //*******************************************************************************************
379 
380  //**Addition operator************************************************************************
387  friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
388  return ConstIterator( it.it_ + inc, it.op_ );
389  }
390  //*******************************************************************************************
391 
392  //**Subtraction operator*********************************************************************
399  friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
400  return ConstIterator( it.it_ - dec, it.op_ );
401  }
402  //*******************************************************************************************
403 
404  private:
405  //**Member variables*************************************************************************
407  OP op_;
408  //*******************************************************************************************
409  };
410  //**********************************************************************************************
411 
412  //**Compilation flags***************************************************************************
414  static constexpr bool simdEnabled =
415  ( MT::simdEnabled &&
416  If_t< HasSIMDEnabled_v<OP>, GetSIMDEnabled<OP,ET>, HasLoad<OP> >::value );
417 
419  static constexpr bool smpAssignable = MT::smpAssignable;
420  //**********************************************************************************************
421 
422  //**SIMD properties*****************************************************************************
424  static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
425  //**********************************************************************************************
426 
427  //**Constructor*********************************************************************************
433  explicit inline DMatMapExpr( const MT& dm, OP op ) noexcept
434  : dm_( dm ) // Dense matrix of the map expression
435  , op_( op ) // The custom unary operation
436  {}
437  //**********************************************************************************************
438 
439  //**Access operator*****************************************************************************
446  inline ReturnType operator()( size_t i, size_t j ) const noexcept {
447  BLAZE_INTERNAL_ASSERT( i < dm_.rows() , "Invalid row access index" );
448  BLAZE_INTERNAL_ASSERT( j < dm_.columns(), "Invalid column access index" );
449  return op_( dm_(i,j) );
450  }
451  //**********************************************************************************************
452 
453  //**At function*********************************************************************************
461  inline ReturnType at( size_t i, size_t j ) const {
462  if( i >= dm_.rows() ) {
463  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
464  }
465  if( j >= dm_.columns() ) {
466  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
467  }
468  return (*this)(i,j);
469  }
470  //**********************************************************************************************
471 
472  //**Load function*******************************************************************************
479  BLAZE_ALWAYS_INLINE auto load( size_t i, size_t j ) const noexcept {
480  BLAZE_INTERNAL_ASSERT( i < dm_.rows() , "Invalid row access index" );
481  BLAZE_INTERNAL_ASSERT( j < dm_.columns(), "Invalid column access index" );
482  BLAZE_INTERNAL_ASSERT( !SO || ( i % SIMDSIZE == 0UL ), "Invalid row access index" );
483  BLAZE_INTERNAL_ASSERT( SO || ( j % SIMDSIZE == 0UL ), "Invalid column access index" );
484  return op_.load( dm_.load(i,j) );
485  }
486  //**********************************************************************************************
487 
488  //**Begin function******************************************************************************
494  inline ConstIterator begin( size_t i ) const {
495  return ConstIterator( dm_.begin(i), op_ );
496  }
497  //**********************************************************************************************
498 
499  //**End function********************************************************************************
505  inline ConstIterator end( size_t i ) const {
506  return ConstIterator( dm_.end(i), op_ );
507  }
508  //**********************************************************************************************
509 
510  //**Rows function*******************************************************************************
515  inline size_t rows() const noexcept {
516  return dm_.rows();
517  }
518  //**********************************************************************************************
519 
520  //**Columns function****************************************************************************
525  inline size_t columns() const noexcept {
526  return dm_.columns();
527  }
528  //**********************************************************************************************
529 
530  //**Operand access******************************************************************************
535  inline Operand operand() const noexcept {
536  return dm_;
537  }
538  //**********************************************************************************************
539 
540  //**Operation access****************************************************************************
545  inline Operation operation() const {
546  return op_;
547  }
548  //**********************************************************************************************
549 
550  //**********************************************************************************************
556  template< typename T >
557  inline bool canAlias( const T* alias ) const noexcept {
558  return IsExpression_v<MT> && dm_.canAlias( alias );
559  }
560  //**********************************************************************************************
561 
562  //**********************************************************************************************
568  template< typename T >
569  inline bool isAliased( const T* alias ) const noexcept {
570  return dm_.isAliased( alias );
571  }
572  //**********************************************************************************************
573 
574  //**********************************************************************************************
579  inline bool isAligned() const noexcept {
580  return dm_.isAligned();
581  }
582  //**********************************************************************************************
583 
584  //**********************************************************************************************
589  inline bool canSMPAssign() const noexcept {
590  return dm_.canSMPAssign();
591  }
592  //**********************************************************************************************
593 
594  private:
595  //**Member variables****************************************************************************
598  //**********************************************************************************************
599 
600  //**Assignment to dense matrices****************************************************************
615  template< typename MT2 // Type of the target dense matrix
616  , bool SO2 > // Storage order or the target dense matrix
617  friend inline auto assign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
619  IsSame_v< UnderlyingNumeric_t<MT>, UnderlyingNumeric_t<MT2> > >
620  {
622 
623  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
624  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
625 
626  assign( ~lhs, rhs.dm_ );
627  assign( ~lhs, map( ~lhs, rhs.op_ ) );
628  }
630  //**********************************************************************************************
631 
632  //**Assignment to dense matrices****************************************************************
647  template< typename MT2 // Type of the target dense matrix
648  , bool SO2 > // Storage order or the target dense matrix
649  friend inline auto assign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
651  !IsSame_v< UnderlyingNumeric_t<MT>, UnderlyingNumeric_t<MT2> > >
652  {
654 
658 
659  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
660  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
661 
662  const RT tmp( serial( rhs.dm_ ) );
663  assign( ~lhs, map( tmp, rhs.op_ ) );
664  }
666  //**********************************************************************************************
667 
668  //**Assignment to sparse matrices***************************************************************
682  template< typename MT2 // Type of the target sparse matrix
683  , bool SO2 > // Storage order or the target sparse matrix
684  friend inline auto assign( SparseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
685  -> EnableIf_t< UseAssign_v<MT2> >
686  {
688 
689  using TmpType = If_t< SO == SO2, RT, OT >;
690 
697 
698  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
699  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
700 
701  const TmpType tmp( serial( rhs.dm_ ) );
702  assign( ~lhs, map( tmp, rhs.op_ ) );
703  }
705  //**********************************************************************************************
706 
707  //**Addition assignment to dense matrices*******************************************************
721  template< typename MT2 // Type of the target dense matrix
722  , bool SO2 > // Storage order of the target dense matrix
723  friend inline auto addAssign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
724  -> EnableIf_t< UseAssign_v<MT2> >
725  {
727 
731 
732  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
733  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
734 
735  const RT tmp( serial( rhs.dm_ ) );
736  addAssign( ~lhs, map( tmp, rhs.op_ ) );
737  }
739  //**********************************************************************************************
740 
741  //**Addition assignment to sparse matrices******************************************************
742  // No special implementation for the addition assignment to sparse matrices.
743  //**********************************************************************************************
744 
745  //**Subtraction assignment to dense matrices****************************************************
759  template< typename MT2 // Type of the target dense matrix
760  , bool SO2 > // Storage order of the target dense matrix
761  friend inline auto subAssign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
762  -> EnableIf_t< UseAssign_v<MT2> >
763  {
765 
769 
770  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
771  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
772 
773  const RT tmp( serial( rhs.dm_ ) );
774  subAssign( ~lhs, map( tmp, rhs.op_ ) );
775  }
777  //**********************************************************************************************
778 
779  //**Subtraction assignment to sparse matrices***************************************************
780  // No special implementation for the subtraction assignment to sparse matrices.
781  //**********************************************************************************************
782 
783  //**Schur product assignment to dense matrices**************************************************
797  template< typename MT2 // Type of the target dense matrix
798  , bool SO2 > // Storage order of the target dense matrix
799  friend inline auto schurAssign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
800  -> EnableIf_t< UseAssign_v<MT2> >
801  {
803 
807 
808  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
809  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
810 
811  const RT tmp( serial( rhs.dm_ ) );
812  schurAssign( ~lhs, map( tmp, rhs.op_ ) );
813  }
815  //**********************************************************************************************
816 
817  //**Schur product assignment to sparse matrices*************************************************
818  // No special implementation for the Schur product assignment to sparse matrices.
819  //**********************************************************************************************
820 
821  //**Multiplication assignment to dense matrices*************************************************
822  // No special implementation for the multiplication assignment to dense matrices.
823  //**********************************************************************************************
824 
825  //**Multiplication assignment to sparse matrices************************************************
826  // No special implementation for the multiplication assignment to sparse matrices.
827  //**********************************************************************************************
828 
829  //**SMP assignment to dense matrices************************************************************
844  template< typename MT2 // Type of the target dense matrix
845  , bool SO2 > // Storage order or the target dense matrix
846  friend inline auto smpAssign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
847  -> EnableIf_t< UseSMPAssign_v<MT2> &&
848  IsSame_v< UnderlyingNumeric_t<MT>, UnderlyingNumeric_t<MT2> > >
849  {
851 
852  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
853  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
854 
855  smpAssign( ~lhs, rhs.dm_ );
856  smpAssign( ~lhs, map( ~lhs, rhs.op_ ) );
857  }
859  //**********************************************************************************************
860 
861  //**SMP assignment to dense matrices************************************************************
876  template< typename MT2 // Type of the target dense matrix
877  , bool SO2 > // Storage order or the target dense matrix
878  friend inline auto smpAssign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
879  -> EnableIf_t< UseSMPAssign_v<MT2> &&
880  !IsSame_v< UnderlyingNumeric_t<MT>, UnderlyingNumeric_t<MT2> > >
881  {
883 
887 
888  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
889  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
890 
891  const RT tmp( rhs.dm_ );
892  smpAssign( ~lhs, map( tmp, rhs.op_ ) );
893  }
895  //**********************************************************************************************
896 
897  //**SMP assignment to sparse matrices***********************************************************
911  template< typename MT2 // Type of the target sparse matrix
912  , bool SO2 > // Storage order or the target sparse matrix
913  friend inline auto smpAssign( SparseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
914  -> EnableIf_t< UseSMPAssign_v<MT2> >
915  {
917 
918  using TmpType = If_t< SO == SO2, RT, OT >;
919 
926 
927  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
928  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
929 
930  const TmpType tmp( rhs.dm_ );
931  smpAssign( ~lhs, map( tmp, rhs.op_ ) );
932  }
934  //**********************************************************************************************
935 
936  //**SMP addition assignment to dense matrices***************************************************
950  template< typename MT2 // Type of the target dense matrix
951  , bool SO2 > // Storage order of the target dense matrix
952  friend inline auto smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
953  -> EnableIf_t< UseSMPAssign_v<MT2> >
954  {
956 
960 
961  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
962  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
963 
964  const RT tmp( rhs.dm_ );
965  smpAddAssign( ~lhs, map( tmp, rhs.op_ ) );
966  }
968  //**********************************************************************************************
969 
970  //**SMP addition assignment to sparse matrices**************************************************
971  // No special implementation for the SMP addition assignment to sparse matrices.
972  //**********************************************************************************************
973 
974  //**SMP subtraction assignment to dense matrices************************************************
988  template< typename MT2 // Type of the target dense matrix
989  , bool SO2 > // Storage order of the target dense matrix
990  friend inline auto smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
991  -> EnableIf_t< UseSMPAssign_v<MT2> >
992  {
994 
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  const RT tmp( rhs.dm_ );
1003  smpSubAssign( ~lhs, map( tmp, rhs.op_ ) );
1004  }
1006  //**********************************************************************************************
1007 
1008  //**SMP subtraction assignment to sparse matrices***********************************************
1009  // No special implementation for the SMP subtraction assignment to sparse matrices.
1010  //**********************************************************************************************
1011 
1012  //**SMP Schur product assignment to dense matrices**********************************************
1026  template< typename MT2 // Type of the target dense matrix
1027  , bool SO2 > // Storage order of the target dense matrix
1028  friend inline auto smpSchurAssign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
1029  -> EnableIf_t< UseSMPAssign_v<MT2> >
1030  {
1032 
1036 
1037  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1038  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1039 
1040  const RT tmp( rhs.dm_ );
1041  smpSchurAssign( ~lhs, map( tmp, rhs.op_ ) );
1042  }
1044  //**********************************************************************************************
1045 
1046  //**SMP Schur product assignment to sparse matrices*********************************************
1047  // No special implementation for the SMP Schur product assignment to sparse matrices.
1048  //**********************************************************************************************
1049 
1050  //**SMP multiplication assignment to dense matrices*********************************************
1051  // No special implementation for the SMP multiplication assignment to dense matrices.
1052  //**********************************************************************************************
1053 
1054  //**SMP multiplication assignment to sparse matrices********************************************
1055  // No special implementation for the SMP multiplication assignment to sparse matrices.
1056  //**********************************************************************************************
1057 
1058  //**Compile time checks*************************************************************************
1063  //**********************************************************************************************
1064 };
1065 //*************************************************************************************************
1066 
1067 
1068 
1069 
1070 //=================================================================================================
1071 //
1072 // GLOBAL FUNCTIONS
1073 //
1074 //=================================================================================================
1075 
1076 //*************************************************************************************************
1094 template< typename MT // Type of the dense matrix
1095  , bool SO // Storage order
1096  , typename OP > // Type of the custom operation
1097 inline decltype(auto) map( const DenseMatrix<MT,SO>& dm, OP op )
1098 {
1100 
1101  using ReturnType = const DMatMapExpr<MT,OP,SO>;
1102  return ReturnType( ~dm, op );
1103 }
1104 //*************************************************************************************************
1105 
1106 
1107 //*************************************************************************************************
1125 template< typename MT // Type of the dense matrix
1126  , bool SO // Storage order
1127  , typename OP > // Type of the custom operation
1128 inline decltype(auto) forEach( const DenseMatrix<MT,SO>& dm, OP op )
1129 {
1131 
1132  return map( ~dm, op );
1133 }
1134 //*************************************************************************************************
1135 
1136 
1137 //*************************************************************************************************
1154 template< typename MT // Type of the dense matrix
1155  , bool SO > // Storage order
1156 inline decltype(auto) abs( const DenseMatrix<MT,SO>& dm )
1157 {
1159 
1160  return map( ~dm, Abs() );
1161 }
1162 //*************************************************************************************************
1163 
1164 
1165 //*************************************************************************************************
1182 template< typename MT // Type of the dense matrix
1183  , bool SO > // Storage order
1184 inline decltype(auto) sign( const DenseMatrix<MT,SO>& dm )
1185 {
1187 
1188  return map( ~dm, Sign() );
1189 }
1190 //*************************************************************************************************
1191 
1192 
1193 //*************************************************************************************************
1210 template< typename MT // Type of the dense matrix
1211  , bool SO > // Storage order
1212 inline decltype(auto) floor( const DenseMatrix<MT,SO>& dm )
1213 {
1215 
1216  return map( ~dm, Floor() );
1217 }
1218 //*************************************************************************************************
1219 
1220 
1221 //*************************************************************************************************
1238 template< typename MT // Type of the dense matrix
1239  , bool SO > // Storage order
1240 inline decltype(auto) ceil( const DenseMatrix<MT,SO>& dm )
1241 {
1243 
1244  return map( ~dm, Ceil() );
1245 }
1246 //*************************************************************************************************
1247 
1248 
1249 //*************************************************************************************************
1266 template< typename MT // Type of the dense matrix
1267  , bool SO > // Storage order
1268 inline decltype(auto) trunc( const DenseMatrix<MT,SO>& dm )
1269 {
1271 
1272  return map( ~dm, Trunc() );
1273 }
1274 //*************************************************************************************************
1275 
1276 
1277 //*************************************************************************************************
1294 template< typename MT // Type of the dense matrix
1295  , bool SO > // Storage order
1296 inline decltype(auto) round( const DenseMatrix<MT,SO>& dm )
1297 {
1299 
1300  return map( ~dm, Round() );
1301 }
1302 //*************************************************************************************************
1303 
1304 
1305 //*************************************************************************************************
1322 template< typename MT // Type of the dense matrix
1323  , bool SO > // Storage order
1324 inline decltype(auto) conj( const DenseMatrix<MT,SO>& dm )
1325 {
1327 
1328  return map( ~dm, Conj() );
1329 }
1330 //*************************************************************************************************
1331 
1332 
1333 //*************************************************************************************************
1359 template< typename MT // Type of the dense matrix
1360  , bool SO > // Storage order
1361 inline decltype(auto) ctrans( const DenseMatrix<MT,SO>& dm )
1362 {
1364 
1365  return trans( conj( ~dm ) );
1366 }
1367 //*************************************************************************************************
1368 
1369 
1370 //*************************************************************************************************
1387 template< typename MT // Type of the dense matrix
1388  , bool SO > // Storage order
1389 inline decltype(auto) real( const DenseMatrix<MT,SO>& dm )
1390 {
1392 
1393  return map( ~dm, Real() );
1394 }
1395 //*************************************************************************************************
1396 
1397 
1398 //*************************************************************************************************
1415 template< typename MT // Type of the dense matrix
1416  , bool SO > // Storage order
1417 inline decltype(auto) imag( const DenseMatrix<MT,SO>& dm )
1418 {
1420 
1421  return map( ~dm, Imag() );
1422 }
1423 //*************************************************************************************************
1424 
1425 
1426 //*************************************************************************************************
1446 template< typename MT // Type of the dense matrix
1447  , bool SO > // Storage order
1448 inline decltype(auto) sqrt( const DenseMatrix<MT,SO>& dm )
1449 {
1451 
1452  return map( ~dm, Sqrt() );
1453 }
1454 //*************************************************************************************************
1455 
1456 
1457 //*************************************************************************************************
1477 template< typename MT // Type of the dense matrix
1478  , bool SO > // Storage order
1479 inline decltype(auto) invsqrt( const DenseMatrix<MT,SO>& dm )
1480 {
1482 
1483  return map( ~dm, InvSqrt() );
1484 }
1485 //*************************************************************************************************
1486 
1487 
1488 //*************************************************************************************************
1508 template< typename MT // Type of the dense matrix
1509  , bool SO > // Storage order
1510 inline decltype(auto) cbrt( const DenseMatrix<MT,SO>& dm )
1511 {
1513 
1514  return map( ~dm, Cbrt() );
1515 }
1516 //*************************************************************************************************
1517 
1518 
1519 //*************************************************************************************************
1539 template< typename MT // Type of the dense matrix
1540  , bool SO > // Storage order
1541 inline decltype(auto) invcbrt( const DenseMatrix<MT,SO>& dm )
1542 {
1544 
1545  return map( ~dm, InvCbrt() );
1546 }
1547 //*************************************************************************************************
1548 
1549 
1550 //*************************************************************************************************
1569 template< typename MT // Type of the dense matrix
1570  , bool SO // Storage order
1571  , typename DT > // Type of the delimiters
1572 inline decltype(auto) clamp( const DenseMatrix<MT,SO>& dm, const DT& min, const DT& max )
1573 {
1575 
1576  return map( ~dm, Clamp<DT>( min, max ) );
1577 }
1578 //*************************************************************************************************
1579 
1580 
1581 //*************************************************************************************************
1599 template< typename MT // Type of the dense matrix
1600  , bool SO // Storage order
1601  , typename ST // Type of the scalar exponent
1602  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
1603 inline decltype(auto) pow( const DenseMatrix<MT,SO>& dm, ST exp )
1604 {
1606 
1607  using ScalarType = MultTrait_t< UnderlyingBuiltin_t<MT>, ST >;
1608  return map( ~dm, blaze::bind2nd( Pow(), ScalarType( exp ) ) );
1609 }
1610 //*************************************************************************************************
1611 
1612 
1613 //*************************************************************************************************
1630 template< typename MT // Type of the dense matrix
1631  , bool SO > // Storage order
1632 inline decltype(auto) exp( const DenseMatrix<MT,SO>& dm )
1633 {
1635 
1636  return map( ~dm, Exp() );
1637 }
1638 //*************************************************************************************************
1639 
1640 
1641 //*************************************************************************************************
1658 template< typename MT // Type of the dense matrix
1659  , bool SO > // Storage order
1660 inline decltype(auto) exp2( const DenseMatrix<MT,SO>& dm )
1661 {
1663 
1664  return map( ~dm, Exp2() );
1665 }
1666 //*************************************************************************************************
1667 
1668 
1669 //*************************************************************************************************
1686 template< typename MT // Type of the dense matrix
1687  , bool SO > // Storage order
1688 inline decltype(auto) exp10( const DenseMatrix<MT,SO>& dm )
1689 {
1691 
1692  return map( ~dm, Exp10() );
1693 }
1694 //*************************************************************************************************
1695 
1696 
1697 //*************************************************************************************************
1717 template< typename MT // Type of the dense matrix
1718  , bool SO > // Storage order
1719 inline decltype(auto) log( const DenseMatrix<MT,SO>& dm )
1720 {
1722 
1723  return map( ~dm, Log() );
1724 }
1725 //*************************************************************************************************
1726 
1727 
1728 //*************************************************************************************************
1748 template< typename MT // Type of the dense matrix
1749  , bool SO > // Storage order
1750 inline decltype(auto) log2( const DenseMatrix<MT,SO>& dm )
1751 {
1753 
1754  return map( ~dm, Log2() );
1755 }
1756 //*************************************************************************************************
1757 
1758 
1759 //*************************************************************************************************
1779 template< typename MT // Type of the dense matrix
1780  , bool SO > // Storage order
1781 inline decltype(auto) log10( const DenseMatrix<MT,SO>& dm )
1782 {
1784 
1785  return map( ~dm, Log10() );
1786 }
1787 //*************************************************************************************************
1788 
1789 
1790 //*************************************************************************************************
1807 template< typename MT // Type of the dense matrix
1808  , bool SO > // Storage order
1809 inline decltype(auto) sin( const DenseMatrix<MT,SO>& dm )
1810 {
1812 
1813  return map( ~dm, Sin() );
1814 }
1815 //*************************************************************************************************
1816 
1817 
1818 //*************************************************************************************************
1838 template< typename MT // Type of the dense matrix
1839  , bool SO > // Storage order
1840 inline decltype(auto) asin( const DenseMatrix<MT,SO>& dm )
1841 {
1843 
1844  return map( ~dm, Asin() );
1845 }
1846 //*************************************************************************************************
1847 
1848 
1849 //*************************************************************************************************
1866 template< typename MT // Type of the dense matrix
1867  , bool SO > // Storage order
1868 inline decltype(auto) sinh( const DenseMatrix<MT,SO>& dm )
1869 {
1871 
1872  return map( ~dm, Sinh() );
1873 }
1874 //*************************************************************************************************
1875 
1876 
1877 //*************************************************************************************************
1894 template< typename MT // Type of the dense matrix
1895  , bool SO > // Storage order
1896 inline decltype(auto) asinh( const DenseMatrix<MT,SO>& dm )
1897 {
1899 
1900  return map( ~dm, Asinh() );
1901 }
1902 //*************************************************************************************************
1903 
1904 
1905 //*************************************************************************************************
1922 template< typename MT // Type of the dense matrix
1923  , bool SO > // Storage order
1924 inline decltype(auto) cos( const DenseMatrix<MT,SO>& dm )
1925 {
1927 
1928  return map( ~dm, Cos() );
1929 }
1930 //*************************************************************************************************
1931 
1932 
1933 //*************************************************************************************************
1953 template< typename MT // Type of the dense matrix
1954  , bool SO > // Storage order
1955 inline decltype(auto) acos( const DenseMatrix<MT,SO>& dm )
1956 {
1958 
1959  return map( ~dm, Acos() );
1960 }
1961 //*************************************************************************************************
1962 
1963 
1964 //*************************************************************************************************
1981 template< typename MT // Type of the dense matrix
1982  , bool SO > // Storage order
1983 inline decltype(auto) cosh( const DenseMatrix<MT,SO>& dm )
1984 {
1986 
1987  return map( ~dm, Cosh() );
1988 }
1989 //*************************************************************************************************
1990 
1991 
1992 //*************************************************************************************************
2012 template< typename MT // Type of the dense matrix
2013  , bool SO > // Storage order
2014 inline decltype(auto) acosh( const DenseMatrix<MT,SO>& dm )
2015 {
2017 
2018  return map( ~dm, Acosh() );
2019 }
2020 //*************************************************************************************************
2021 
2022 
2023 //*************************************************************************************************
2040 template< typename MT // Type of the dense matrix
2041  , bool SO > // Storage order
2042 inline decltype(auto) tan( const DenseMatrix<MT,SO>& dm )
2043 {
2045 
2046  return map( ~dm, Tan() );
2047 }
2048 //*************************************************************************************************
2049 
2050 
2051 //*************************************************************************************************
2068 template< typename MT // Type of the dense matrix
2069  , bool SO > // Storage order
2070 inline decltype(auto) atan( const DenseMatrix<MT,SO>& dm )
2071 {
2073 
2074  return map( ~dm, Atan() );
2075 }
2076 //*************************************************************************************************
2077 
2078 
2079 //*************************************************************************************************
2099 template< typename MT // Type of the dense matrix
2100  , bool SO > // Storage order
2101 inline decltype(auto) tanh( const DenseMatrix<MT,SO>& dm )
2102 {
2104 
2105  return map( ~dm, Tanh() );
2106 }
2107 //*************************************************************************************************
2108 
2109 
2110 //*************************************************************************************************
2130 template< typename MT // Type of the dense matrix
2131  , bool SO > // Storage order
2132 inline decltype(auto) atanh( const DenseMatrix<MT,SO>& dm )
2133 {
2135 
2136  return map( ~dm, Atanh() );
2137 }
2138 //*************************************************************************************************
2139 
2140 
2141 //*************************************************************************************************
2158 template< typename MT // Type of the dense matrix
2159  , bool SO > // Storage order
2160 inline decltype(auto) erf( const DenseMatrix<MT,SO>& dm )
2161 {
2163 
2164  return map( ~dm, Erf() );
2165 }
2166 //*************************************************************************************************
2167 
2168 
2169 //*************************************************************************************************
2186 template< typename MT // Type of the dense matrix
2187  , bool SO > // Storage order
2188 inline decltype(auto) erfc( const DenseMatrix<MT,SO>& dm )
2189 {
2191 
2192  return map( ~dm, Erfc() );
2193 }
2194 //*************************************************************************************************
2195 
2196 
2197 
2198 
2199 //=================================================================================================
2200 //
2201 // GLOBAL RESTRUCTURING FUNCTIONS
2202 //
2203 //=================================================================================================
2204 
2205 //*************************************************************************************************
2216 template< typename MT // Type of the dense matrix
2217  , bool SO > // Storage order
2218 inline decltype(auto) abs( const DMatMapExpr<MT,Abs,SO>& dm )
2219 {
2221 
2222  return dm;
2223 }
2225 //*************************************************************************************************
2226 
2227 
2228 //*************************************************************************************************
2239 template< typename MT // Type of the dense matrix
2240  , bool SO > // Storage order
2241 inline decltype(auto) sign( const DMatMapExpr<MT,Sign,SO>& dm )
2242 {
2244 
2245  return dm;
2246 }
2248 //*************************************************************************************************
2249 
2250 
2251 //*************************************************************************************************
2262 template< typename MT // Type of the dense matrix
2263  , bool SO > // Storage order
2264 inline decltype(auto) floor( const DMatMapExpr<MT,Floor,SO>& dm )
2265 {
2267 
2268  return dm;
2269 }
2271 //*************************************************************************************************
2272 
2273 
2274 //*************************************************************************************************
2285 template< typename MT // Type of the dense matrix
2286  , bool SO > // Storage order
2287 inline decltype(auto) ceil( const DMatMapExpr<MT,Ceil,SO>& dm )
2288 {
2290 
2291  return dm;
2292 }
2294 //*************************************************************************************************
2295 
2296 
2297 //*************************************************************************************************
2308 template< typename MT // Type of the dense matrix
2309  , bool SO > // Storage order
2310 inline decltype(auto) trunc( const DMatMapExpr<MT,Trunc,SO>& dm )
2311 {
2313 
2314  return dm;
2315 }
2317 //*************************************************************************************************
2318 
2319 
2320 //*************************************************************************************************
2331 template< typename MT // Type of the dense matrix
2332  , bool SO > // Storage order
2333 inline decltype(auto) round( const DMatMapExpr<MT,Round,SO>& dm )
2334 {
2336 
2337  return dm;
2338 }
2340 //*************************************************************************************************
2341 
2342 
2343 //*************************************************************************************************
2361 template< typename MT // Type of the dense matrix
2362  , bool SO > // Storage order
2363 inline decltype(auto) conj( const DMatMapExpr<MT,Conj,SO>& dm )
2364 {
2366 
2367  return dm.operand();
2368 }
2370 //*************************************************************************************************
2371 
2372 
2373 //*************************************************************************************************
2391 template< typename MT // Type of the dense matrix
2392  , bool SO > // Storage order
2393 inline decltype(auto) conj( const DMatTransExpr<DMatMapExpr<MT,Conj,SO>,!SO>& dm )
2394 {
2396 
2397  return trans( dm.operand().operand() );
2398 }
2400 //*************************************************************************************************
2401 
2402 
2403 //*************************************************************************************************
2414 template< typename MT // Type of the dense matrix
2415  , bool SO > // Storage order
2416 inline decltype(auto) real( const DMatMapExpr<MT,Real,SO>& dm )
2417 {
2419 
2420  return dm;
2421 }
2423 //*************************************************************************************************
2424 
2425 
2426 
2427 
2428 //=================================================================================================
2429 //
2430 // GLOBAL ARITHMETIC OPERATORS
2431 //
2432 //=================================================================================================
2433 
2434 //*************************************************************************************************
2455 template< typename MT // Type of the left-hand side dense matrix
2456  , bool SO // Storage order of the left-hand side dense matrix
2457  , typename ST // Type of the right-hand side scalar
2458  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
2459 inline decltype(auto) operator+( const DenseMatrix<MT,SO>& mat, ST scalar )
2460 {
2462 
2463  using ScalarType = AddTrait_t< UnderlyingBuiltin_t<MT>, ST >;
2464  return map( ~mat, blaze::bind2nd( Add{}, ScalarType( scalar ) ) );
2465 }
2466 //*************************************************************************************************
2467 
2468 
2469 //*************************************************************************************************
2490 template< typename ST // Type of the left-hand side scalar
2491  , typename MT // Type of the right-hand side dense matrix
2492  , bool SO // Storage order of the right-hand side dense matrix
2493  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
2494 inline decltype(auto) operator+( ST scalar, const DenseMatrix<MT,SO>& mat )
2495 {
2497 
2498  using ScalarType = AddTrait_t< ST, UnderlyingBuiltin_t<MT> >;
2499  return map( ~mat, blaze::bind1st( Add{}, ScalarType( scalar ) ) );
2500 }
2501 //*************************************************************************************************
2502 
2503 
2504 //*************************************************************************************************
2526 template< typename MT // Type of the left-hand side dense matrix
2527  , bool SO // Storage order of the left-hand side dense matrix
2528  , typename ST // Type of the right-hand side scalar
2529  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
2530 inline decltype(auto) operator-( const DenseMatrix<MT,SO>& mat, ST scalar )
2531 {
2533 
2534  using ScalarType = SubTrait_t< UnderlyingBuiltin_t<MT>, ST >;
2535  return map( ~mat, blaze::bind2nd( Sub{}, ScalarType( scalar ) ) );
2536 }
2537 //*************************************************************************************************
2538 
2539 
2540 //*************************************************************************************************
2562 template< typename ST // Type of the left-hand side scalar
2563  , typename MT // Type of the right-hand side dense matrix
2564  , bool SO // Storage order of the right-hand side dense matrix
2565  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
2566 inline decltype(auto) operator-( ST scalar, const DenseMatrix<MT,SO>& mat )
2567 {
2569 
2570  using ScalarType = SubTrait_t< ST, UnderlyingBuiltin_t<MT> >;
2571  return map( ~mat, blaze::bind1st( Sub{}, ScalarType( scalar ) ) );
2572 }
2573 //*************************************************************************************************
2574 
2575 
2576 //*************************************************************************************************
2597 template< typename ST // Type of the left-hand side scalar
2598  , typename MT // Type of the right-hand side dense matrix
2599  , bool SO // Storage order of the right-hand side dense matrix
2600  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
2601 inline decltype(auto) operator/( ST scalar, const DenseMatrix<MT,SO>& mat )
2602 {
2604 
2605  using ScalarType = DivTrait_t< ST, UnderlyingBuiltin_t<MT> >;
2606  return map( ~mat, blaze::bind1st( Div{}, ScalarType( scalar ) ) );
2607 }
2608 //*************************************************************************************************
2609 
2610 
2611 //*************************************************************************************************
2627 template< typename MT // Type of the dense matrix
2628  , bool SO > // Transpose flag
2629 inline decltype(auto) operator<<( const DenseMatrix<MT,SO>& mat, int count )
2630 {
2632 
2633  return map( ~mat, ShiftLI( count ) );
2634 }
2635 //*************************************************************************************************
2636 
2637 
2638 //*************************************************************************************************
2654 template< typename MT // Type of the dense matrix
2655  , bool SO > // Transpose flag
2656 inline decltype(auto) operator>>( const DenseMatrix<MT,SO>& mat, int count )
2657 {
2659 
2660  return map( ~mat, ShiftRI( count ) );
2661 }
2662 //*************************************************************************************************
2663 
2664 
2665 //*************************************************************************************************
2681 template< typename MT // Type of the left-hand side dense matrix
2682  , bool SO // Storage order of the left-hand side dense matrix
2683  , typename ST // Type of the right-hand side scalar
2684  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
2685 inline decltype(auto) operator&( const DenseMatrix<MT,SO>& mat, ST scalar )
2686 {
2688 
2689  return map( ~mat, blaze::bind2nd( Bitand{}, scalar ) );
2690 }
2691 //*************************************************************************************************
2692 
2693 
2694 //*************************************************************************************************
2710 template< typename MT // Type of the left-hand side dense matrix
2711  , bool SO // Storage order of the left-hand side dense matrix
2712  , typename ST // Type of the right-hand side scalar
2713  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
2714 inline decltype(auto) operator|( const DenseMatrix<MT,SO>& mat, ST scalar )
2715 {
2717 
2718  return map( ~mat, blaze::bind2nd( Bitor{}, scalar ) );
2719 }
2720 //*************************************************************************************************
2721 
2722 
2723 //*************************************************************************************************
2739 template< typename MT // Type of the left-hand side dense matrix
2740  , bool SO // Storage order of the left-hand side dense matrix
2741  , typename ST // Type of the right-hand side scalar
2742  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
2743 inline decltype(auto) operator^( const DenseMatrix<MT,SO>& mat, ST scalar )
2744 {
2746 
2747  return map( ~mat, blaze::bind2nd( Bitxor{}, scalar ) );
2748 }
2749 //*************************************************************************************************
2750 
2751 
2752 
2753 
2754 //=================================================================================================
2755 //
2756 // GLOBAL LOGICAL OPERATORS
2757 //
2758 //=================================================================================================
2759 
2760 //*************************************************************************************************
2775 template< typename MT // Type of the dense matrix
2776  , bool SO > // Storage order of the dense matrix
2777 inline decltype(auto) operator!( const DenseMatrix<MT,SO>& mat )
2778 {
2780 
2781  return map( ~mat, Not{} );
2782 }
2783 //*************************************************************************************************
2784 
2785 
2786 
2787 
2788 //=================================================================================================
2789 //
2790 // ISALIGNED SPECIALIZATIONS
2791 //
2792 //=================================================================================================
2793 
2794 //*************************************************************************************************
2796 template< typename MT, typename OP, bool SO >
2797 struct IsAligned< DMatMapExpr<MT,OP,SO> >
2798  : public IsAligned<MT>
2799 {};
2801 //*************************************************************************************************
2802 
2803 
2804 
2805 
2806 //=================================================================================================
2807 //
2808 // ISPADDED SPECIALIZATIONS
2809 //
2810 //=================================================================================================
2811 
2812 //*************************************************************************************************
2814 template< typename MT, typename OP, bool SO >
2815 struct IsPadded< DMatMapExpr<MT,OP,SO> >
2816  : public BoolConstant< IsPadded_v<MT> && IsPaddingEnabled_v<OP> >
2817 {};
2819 //*************************************************************************************************
2820 
2821 } // namespace blaze
2822 
2823 #endif
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DMatMapExpr.h:557
Header file for the UnderlyingNumeric type trait.
Generic wrapper for the trunc() function.
Definition: Trunc.h:81
Header file for the IsPaddingEnabled type trait.
Pointer difference type of the Blaze library.
decltype(auto) acosh(const DenseMatrix< MT, SO > &dm)
Computes the inverse hyperbolic cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2014
Header file for auxiliary alias declarations.
ElementType_t< MT > ET
Element type of the dense matrix expression.
Definition: DMatMapExpr.h:112
Generic wrapper for the ceil() function.
Definition: Ceil.h:81
decltype(auto) exp10(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1688
typename SubTrait< T1, T2 >::Type SubTrait_t
Auxiliary alias declaration for the SubTrait class template.The SubTrait_t alias declaration provides...
Definition: SubTrait.h:238
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DMatMapExpr.h:387
Generic wrapper for the cbrt() function.
Definition: Cbrt.h:81
Header file for the subtraction trait.
Header file for the HasLoad type trait.
BLAZE_DEVICE_CALLABLE ConstIterator(IteratorType it, OP op)
Constructor for the ConstIterator class.
Definition: DMatMapExpr.h:199
Header file for basic type definitions.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DMatMapExpr.h:589
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
Generic wrapper for the uniform left-shift operation.
Definition: ShiftLI.h:76
Operand dm_
Dense matrix of the map expression.
Definition: DMatMapExpr.h:596
Generic wrapper for the sin() function.
Definition: Sin.h:79
OP Operation
Data type of the custom unary operation.
Definition: DMatMapExpr.h:166
Generic wrapper for the conj() function.
Definition: Conj.h:83
Generic wrapper for the invsqrt() function.
Definition: InvSqrt.h:69
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatMapExpr.h:579
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
Header file for the serial shim.
decltype(auto) real(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the real part of each single element of dm.
Definition: DMatMapExpr.h:1389
#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
Generic wrapper for the division operator.
Definition: Div.h:79
BLAZE_DEVICE_CALLABLE bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DMatMapExpr.h:308
typename DivTrait< T1, T2 >::Type DivTrait_t
Auxiliary alias declaration for the DivTrait class template.The DivTrait_t alias declaration provides...
Definition: DivTrait.h:239
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
Header file for the IsSame and IsStrictlySame type traits.
decltype(auto) ceil(const DenseMatrix< MT, SO > &dm)
Applies the ceil() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1240
Generic wrapper for the clamp() function.
Definition: Clamp.h:61
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 acosh() function.
Definition: Acosh.h:69
decltype(auto) clamp(const DenseMatrix< MT, SO > &dm, const DT &min, const DT &max)
Restricts each single element of the dense matrix dm to the range .
Definition: DMatMapExpr.h:1572
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DMatMapExpr.h:223
ResultType_t< MT > RT
Result type of the dense matrix expression.
Definition: DMatMapExpr.h:110
Generic wrapper for the addition operator.
Definition: Add.h:83
decltype(auto) sign(const DenseMatrix< MT, SO > &dm)
Applies the sign() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1184
ValueType value_type
Type of the underlying elements.
Definition: DMatMapExpr.h:184
Generic wrapper for the subtraction operator.
Definition: Sub.h:83
Header file for the Computation base class.
ElementType & ReferenceType
Reference return type.
Definition: DMatMapExpr.h:179
Header file for the RequiresEvaluation type trait.
BLAZE_DEVICE_CALLABLE bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatMapExpr.h:352
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DMatMapExpr.h:399
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
ReferenceType reference
Reference return type.
Definition: DMatMapExpr.h:186
decltype(auto) acos(const DenseMatrix< MT, SO > &dm)
Computes the inverse cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1955
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DMatMapExpr.h:154
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes....
Definition: DenseMatrix.h:81
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DMatMapExpr.h:414
Iterator over the elements of the dense matrix map expression.
Definition: DMatMapExpr.h:172
auto load() const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatMapExpr.h:286
decltype(auto) erf(const DenseMatrix< MT, SO > &dm)
Computes the error function for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2160
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
Generic wrapper for the abs() function.
Definition: Abs.h:83
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DMatMapExpr.h:461
Header file for the MatMapExpr base class.
Operation operation() const
Returns a copy of the custom operation.
Definition: DMatMapExpr.h:545
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the map expression.
Definition: DMatMapExpr.h:124
BLAZE_DEVICE_CALLABLE bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatMapExpr.h:330
Generic wrapper for the sqrt() function.
Definition: Sqrt.h:83
ElementType ValueType
Type of the underlying elements.
Definition: DMatMapExpr.h:177
ReturnType_t< MT > RN
Return type of the dense matrix expression.
Definition: DMatMapExpr.h:113
BLAZE_DEVICE_CALLABLE bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatMapExpr.h:319
Header file for the multiplication trait.
typename UnderlyingNumeric< T >::Type UnderlyingNumeric_t
Auxiliary alias declaration for the UnderlyingNumeric type trait.The UnderlyingNumeric_t alias declar...
Definition: UnderlyingNumeric.h:117
decltype(auto) cos(const DenseMatrix< MT, SO > &dm)
Computes the cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1924
OppositeType_t< MT > OT
Opposite type of the dense matrix expression.
Definition: DMatMapExpr.h:111
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DMatMapExpr.h:569
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
decltype(auto) ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatMapExpr.h:1361
Header file for the If class template.
Generic wrapper for the imag() function.
Definition: Imag.h:74
Generic wrapper for the exp10() function.
Definition: Exp10.h:67
decltype(auto) exp2(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1660
BLAZE_DEVICE_CALLABLE DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DMatMapExpr.h:363
decltype(auto) sinh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1868
MapTrait_t< RT, OP > ResultType
Result type for expression template evaluations.
Definition: DMatMapExpr.h:151
Header file for the UnderlyingBuiltin type trait.
decltype(auto) asin(const DenseMatrix< MT, SO > &dm)
Computes the inverse sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1840
decltype(auto) cosh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1983
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DMatMapExpr.h:153
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
decltype(auto) cbrt(const DenseMatrix< MT, SO > &dm)
Computes the cubic root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1510
#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.
Generic wrapper for the log10() function.
Definition: Log10.h:69
decltype(auto) trunc(const DenseMatrix< MT, SO > &dm)
Applies the trunc() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1268
Header file for all functors.
Header file for all SIMD functionality.
Operand operand() const noexcept
Returns the dense matrix operand.
Definition: DMatMapExpr.h:535
constexpr Bind2nd< OP, A2 > bind2nd(const OP &op, const A2 &a2)
Binds the given object/value to the 2nd parameter of the given binary operation.
Definition: Bind2nd.h:154
BLAZE_ALWAYS_INLINE auto load(size_t i, size_t j) const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatMapExpr.h:479
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DMatMapExpr.h:419
typename AddTrait< T1, T2 >::Type AddTrait_t
Auxiliary alias declaration for the AddTrait class template.The AddTrait_t alias declaration provides...
Definition: AddTrait.h:238
Header file for the IsAligned type trait.
Generic wrapper for the exp2() function.
Definition: Exp2.h:67
Base class for all unary matrix map expression templates.The MatMapExpr class serves as a tag for all...
Definition: MatMapExpr.h:66
Generic wrapper for the asin() function.
Definition: Asin.h:79
Operation op_
The custom unary operation.
Definition: DMatMapExpr.h:597
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DMatMapExpr.h:180
decltype(auto) atan(const DenseMatrix< MT, SO > &dm)
Computes the inverse tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2070
decltype(auto) asinh(const DenseMatrix< MT, SO > &dm)
Computes the inverse hyperbolic sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1896
BLAZE_DEVICE_CALLABLE bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatMapExpr.h:341
Generic wrapper for the erf() function.
Definition: Erf.h:77
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DMatMapExpr.h:176
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition: DMatMapExpr.h:255
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
ReturnType operator()(size_t i, size_t j) const noexcept
2D-access to the matrix elements.
Definition: DMatMapExpr.h:446
Constraint on the data type.
Generic wrapper for the floor() function.
Definition: Floor.h:81
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DMatMapExpr.h:211
decltype(auto) exp(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1632
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
decltype(auto) abs(const DenseMatrix< MT, SO > &dm)
Applies the abs() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1156
Generic wrapper for the bitwise XOR ('^') operator.
Definition: Bitxor.h:66
decltype(auto) log(const DenseMatrix< MT, SO > &dm)
Computes the natural logarithm for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1719
IteratorCategory iterator_category
The iterator category.
Definition: DMatMapExpr.h:183
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.The MultTrait_t alias declaration provid...
Definition: MultTrait.h:240
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.The OppositeType_t alias declaration provi...
Definition: Aliases.h:270
Header file for the IsNumeric type trait.
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DMatMapExpr.h:525
decltype(auto) floor(const DenseMatrix< MT, SO > &dm)
Applies the floor() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1212
BLAZE_DEVICE_CALLABLE ReturnType operator *() const
Direct access to the element at the current iterator position.
Definition: DMatMapExpr.h:276
ElementType * PointerType
Pointer return type.
Definition: DMatMapExpr.h:178
decltype(auto) round(const DenseMatrix< MT, SO > &dm)
Applies the round() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1296
Header file for the IsSIMDEnabled type trait.
decltype(auto) tanh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2101
decltype(auto) forEach(const DenseMatrix< MT, SO > &dm, OP op)
Evaluates the given custom operation on each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1128
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition: DMatMapExpr.h:266
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.
Generic wrapper for the pow() function.
Definition: Pow.h:63
Generic wrapper for the atanh() function.
Definition: Atanh.h:79
Generic wrapper for the invcbrt() function.
Definition: InvCbrt.h:67
Generic wrapper for the real() function.
Definition: Real.h:80
Header file for the addition trait.
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DMatMapExpr.h:375
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
Header file for the division trait.
Generic wrapper for the bitwise AND ('&') operator.
Definition: Bitand.h:80
Generic wrapper for the asinh() function.
Definition: Asinh.h:79
decltype(auto) invcbrt(const DenseMatrix< MT, SO > &dm)
Computes the inverse cubic root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1541
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: DMatMapExpr.h:494
Generic wrapper for the tan() function.
Definition: Tan.h:79
Generic wrapper for the log() function.
Definition: Log.h:69
decltype(auto) atanh(const DenseMatrix< MT, SO > &dm)
Computes the inverse hyperbolic tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2132
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.
Generic wrapper for the logical NOT operator.
Definition: Not.h:58
IteratorType it_
Iterator to the current matrix element.
Definition: DMatMapExpr.h:406
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
OP op_
The custom unary operation.
Definition: DMatMapExpr.h:407
Generic wrapper for the erfc() function.
Definition: Erfc.h:67
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.
Generic wrapper for the cos() function.
Definition: Cos.h:69
#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
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant alias template represents ...
Definition: IntegralConstant.h:110
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
#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
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatMapExpr.h:152
Generic wrapper for the sign() function.
Definition: Sign.h:81
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DMatMapExpr.h:424
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
decltype(auto) sin(const DenseMatrix< MT, SO > &dm)
Computes the sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1809
decltype(auto) erfc(const DenseMatrix< MT, SO > &dm)
Computes the complementary error function for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2188
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DMatMapExpr.h:515
Macro for CUDA compatibility.
BLAZE_DEVICE_CALLABLE bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DMatMapExpr.h:297
decltype(auto) sqrt(const DenseMatrix< MT, SO > &dm)
Computes the square root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1448
If_t< IsExpression_v< MT >, const MT, const MT & > Operand
Composite data type of the dense matrix expression.
Definition: DMatMapExpr.h:163
Header file for the IsComputation type trait class.
PointerType pointer
Pointer return type.
Definition: DMatMapExpr.h:185
Header file for the IsBuiltin type trait.
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
Expression object for the dense matrix map() function.The DMatMapExpr class represents the compile ti...
Definition: DMatMapExpr.h:104
Generic wrapper for the acos() function.
Definition: Acos.h:69
If_t< useAssign, const ResultType, const DMatMapExpr & > CompositeType
Data type for composite expression templates.
Definition: DMatMapExpr.h:160
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:66
decltype(auto) tan(const DenseMatrix< MT, SO > &dm)
Computes the tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2042
ConstIterator_t< MT > IteratorType
ConstIterator type of the dense matrix expression.
Definition: DMatMapExpr.h:190
Generic wrapper for the atan() function.
Definition: Atan.h:79
Generic wrapper for the round() function.
Definition: Round.h:81
Generic wrapper for the sinh() function.
Definition: Sinh.h:79
Header file for the IntegralConstant class template.
Header file for the map trait.
decltype(auto) log10(const DenseMatrix< MT, SO > &dm)
Computes the common logarithm for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1781
Generic wrapper for the log2() function.
Definition: Log2.h:67
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition: HostDevice.h:94
decltype(auto) imag(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the imaginary part of each single element of dm.
Definition: DMatMapExpr.h:1417
decltype(std::declval< OP >()(std::declval< RN >())) ReturnType
Return type for expression template evaluations.
Definition: DMatMapExpr.h:157
Generic wrapper for the cosh() function.
Definition: Cosh.h:69
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1324
decltype(auto) log2(const DenseMatrix< MT, SO > &dm)
Computes the binary logarithm for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1750
decltype(auto) invsqrt(const DenseMatrix< MT, SO > &dm)
Computes the inverse square root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1479
Generic wrapper for the tanh() function.
Definition: Tanh.h:79
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: DMatMapExpr.h:505
Generic wrapper for the exp() function.
Definition: Exp.h:69
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
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition: DMatMapExpr.h:245
constexpr Bind1st< OP, A1 > bind1st(const OP &op, const A1 &a1)
Binds the given object/value to the 1st parameter of the given binary operation.
Definition: Bind1st.h:154
Generic wrapper for the uniform right-shift operation.
Definition: ShiftRI.h:75
Header file for the IsExpression type trait class.
Header file for the function trace functionality.
DMatMapExpr(const MT &dm, OP op) noexcept
Constructor for the DMatMapExpr class.
Definition: DMatMapExpr.h:433
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition: DMatMapExpr.h:234
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