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>
68 #include <blaze/system/Inline.h>
69 #include <blaze/util/Assert.h>
70 #include <blaze/util/EnableIf.h>
73 #include <blaze/util/mpl/If.h>
74 #include <blaze/util/Types.h>
79 
80 
81 namespace blaze {
82 
83 //=================================================================================================
84 //
85 // CLASS DMATMAPEXPR
86 //
87 //=================================================================================================
88 
89 //*************************************************************************************************
96 template< typename MT // Type of the dense matrix
97  , typename OP // Type of the custom operation
98  , bool SO > // Storage order
100  : public MatMapExpr< DenseMatrix< DMatMapExpr<MT,OP,SO>, SO > >
101  , private Computation
102 {
103  private:
104  //**Type definitions****************************************************************************
109  //**********************************************************************************************
110 
111  //**Serial evaluation strategy******************************************************************
113 
119  static constexpr bool useAssign = RequiresEvaluation_v<MT>;
120 
122  template< typename MT2 >
124  static constexpr bool UseAssign_v = useAssign;
126  //**********************************************************************************************
127 
128  //**Parallel evaluation strategy****************************************************************
130 
136  template< typename MT2 >
137  static constexpr bool UseSMPAssign_v =
140  //**********************************************************************************************
141 
142  public:
143  //**Type definitions****************************************************************************
150 
152  using ReturnType = decltype( std::declval<OP>()( std::declval<RN>() ) );
153 
156 
158  using Operand = If_t< IsExpression_v<MT>, const MT, const MT& >;
159 
161  using Operation = OP;
162  //**********************************************************************************************
163 
164  //**ConstIterator class definition**************************************************************
168  {
169  public:
170  //**Type definitions*************************************************************************
171  using IteratorCategory = std::random_access_iterator_tag;
176 
177  // STL iterator requirements
183 
186  //*******************************************************************************************
187 
188  //**Constructor******************************************************************************
194  explicit inline ConstIterator( IteratorType it, OP op )
195  : it_( it ) // Iterator to the current matrix element
196  , op_( op ) // The custom unary operation
197  {}
198  //*******************************************************************************************
199 
200  //**Addition assignment operator*************************************************************
206  inline ConstIterator& operator+=( size_t inc ) {
207  it_ += inc;
208  return *this;
209  }
210  //*******************************************************************************************
211 
212  //**Subtraction assignment operator**********************************************************
218  inline ConstIterator& operator-=( size_t dec ) {
219  it_ -= dec;
220  return *this;
221  }
222  //*******************************************************************************************
223 
224  //**Prefix increment operator****************************************************************
230  ++it_;
231  return *this;
232  }
233  //*******************************************************************************************
234 
235  //**Postfix increment operator***************************************************************
240  inline const ConstIterator operator++( int ) {
241  return ConstIterator( it_++, op_ );
242  }
243  //*******************************************************************************************
244 
245  //**Prefix decrement operator****************************************************************
251  --it_;
252  return *this;
253  }
254  //*******************************************************************************************
255 
256  //**Postfix decrement operator***************************************************************
261  inline const ConstIterator operator--( int ) {
262  return ConstIterator( it_--, op_ );
263  }
264  //*******************************************************************************************
265 
266  //**Element access operator******************************************************************
271  inline ReturnType operator*() const {
272  return op_( *it_ );
273  }
274  //*******************************************************************************************
275 
276  //**Load function****************************************************************************
281  inline auto load() const noexcept {
282  return op_.load( it_.load() );
283  }
284  //*******************************************************************************************
285 
286  //**Equality operator************************************************************************
292  inline bool operator==( const ConstIterator& rhs ) const {
293  return it_ == rhs.it_;
294  }
295  //*******************************************************************************************
296 
297  //**Inequality operator**********************************************************************
303  inline bool operator!=( const ConstIterator& rhs ) const {
304  return it_ != rhs.it_;
305  }
306  //*******************************************************************************************
307 
308  //**Less-than operator***********************************************************************
314  inline bool operator<( const ConstIterator& rhs ) const {
315  return it_ < rhs.it_;
316  }
317  //*******************************************************************************************
318 
319  //**Greater-than operator********************************************************************
325  inline bool operator>( const ConstIterator& rhs ) const {
326  return it_ > rhs.it_;
327  }
328  //*******************************************************************************************
329 
330  //**Less-or-equal-than operator**************************************************************
336  inline bool operator<=( const ConstIterator& rhs ) const {
337  return it_ <= rhs.it_;
338  }
339  //*******************************************************************************************
340 
341  //**Greater-or-equal-than operator***********************************************************
347  inline bool operator>=( const ConstIterator& rhs ) const {
348  return it_ >= rhs.it_;
349  }
350  //*******************************************************************************************
351 
352  //**Subtraction operator*********************************************************************
358  inline DifferenceType operator-( const ConstIterator& rhs ) const {
359  return it_ - rhs.it_;
360  }
361  //*******************************************************************************************
362 
363  //**Addition operator************************************************************************
370  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
371  return ConstIterator( it.it_ + inc, it.op_ );
372  }
373  //*******************************************************************************************
374 
375  //**Addition operator************************************************************************
382  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
383  return ConstIterator( it.it_ + inc, it.op_ );
384  }
385  //*******************************************************************************************
386 
387  //**Subtraction operator*********************************************************************
394  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
395  return ConstIterator( it.it_ - dec, it.op_ );
396  }
397  //*******************************************************************************************
398 
399  private:
400  //**Member variables*************************************************************************
402  OP op_;
403  //*******************************************************************************************
404  };
405  //**********************************************************************************************
406 
407  //**Compilation flags***************************************************************************
409  static constexpr bool simdEnabled =
410  ( MT::simdEnabled &&
411  If_t< HasSIMDEnabled_v<OP>, GetSIMDEnabled<OP,ET>, HasLoad<OP> >::value );
412 
414  static constexpr bool smpAssignable = MT::smpAssignable;
415  //**********************************************************************************************
416 
417  //**SIMD properties*****************************************************************************
419  static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
420  //**********************************************************************************************
421 
422  //**Constructor*********************************************************************************
428  explicit inline DMatMapExpr( const MT& dm, OP op ) noexcept
429  : dm_( dm ) // Dense matrix of the map expression
430  , op_( op ) // The custom unary operation
431  {}
432  //**********************************************************************************************
433 
434  //**Access operator*****************************************************************************
441  inline ReturnType operator()( size_t i, size_t j ) const noexcept {
442  BLAZE_INTERNAL_ASSERT( i < dm_.rows() , "Invalid row access index" );
443  BLAZE_INTERNAL_ASSERT( j < dm_.columns(), "Invalid column access index" );
444  return op_( dm_(i,j) );
445  }
446  //**********************************************************************************************
447 
448  //**At function*********************************************************************************
456  inline ReturnType at( size_t i, size_t j ) const {
457  if( i >= dm_.rows() ) {
458  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
459  }
460  if( j >= dm_.columns() ) {
461  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
462  }
463  return (*this)(i,j);
464  }
465  //**********************************************************************************************
466 
467  //**Load function*******************************************************************************
474  BLAZE_ALWAYS_INLINE auto load( size_t i, size_t j ) const noexcept {
475  BLAZE_INTERNAL_ASSERT( i < dm_.rows() , "Invalid row access index" );
476  BLAZE_INTERNAL_ASSERT( j < dm_.columns(), "Invalid column access index" );
477  BLAZE_INTERNAL_ASSERT( !SO || ( i % SIMDSIZE == 0UL ), "Invalid row access index" );
478  BLAZE_INTERNAL_ASSERT( SO || ( j % SIMDSIZE == 0UL ), "Invalid column access index" );
479  return op_.load( dm_.load(i,j) );
480  }
481  //**********************************************************************************************
482 
483  //**Begin function******************************************************************************
489  inline ConstIterator begin( size_t i ) const {
490  return ConstIterator( dm_.begin(i), op_ );
491  }
492  //**********************************************************************************************
493 
494  //**End function********************************************************************************
500  inline ConstIterator end( size_t i ) const {
501  return ConstIterator( dm_.end(i), op_ );
502  }
503  //**********************************************************************************************
504 
505  //**Rows function*******************************************************************************
510  inline size_t rows() const noexcept {
511  return dm_.rows();
512  }
513  //**********************************************************************************************
514 
515  //**Columns function****************************************************************************
520  inline size_t columns() const noexcept {
521  return dm_.columns();
522  }
523  //**********************************************************************************************
524 
525  //**Operand access******************************************************************************
530  inline Operand operand() const noexcept {
531  return dm_;
532  }
533  //**********************************************************************************************
534 
535  //**Operation access****************************************************************************
540  inline Operation operation() const {
541  return op_;
542  }
543  //**********************************************************************************************
544 
545  //**********************************************************************************************
551  template< typename T >
552  inline bool canAlias( const T* alias ) const noexcept {
553  return IsExpression_v<MT> && dm_.canAlias( alias );
554  }
555  //**********************************************************************************************
556 
557  //**********************************************************************************************
563  template< typename T >
564  inline bool isAliased( const T* alias ) const noexcept {
565  return dm_.isAliased( alias );
566  }
567  //**********************************************************************************************
568 
569  //**********************************************************************************************
574  inline bool isAligned() const noexcept {
575  return dm_.isAligned();
576  }
577  //**********************************************************************************************
578 
579  //**********************************************************************************************
584  inline bool canSMPAssign() const noexcept {
585  return dm_.canSMPAssign();
586  }
587  //**********************************************************************************************
588 
589  private:
590  //**Member variables****************************************************************************
593  //**********************************************************************************************
594 
595  //**Assignment to dense matrices****************************************************************
610  template< typename MT2 // Type of the target dense matrix
611  , bool SO2 > // Storage order or the target dense matrix
612  friend inline auto assign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
614  IsSame_v< UnderlyingNumeric_t<MT>, UnderlyingNumeric_t<MT2> > >
615  {
617 
618  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
619  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
620 
621  assign( ~lhs, rhs.dm_ );
622  assign( ~lhs, rhs.op_( ~lhs ) );
623  }
625  //**********************************************************************************************
626 
627  //**Assignment to dense matrices****************************************************************
642  template< typename MT2 // Type of the target dense matrix
643  , bool SO2 > // Storage order or the target dense matrix
644  friend inline auto assign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
646  !IsSame_v< UnderlyingNumeric_t<MT>, UnderlyingNumeric_t<MT2> > >
647  {
649 
653 
654  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
655  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
656 
657  const RT tmp( serial( rhs.dm_ ) );
658  assign( ~lhs, map( tmp, rhs.op_ ) );
659  }
661  //**********************************************************************************************
662 
663  //**Assignment to sparse matrices***************************************************************
677  template< typename MT2 // Type of the target sparse matrix
678  , bool SO2 > // Storage order or the target sparse matrix
679  friend inline auto assign( SparseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
680  -> EnableIf_t< UseAssign_v<MT2> >
681  {
683 
684  using TmpType = If_t< SO == SO2, RT, OT >;
685 
692 
693  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
694  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
695 
696  const TmpType tmp( serial( rhs.dm_ ) );
697  assign( ~lhs, rhs.op_( tmp ) );
698  }
700  //**********************************************************************************************
701 
702  //**Addition assignment to dense matrices*******************************************************
716  template< typename MT2 // Type of the target dense matrix
717  , bool SO2 > // Storage order of the target dense matrix
718  friend inline auto addAssign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
719  -> EnableIf_t< UseAssign_v<MT2> >
720  {
722 
726 
727  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
728  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
729 
730  const RT tmp( serial( rhs.dm_ ) );
731  addAssign( ~lhs, map( tmp, rhs.op_ ) );
732  }
734  //**********************************************************************************************
735 
736  //**Addition assignment to sparse matrices******************************************************
737  // No special implementation for the addition assignment to sparse matrices.
738  //**********************************************************************************************
739 
740  //**Subtraction assignment to dense matrices****************************************************
754  template< typename MT2 // Type of the target dense matrix
755  , bool SO2 > // Storage order of the target dense matrix
756  friend inline auto subAssign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
757  -> EnableIf_t< UseAssign_v<MT2> >
758  {
760 
764 
765  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
766  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
767 
768  const RT tmp( serial( rhs.dm_ ) );
769  subAssign( ~lhs, map( tmp, rhs.op_ ) );
770  }
772  //**********************************************************************************************
773 
774  //**Subtraction assignment to sparse matrices***************************************************
775  // No special implementation for the subtraction assignment to sparse matrices.
776  //**********************************************************************************************
777 
778  //**Schur product assignment to dense matrices**************************************************
792  template< typename MT2 // Type of the target dense matrix
793  , bool SO2 > // Storage order of the target dense matrix
794  friend inline auto schurAssign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
795  -> EnableIf_t< UseAssign_v<MT2> >
796  {
798 
802 
803  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
804  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
805 
806  const RT tmp( serial( rhs.dm_ ) );
807  schurAssign( ~lhs, map( tmp, rhs.op_ ) );
808  }
810  //**********************************************************************************************
811 
812  //**Schur product assignment to sparse matrices*************************************************
813  // No special implementation for the Schur product assignment to sparse matrices.
814  //**********************************************************************************************
815 
816  //**Multiplication assignment to dense matrices*************************************************
817  // No special implementation for the multiplication assignment to dense matrices.
818  //**********************************************************************************************
819 
820  //**Multiplication assignment to sparse matrices************************************************
821  // No special implementation for the multiplication assignment to sparse matrices.
822  //**********************************************************************************************
823 
824  //**SMP assignment to dense matrices************************************************************
839  template< typename MT2 // Type of the target dense matrix
840  , bool SO2 > // Storage order or the target dense matrix
841  friend inline auto smpAssign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
842  -> EnableIf_t< UseSMPAssign_v<MT2> &&
843  IsSame_v< UnderlyingNumeric_t<MT>, UnderlyingNumeric_t<MT2> > >
844  {
846 
847  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
848  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
849 
850  smpAssign( ~lhs, rhs.dm_ );
851  smpAssign( ~lhs, rhs.op_( ~lhs ) );
852  }
854  //**********************************************************************************************
855 
856  //**SMP assignment to dense matrices************************************************************
871  template< typename MT2 // Type of the target dense matrix
872  , bool SO2 > // Storage order or the target dense matrix
873  friend inline auto smpAssign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
874  -> EnableIf_t< UseSMPAssign_v<MT2> &&
875  !IsSame_v< UnderlyingNumeric_t<MT>, UnderlyingNumeric_t<MT2> > >
876  {
878 
882 
883  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
884  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
885 
886  const RT tmp( rhs.dm_ );
887  smpAssign( ~lhs, map( tmp, rhs.op_ ) );
888  }
890  //**********************************************************************************************
891 
892  //**SMP assignment to sparse matrices***********************************************************
906  template< typename MT2 // Type of the target sparse matrix
907  , bool SO2 > // Storage order or the target sparse matrix
908  friend inline auto smpAssign( SparseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
909  -> EnableIf_t< UseSMPAssign_v<MT2> >
910  {
912 
913  using TmpType = If_t< SO == SO2, RT, OT >;
914 
921 
922  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
923  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
924 
925  const TmpType tmp( rhs.dm_ );
926  smpAssign( ~lhs, rhs.op_( tmp ) );
927  }
929  //**********************************************************************************************
930 
931  //**SMP addition assignment to dense matrices***************************************************
945  template< typename MT2 // Type of the target dense matrix
946  , bool SO2 > // Storage order of the target dense matrix
947  friend inline auto smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
948  -> EnableIf_t< UseSMPAssign_v<MT2> >
949  {
951 
955 
956  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
957  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
958 
959  const RT tmp( rhs.dm_ );
960  smpAddAssign( ~lhs, map( tmp, rhs.op_ ) );
961  }
963  //**********************************************************************************************
964 
965  //**SMP addition assignment to sparse matrices**************************************************
966  // No special implementation for the SMP addition assignment to sparse matrices.
967  //**********************************************************************************************
968 
969  //**SMP subtraction assignment to dense matrices************************************************
983  template< typename MT2 // Type of the target dense matrix
984  , bool SO2 > // Storage order of the target dense matrix
985  friend inline auto smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
986  -> EnableIf_t< UseSMPAssign_v<MT2> >
987  {
989 
993 
994  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
995  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
996 
997  const RT tmp( rhs.dm_ );
998  smpSubAssign( ~lhs, map( tmp, rhs.op_ ) );
999  }
1001  //**********************************************************************************************
1002 
1003  //**SMP subtraction assignment to sparse matrices***********************************************
1004  // No special implementation for the SMP subtraction assignment to sparse matrices.
1005  //**********************************************************************************************
1006 
1007  //**SMP Schur product assignment to dense matrices**********************************************
1021  template< typename MT2 // Type of the target dense matrix
1022  , bool SO2 > // Storage order of the target dense matrix
1023  friend inline auto smpSchurAssign( DenseMatrix<MT2,SO2>& lhs, const DMatMapExpr& rhs )
1024  -> EnableIf_t< UseSMPAssign_v<MT2> >
1025  {
1027 
1031 
1032  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1033  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1034 
1035  const RT tmp( rhs.dm_ );
1036  smpSchurAssign( ~lhs, map( tmp, rhs.op_ ) );
1037  }
1039  //**********************************************************************************************
1040 
1041  //**SMP Schur product assignment to sparse matrices*********************************************
1042  // No special implementation for the SMP Schur product assignment to sparse matrices.
1043  //**********************************************************************************************
1044 
1045  //**SMP multiplication assignment to dense matrices*********************************************
1046  // No special implementation for the SMP multiplication assignment to dense matrices.
1047  //**********************************************************************************************
1048 
1049  //**SMP multiplication assignment to sparse matrices********************************************
1050  // No special implementation for the SMP multiplication assignment to sparse matrices.
1051  //**********************************************************************************************
1052 
1053  //**Compile time checks*************************************************************************
1058  //**********************************************************************************************
1059 };
1060 //*************************************************************************************************
1061 
1062 
1063 
1064 
1065 //=================================================================================================
1066 //
1067 // GLOBAL FUNCTIONS
1068 //
1069 //=================================================================================================
1070 
1071 //*************************************************************************************************
1089 template< typename MT // Type of the dense matrix
1090  , bool SO // Storage order
1091  , typename OP > // Type of the custom operation
1092 inline decltype(auto) map( const DenseMatrix<MT,SO>& dm, OP op )
1093 {
1095 
1096  using ReturnType = const DMatMapExpr<MT,OP,SO>;
1097  return ReturnType( ~dm, op );
1098 }
1099 //*************************************************************************************************
1100 
1101 
1102 //*************************************************************************************************
1120 template< typename MT // Type of the dense matrix
1121  , bool SO // Storage order
1122  , typename OP > // Type of the custom operation
1123 inline decltype(auto) forEach( const DenseMatrix<MT,SO>& dm, OP op )
1124 {
1126 
1127  using ReturnType = const DMatMapExpr<MT,OP,SO>;
1128  return ReturnType( ~dm, op );
1129 }
1130 //*************************************************************************************************
1131 
1132 
1133 //*************************************************************************************************
1150 template< typename MT // Type of the dense matrix
1151  , bool SO > // Storage order
1152 inline decltype(auto) abs( const DenseMatrix<MT,SO>& dm )
1153 {
1155 
1156  using ReturnType = const DMatMapExpr<MT,Abs,SO>;
1157  return ReturnType( ~dm, Abs() );
1158 }
1159 //*************************************************************************************************
1160 
1161 
1162 //*************************************************************************************************
1179 template< typename MT // Type of the dense matrix
1180  , bool SO > // Storage order
1181 inline decltype(auto) sign( const DenseMatrix<MT,SO>& dm )
1182 {
1184 
1185  using ReturnType = const DMatMapExpr<MT,Sign,SO>;
1186  return ReturnType( ~dm, Sign() );
1187 }
1188 //*************************************************************************************************
1189 
1190 
1191 //*************************************************************************************************
1208 template< typename MT // Type of the dense matrix
1209  , bool SO > // Storage order
1210 inline decltype(auto) floor( const DenseMatrix<MT,SO>& dm )
1211 {
1213 
1214  using ReturnType = const DMatMapExpr<MT,Floor,SO>;
1215  return ReturnType( ~dm, Floor() );
1216 }
1217 //*************************************************************************************************
1218 
1219 
1220 //*************************************************************************************************
1237 template< typename MT // Type of the dense matrix
1238  , bool SO > // Storage order
1239 inline decltype(auto) ceil( const DenseMatrix<MT,SO>& dm )
1240 {
1242 
1243  using ReturnType = const DMatMapExpr<MT,Ceil,SO>;
1244  return ReturnType( ~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  using ReturnType = const DMatMapExpr<MT,Trunc,SO>;
1273  return ReturnType( ~dm, Trunc() );
1274 }
1275 //*************************************************************************************************
1276 
1277 
1278 //*************************************************************************************************
1295 template< typename MT // Type of the dense matrix
1296  , bool SO > // Storage order
1297 inline decltype(auto) round( const DenseMatrix<MT,SO>& dm )
1298 {
1300 
1301  using ReturnType = const DMatMapExpr<MT,Round,SO>;
1302  return ReturnType( ~dm, Round() );
1303 }
1304 //*************************************************************************************************
1305 
1306 
1307 //*************************************************************************************************
1324 template< typename MT // Type of the dense matrix
1325  , bool SO > // Storage order
1326 inline decltype(auto) conj( const DenseMatrix<MT,SO>& dm )
1327 {
1329 
1330  using ReturnType = const DMatMapExpr<MT,Conj,SO>;
1331  return ReturnType( ~dm, Conj() );
1332 }
1333 //*************************************************************************************************
1334 
1335 
1336 //*************************************************************************************************
1362 template< typename MT // Type of the dense matrix
1363  , bool SO > // Storage order
1364 inline decltype(auto) ctrans( const DenseMatrix<MT,SO>& dm )
1365 {
1367 
1368  return trans( conj( ~dm ) );
1369 }
1370 //*************************************************************************************************
1371 
1372 
1373 //*************************************************************************************************
1390 template< typename MT // Type of the dense matrix
1391  , bool SO > // Storage order
1392 inline decltype(auto) real( const DenseMatrix<MT,SO>& dm )
1393 {
1395 
1396  using ReturnType = const DMatMapExpr<MT,Real,SO>;
1397  return ReturnType( ~dm, Real() );
1398 }
1399 //*************************************************************************************************
1400 
1401 
1402 //*************************************************************************************************
1419 template< typename MT // Type of the dense matrix
1420  , bool SO > // Storage order
1421 inline decltype(auto) imag( const DenseMatrix<MT,SO>& dm )
1422 {
1424 
1425  using ReturnType = const DMatMapExpr<MT,Imag,SO>;
1426  return ReturnType( ~dm, Imag() );
1427 }
1428 //*************************************************************************************************
1429 
1430 
1431 //*************************************************************************************************
1451 template< typename MT // Type of the dense matrix
1452  , bool SO > // Storage order
1453 inline decltype(auto) sqrt( const DenseMatrix<MT,SO>& dm )
1454 {
1456 
1457  using ReturnType = const DMatMapExpr<MT,Sqrt,SO>;
1458  return ReturnType( ~dm, Sqrt() );
1459 }
1460 //*************************************************************************************************
1461 
1462 
1463 //*************************************************************************************************
1483 template< typename MT // Type of the dense matrix
1484  , bool SO > // Storage order
1485 inline decltype(auto) invsqrt( const DenseMatrix<MT,SO>& dm )
1486 {
1488 
1489  using ReturnType = const DMatMapExpr<MT,InvSqrt,SO>;
1490  return ReturnType( ~dm, InvSqrt() );
1491 }
1492 //*************************************************************************************************
1493 
1494 
1495 //*************************************************************************************************
1515 template< typename MT // Type of the dense matrix
1516  , bool SO > // Storage order
1517 inline decltype(auto) cbrt( const DenseMatrix<MT,SO>& dm )
1518 {
1520 
1521  using ReturnType = const DMatMapExpr<MT,Cbrt,SO>;
1522  return ReturnType( ~dm, Cbrt() );
1523 }
1524 //*************************************************************************************************
1525 
1526 
1527 //*************************************************************************************************
1547 template< typename MT // Type of the dense matrix
1548  , bool SO > // Storage order
1549 inline decltype(auto) invcbrt( const DenseMatrix<MT,SO>& dm )
1550 {
1552 
1553  using ReturnType = const DMatMapExpr<MT,InvCbrt,SO>;
1554  return ReturnType( ~dm, InvCbrt() );
1555 }
1556 //*************************************************************************************************
1557 
1558 
1559 //*************************************************************************************************
1578 template< typename MT // Type of the dense matrix
1579  , bool SO // Storage order
1580  , typename DT > // Type of the delimiters
1581 inline decltype(auto) clamp( const DenseMatrix<MT,SO>& dm, const DT& min, const DT& max )
1582 {
1584 
1585  using ReturnType = const DMatMapExpr<MT,Clamp<DT>,SO>;
1586  return ReturnType( ~dm, Clamp<DT>( min, max ) );
1587 }
1588 //*************************************************************************************************
1589 
1590 
1591 //*************************************************************************************************
1609 template< typename MT // Type of the dense matrix
1610  , bool SO // Storage order
1611  , typename ST // Type of the scalar exponent
1612  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
1613 inline decltype(auto) pow( const DenseMatrix<MT,SO>& dm, ST exp )
1614 {
1616 
1617  using ScalarType = MultTrait_t< UnderlyingBuiltin_t<MT>, ST >;
1619  return ReturnType( ~dm, UnaryPow<ScalarType>( exp ) );
1620 }
1621 //*************************************************************************************************
1622 
1623 
1624 //*************************************************************************************************
1641 template< typename MT // Type of the dense matrix
1642  , bool SO > // Storage order
1643 inline decltype(auto) exp( const DenseMatrix<MT,SO>& dm )
1644 {
1646 
1647  using ReturnType = const DMatMapExpr<MT,Exp,SO>;
1648  return ReturnType( ~dm, Exp() );
1649 }
1650 //*************************************************************************************************
1651 
1652 
1653 //*************************************************************************************************
1670 template< typename MT // Type of the dense matrix
1671  , bool SO > // Storage order
1672 inline decltype(auto) exp2( const DenseMatrix<MT,SO>& dm )
1673 {
1675 
1676  using ReturnType = const DMatMapExpr<MT,Exp2,SO>;
1677  return ReturnType( ~dm, Exp2() );
1678 }
1679 //*************************************************************************************************
1680 
1681 
1682 //*************************************************************************************************
1699 template< typename MT // Type of the dense matrix
1700  , bool SO > // Storage order
1701 inline decltype(auto) exp10( const DenseMatrix<MT,SO>& dm )
1702 {
1704 
1705  using ReturnType = const DMatMapExpr<MT,Exp10,SO>;
1706  return ReturnType( ~dm, Exp10() );
1707 }
1708 //*************************************************************************************************
1709 
1710 
1711 //*************************************************************************************************
1731 template< typename MT // Type of the dense matrix
1732  , bool SO > // Storage order
1733 inline decltype(auto) log( const DenseMatrix<MT,SO>& dm )
1734 {
1736 
1737  using ReturnType = const DMatMapExpr<MT,Log,SO>;
1738  return ReturnType( ~dm, Log() );
1739 }
1740 //*************************************************************************************************
1741 
1742 
1743 //*************************************************************************************************
1763 template< typename MT // Type of the dense matrix
1764  , bool SO > // Storage order
1765 inline decltype(auto) log2( const DenseMatrix<MT,SO>& dm )
1766 {
1768 
1769  using ReturnType = const DMatMapExpr<MT,Log2,SO>;
1770  return ReturnType( ~dm, Log2() );
1771 }
1772 //*************************************************************************************************
1773 
1774 
1775 //*************************************************************************************************
1795 template< typename MT // Type of the dense matrix
1796  , bool SO > // Storage order
1797 inline decltype(auto) log10( const DenseMatrix<MT,SO>& dm )
1798 {
1800 
1801  using ReturnType = const DMatMapExpr<MT,Log10,SO>;
1802  return ReturnType( ~dm, Log10() );
1803 }
1804 //*************************************************************************************************
1805 
1806 
1807 //*************************************************************************************************
1824 template< typename MT // Type of the dense matrix
1825  , bool SO > // Storage order
1826 inline decltype(auto) sin( const DenseMatrix<MT,SO>& dm )
1827 {
1829 
1830  using ReturnType = const DMatMapExpr<MT,Sin,SO>;
1831  return ReturnType( ~dm, Sin() );
1832 }
1833 //*************************************************************************************************
1834 
1835 
1836 //*************************************************************************************************
1856 template< typename MT // Type of the dense matrix
1857  , bool SO > // Storage order
1858 inline decltype(auto) asin( const DenseMatrix<MT,SO>& dm )
1859 {
1861 
1862  using ReturnType = const DMatMapExpr<MT,Asin,SO>;
1863  return ReturnType( ~dm, Asin() );
1864 }
1865 //*************************************************************************************************
1866 
1867 
1868 //*************************************************************************************************
1885 template< typename MT // Type of the dense matrix
1886  , bool SO > // Storage order
1887 inline decltype(auto) sinh( const DenseMatrix<MT,SO>& dm )
1888 {
1890 
1891  using ReturnType = const DMatMapExpr<MT,Sinh,SO>;
1892  return ReturnType( ~dm, Sinh() );
1893 }
1894 //*************************************************************************************************
1895 
1896 
1897 //*************************************************************************************************
1914 template< typename MT // Type of the dense matrix
1915  , bool SO > // Storage order
1916 inline decltype(auto) asinh( const DenseMatrix<MT,SO>& dm )
1917 {
1919 
1920  using ReturnType = const DMatMapExpr<MT,Asinh,SO>;
1921  return ReturnType( ~dm, Asinh() );
1922 }
1923 //*************************************************************************************************
1924 
1925 
1926 //*************************************************************************************************
1943 template< typename MT // Type of the dense matrix
1944  , bool SO > // Storage order
1945 inline decltype(auto) cos( const DenseMatrix<MT,SO>& dm )
1946 {
1948 
1949  using ReturnType = const DMatMapExpr<MT,Cos,SO>;
1950  return ReturnType( ~dm, Cos() );
1951 }
1952 //*************************************************************************************************
1953 
1954 
1955 //*************************************************************************************************
1975 template< typename MT // Type of the dense matrix
1976  , bool SO > // Storage order
1977 inline decltype(auto) acos( const DenseMatrix<MT,SO>& dm )
1978 {
1980 
1981  using ReturnType = const DMatMapExpr<MT,Acos,SO>;
1982  return ReturnType( ~dm, Acos() );
1983 }
1984 //*************************************************************************************************
1985 
1986 
1987 //*************************************************************************************************
2004 template< typename MT // Type of the dense matrix
2005  , bool SO > // Storage order
2006 inline decltype(auto) cosh( const DenseMatrix<MT,SO>& dm )
2007 {
2009 
2010  using ReturnType = const DMatMapExpr<MT,Cosh,SO>;
2011  return ReturnType( ~dm, Cosh() );
2012 }
2013 //*************************************************************************************************
2014 
2015 
2016 //*************************************************************************************************
2036 template< typename MT // Type of the dense matrix
2037  , bool SO > // Storage order
2038 inline decltype(auto) acosh( const DenseMatrix<MT,SO>& dm )
2039 {
2041 
2042  using ReturnType = const DMatMapExpr<MT,Acosh,SO>;
2043  return ReturnType( ~dm, Acosh() );
2044 }
2045 //*************************************************************************************************
2046 
2047 
2048 //*************************************************************************************************
2065 template< typename MT // Type of the dense matrix
2066  , bool SO > // Storage order
2067 inline decltype(auto) tan( const DenseMatrix<MT,SO>& dm )
2068 {
2070 
2071  using ReturnType = const DMatMapExpr<MT,Tan,SO>;
2072  return ReturnType( ~dm, Tan() );
2073 }
2074 //*************************************************************************************************
2075 
2076 
2077 //*************************************************************************************************
2094 template< typename MT // Type of the dense matrix
2095  , bool SO > // Storage order
2096 inline decltype(auto) atan( const DenseMatrix<MT,SO>& dm )
2097 {
2099 
2100  using ReturnType = const DMatMapExpr<MT,Atan,SO>;
2101  return ReturnType( ~dm, Atan() );
2102 }
2103 //*************************************************************************************************
2104 
2105 
2106 //*************************************************************************************************
2126 template< typename MT // Type of the dense matrix
2127  , bool SO > // Storage order
2128 inline decltype(auto) tanh( const DenseMatrix<MT,SO>& dm )
2129 {
2131 
2132  using ReturnType = const DMatMapExpr<MT,Tanh,SO>;
2133  return ReturnType( ~dm, Tanh() );
2134 }
2135 //*************************************************************************************************
2136 
2137 
2138 //*************************************************************************************************
2158 template< typename MT // Type of the dense matrix
2159  , bool SO > // Storage order
2160 inline decltype(auto) atanh( const DenseMatrix<MT,SO>& dm )
2161 {
2163 
2164  using ReturnType = const DMatMapExpr<MT,Atanh,SO>;
2165  return ReturnType( ~dm, Atanh() );
2166 }
2167 //*************************************************************************************************
2168 
2169 
2170 //*************************************************************************************************
2187 template< typename MT // Type of the dense matrix
2188  , bool SO > // Storage order
2189 inline decltype(auto) erf( const DenseMatrix<MT,SO>& dm )
2190 {
2192 
2193  using ReturnType = const DMatMapExpr<MT,Erf,SO>;
2194  return ReturnType( ~dm, Erf() );
2195 }
2196 //*************************************************************************************************
2197 
2198 
2199 //*************************************************************************************************
2216 template< typename MT // Type of the dense matrix
2217  , bool SO > // Storage order
2218 inline decltype(auto) erfc( const DenseMatrix<MT,SO>& dm )
2219 {
2221 
2222  using ReturnType = const DMatMapExpr<MT,Erfc,SO>;
2223  return ReturnType( ~dm, Erfc() );
2224 }
2225 //*************************************************************************************************
2226 
2227 
2228 
2229 
2230 //=================================================================================================
2231 //
2232 // GLOBAL RESTRUCTURING FUNCTIONS
2233 //
2234 //=================================================================================================
2235 
2236 //*************************************************************************************************
2247 template< typename MT // Type of the dense matrix
2248  , bool SO > // Storage order
2249 inline decltype(auto) abs( const DMatMapExpr<MT,Abs,SO>& dm )
2250 {
2252 
2253  return dm;
2254 }
2256 //*************************************************************************************************
2257 
2258 
2259 //*************************************************************************************************
2270 template< typename MT // Type of the dense matrix
2271  , bool SO > // Storage order
2272 inline decltype(auto) sign( const DMatMapExpr<MT,Sign,SO>& dm )
2273 {
2275 
2276  return dm;
2277 }
2279 //*************************************************************************************************
2280 
2281 
2282 //*************************************************************************************************
2293 template< typename MT // Type of the dense matrix
2294  , bool SO > // Storage order
2295 inline decltype(auto) floor( const DMatMapExpr<MT,Floor,SO>& dm )
2296 {
2298 
2299  return dm;
2300 }
2302 //*************************************************************************************************
2303 
2304 
2305 //*************************************************************************************************
2316 template< typename MT // Type of the dense matrix
2317  , bool SO > // Storage order
2318 inline decltype(auto) ceil( const DMatMapExpr<MT,Ceil,SO>& dm )
2319 {
2321 
2322  return dm;
2323 }
2325 //*************************************************************************************************
2326 
2327 
2328 //*************************************************************************************************
2339 template< typename MT // Type of the dense matrix
2340  , bool SO > // Storage order
2341 inline decltype(auto) trunc( const DMatMapExpr<MT,Trunc,SO>& dm )
2342 {
2344 
2345  return dm;
2346 }
2348 //*************************************************************************************************
2349 
2350 
2351 //*************************************************************************************************
2362 template< typename MT // Type of the dense matrix
2363  , bool SO > // Storage order
2364 inline decltype(auto) round( const DMatMapExpr<MT,Round,SO>& dm )
2365 {
2367 
2368  return dm;
2369 }
2371 //*************************************************************************************************
2372 
2373 
2374 //*************************************************************************************************
2392 template< typename MT // Type of the dense matrix
2393  , bool SO > // Storage order
2394 inline decltype(auto) conj( const DMatMapExpr<MT,Conj,SO>& dm )
2395 {
2397 
2398  return dm.operand();
2399 }
2401 //*************************************************************************************************
2402 
2403 
2404 //*************************************************************************************************
2422 template< typename MT // Type of the dense matrix
2423  , bool SO > // Storage order
2424 inline decltype(auto) conj( const DMatTransExpr<DMatMapExpr<MT,Conj,SO>,!SO>& dm )
2425 {
2427 
2428  using ReturnType = const DMatTransExpr<MT,!SO>;
2429  return ReturnType( dm.operand().operand() );
2430 }
2432 //*************************************************************************************************
2433 
2434 
2435 //*************************************************************************************************
2446 template< typename MT // Type of the dense matrix
2447  , bool SO > // Storage order
2448 inline decltype(auto) real( const DMatMapExpr<MT,Real,SO>& dm )
2449 {
2451 
2452  return dm;
2453 }
2455 //*************************************************************************************************
2456 
2457 
2458 
2459 
2460 //=================================================================================================
2461 //
2462 // ISALIGNED SPECIALIZATIONS
2463 //
2464 //=================================================================================================
2465 
2466 //*************************************************************************************************
2468 template< typename MT, typename OP, bool SO >
2469 struct IsAligned< DMatMapExpr<MT,OP,SO> >
2470  : public IsAligned<MT>
2471 {};
2473 //*************************************************************************************************
2474 
2475 
2476 
2477 
2478 //=================================================================================================
2479 //
2480 // ISPADDED SPECIALIZATIONS
2481 //
2482 //=================================================================================================
2483 
2484 //*************************************************************************************************
2486 template< typename MT, typename OP, bool SO >
2487 struct IsPadded< DMatMapExpr<MT,OP,SO> >
2488  : public BoolConstant< IsPadded_v<MT> && IsPaddingEnabled_v<OP> >
2489 {};
2491 //*************************************************************************************************
2492 
2493 } // namespace blaze
2494 
2495 #endif
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DMatMapExpr.h:552
Header file for the UnderlyingNumeric type trait.
Generic wrapper for the trunc() function.
Definition: Trunc.h:80
Header file for the IsPaddingEnabled type trait.
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatMapExpr.h:314
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:2038
Header file for auxiliary alias declarations.
ElementType_t< MT > ET
Element type of the dense matrix expression.
Definition: DMatMapExpr.h:107
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DMatMapExpr.h:292
Generic wrapper for the ceil() function.
Definition: Ceil.h:80
decltype(auto) exp10(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1701
Generic wrapper for the cbrt() function.
Definition: Cbrt.h:80
Header file for the HasLoad type trait.
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DMatMapExpr.h:206
Header file for basic type definitions.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DMatMapExpr.h:584
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias declaration for the If class template.The If_t alias declaration provides a convenien...
Definition: If.h:109
Operand dm_
Dense matrix of the map expression.
Definition: DMatMapExpr.h:591
Generic wrapper for the sin() function.
Definition: Sin.h:78
typename UnderlyingNumeric< T >::Type UnderlyingNumeric_t
Auxiliary alias declaration for the UnderlyingNumeric type trait.The UnderlyingNumeric_t alias declar...
Definition: UnderlyingNumeric.h:123
OP Operation
Data type of the custom unary operation.
Definition: DMatMapExpr.h:161
Generic wrapper for the conj() function.
Definition: Conj.h:82
Generic wrapper for the invsqrt() function.
Definition: InvSqrt.h:68
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatMapExpr.h:574
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:1392
#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
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
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatMapExpr.h:336
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:1239
Generic wrapper for the clamp() function.
Definition: Clamp.h:60
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:1243
Generic wrapper for the acosh() function.
Definition: Acosh.h:68
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
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:1581
ResultType_t< MT > RT
Result type of the dense matrix expression.
Definition: DMatMapExpr.h:105
Generic wrapper for the pow() function with fixed exponent.
Definition: Forward.h:129
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DMatMapExpr.h:261
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatMapExpr.h:325
ConstIterator & operator--()
Pre-decrement operator.
Definition: DMatMapExpr.h:250
decltype(auto) sign(const DenseMatrix< MT, SO > &dm)
Applies the sign() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1181
ValueType value_type
Type of the underlying elements.
Definition: DMatMapExpr.h:179
Header file for the Computation base class.
ElementType & ReferenceType
Reference return type.
Definition: DMatMapExpr.h:174
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
ReferenceType reference
Reference return type.
Definition: DMatMapExpr.h:181
decltype(auto) acos(const DenseMatrix< MT, SO > &dm)
Computes the inverse cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1977
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DMatMapExpr.h:149
ConstIterator & operator++()
Pre-increment operator.
Definition: DMatMapExpr.h:229
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:80
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:409
Iterator over the elements of the dense matrix map expression.
Definition: DMatMapExpr.h:167
auto load() const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatMapExpr.h:281
decltype(auto) erf(const DenseMatrix< MT, SO > &dm)
Computes the error function for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2189
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DMatMapExpr.h:394
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:82
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DMatMapExpr.h:456
Header file for the MatMapExpr base class.
Operation operation() const
Returns a copy of the custom operation.
Definition: DMatMapExpr.h:540
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DMatMapExpr.h:382
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the map expression.
Definition: DMatMapExpr.h:119
Generic wrapper for the sqrt() function.
Definition: Sqrt.h:82
ElementType ValueType
Type of the underlying elements.
Definition: DMatMapExpr.h:172
ReturnType_t< MT > RN
Return type of the dense matrix expression.
Definition: DMatMapExpr.h:108
Header file for the multiplication trait.
decltype(auto) cos(const DenseMatrix< MT, SO > &dm)
Computes the cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1945
OppositeType_t< MT > OT
Opposite type of the dense matrix expression.
Definition: DMatMapExpr.h:106
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DMatMapExpr.h:564
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:1364
Header file for the If class template.
Generic wrapper for the imag() function.
Definition: Imag.h:73
Generic wrapper for the exp10() function.
Definition: Exp10.h:66
decltype(auto) exp2(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1672
decltype(auto) sinh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1887
MapTrait_t< RT, OP > ResultType
Result type for expression template evaluations.
Definition: DMatMapExpr.h:146
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:1858
decltype(auto) cosh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2006
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DMatMapExpr.h:148
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1147
decltype(auto) cbrt(const DenseMatrix< MT, SO > &dm)
Computes the cubic root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1517
#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:68
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
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
Header file for all functors.
Header file for all SIMD functionality.
Operand operand() const noexcept
Returns the dense matrix operand.
Definition: DMatMapExpr.h:530
BLAZE_ALWAYS_INLINE auto load(size_t i, size_t j) const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatMapExpr.h:474
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DMatMapExpr.h:414
Header file for the IsAligned type trait.
Generic wrapper for the exp2() function.
Definition: Exp2.h:66
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:78
Operation op_
The custom unary operation.
Definition: DMatMapExpr.h:592
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DMatMapExpr.h:175
decltype(auto) atan(const DenseMatrix< MT, SO > &dm)
Computes the inverse tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2096
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:1916
Generic wrapper for the erf() function.
Definition: Erf.h:76
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DMatMapExpr.h:358
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DMatMapExpr.h:171
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1179
ReturnType operator()(size_t i, size_t j) const noexcept
2D-access to the matrix elements.
Definition: DMatMapExpr.h:441
Constraint on the data type.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DMatMapExpr.h:303
Header file for all forward declarations for expression class templates.
Generic wrapper for the floor() function.
Definition: Floor.h:80
decltype(auto) exp(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1643
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:1152
decltype(auto) log(const DenseMatrix< MT, SO > &dm)
Computes the natural logarithm for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1733
IteratorCategory iterator_category
The iterator category.
Definition: DMatMapExpr.h:178
ConstIterator(IteratorType it, OP op)
Constructor for the ConstIterator class.
Definition: DMatMapExpr.h:194
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.
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatMapExpr.h:347
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DMatMapExpr.h:520
decltype(auto) floor(const DenseMatrix< MT, SO > &dm)
Applies the floor() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1210
ElementType * PointerType
Pointer return type.
Definition: DMatMapExpr.h:173
decltype(auto) round(const DenseMatrix< MT, SO > &dm)
Applies the round() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1297
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:2128
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:1123
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 atanh() function.
Definition: Atanh.h:78
Generic wrapper for the invcbrt() function.
Definition: InvCbrt.h:66
Generic wrapper for the real() function.
Definition: Real.h:79
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DMatMapExpr.h:218
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
Generic wrapper for the asinh() function.
Definition: Asinh.h:78
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:1549
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: DMatMapExpr.h:489
Generic wrapper for the tan() function.
Definition: Tan.h:78
Generic wrapper for the log() function.
Definition: Log.h:68
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:2160
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
IteratorType it_
Iterator to the current matrix element.
Definition: DMatMapExpr.h:401
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:402
Generic wrapper for the erfc() function.
Definition: Erfc.h:66
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:68
#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 class template represents ...
Definition: IntegralConstant.h:101
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:147
Generic wrapper for the sign() function.
Definition: Sign.h:80
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DMatMapExpr.h:419
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
decltype(auto) sin(const DenseMatrix< MT, SO > &dm)
Computes the sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1826
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:2218
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DMatMapExpr.h:510
decltype(auto) sqrt(const DenseMatrix< MT, SO > &dm)
Computes the square root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1453
If_t< IsExpression_v< MT >, const MT, const MT &> Operand
Composite data type of the dense matrix expression.
Definition: DMatMapExpr.h:158
PointerType pointer
Pointer return type.
Definition: DMatMapExpr.h:180
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:99
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DMatMapExpr.h:370
Generic wrapper for the acos() function.
Definition: Acos.h:68
If_t< useAssign, const ResultType, const DMatMapExpr &> CompositeType
Data type for composite expression templates.
Definition: DMatMapExpr.h:155
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:2067
ConstIterator_t< MT > IteratorType
ConstIterator type of the dense matrix expression.
Definition: DMatMapExpr.h:185
Generic wrapper for the atan() function.
Definition: Atan.h:78
Generic wrapper for the round() function.
Definition: Round.h:80
Generic wrapper for the sinh() function.
Definition: Sinh.h:78
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:1797
Generic wrapper for the log2() function.
Definition: Log2.h:66
const ConstIterator operator++(int)
Post-increment operator.
Definition: DMatMapExpr.h:240
decltype(auto) imag(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the imaginary part of each single element of dm.
Definition: DMatMapExpr.h:1421
decltype(std::declval< OP >()(std::declval< RN >())) ReturnType
Return type for expression template evaluations.
Definition: DMatMapExpr.h:152
Generic wrapper for the cosh() function.
Definition: Cosh.h:68
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1326
decltype(auto) log2(const DenseMatrix< MT, SO > &dm)
Computes the binary logarithm for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1765
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:1485
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DMatMapExpr.h:271
Generic wrapper for the tanh() function.
Definition: Tanh.h:78
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: DMatMapExpr.h:500
Generic wrapper for the exp() function.
Definition: Exp.h:68
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, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the 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:428
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:1110