Blaze  3.6
SMatMapExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATMAPEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATMAPEXPR_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>
64 #include <blaze/util/Assert.h>
65 #include <blaze/util/EnableIf.h>
67 #include <blaze/util/mpl/If.h>
68 #include <blaze/util/Types.h>
73 
74 
75 namespace blaze {
76 
77 //=================================================================================================
78 //
79 // CLASS SMATMAPEXPR
80 //
81 //=================================================================================================
82 
83 //*************************************************************************************************
90 template< typename MT // Type of the sparse matrix
91  , typename OP // Type of the custom operation
92  , bool SO > // Storage order
93 class SMatMapExpr
94  : public MatMapExpr< SparseMatrix< SMatMapExpr<MT,OP,SO>, SO > >
95  , private Computation
96 {
97  private:
98  //**Type definitions****************************************************************************
99  using RT = ResultType_t<MT>;
102  //**********************************************************************************************
103 
104  //**Serial evaluation strategy******************************************************************
106 
112  static constexpr bool useAssign = RequiresEvaluation_v<MT>;
113 
115  template< typename MT2 >
117  static constexpr bool UseAssign_v = useAssign;
119  //**********************************************************************************************
120 
121  //**Parallel evaluation strategy****************************************************************
123 
129  template< typename MT2 >
130  static constexpr bool UseSMPAssign_v =
131  ( ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign );
133  //**********************************************************************************************
134 
135  public:
136  //**Type definitions****************************************************************************
143 
145  using ReturnType = decltype( std::declval<OP>()( std::declval<RN>() ) );
146 
149 
151  using Operand = If_t< IsExpression_v<MT>, const MT, const MT& >;
152 
154  using Operation = OP;
155  //**********************************************************************************************
156 
157  //**ConstIterator class definition**************************************************************
161  {
162  public:
163  //**Type definitions*************************************************************************
166 
169 
170  using IteratorCategory = std::forward_iterator_tag;
171  using ValueType = Element;
175 
176  // STL iterator requirements
182  //*******************************************************************************************
183 
184  //**Constructor******************************************************************************
190  inline ConstIterator( IteratorType it, OP op )
191  : it_( it ) // Iterator over the elements of the sparse matrix expression
192  , op_( op ) // The custom unary operation
193  {}
194  //*******************************************************************************************
195 
196  //**Prefix increment operator****************************************************************
202  ++it_;
203  return *this;
204  }
205  //*******************************************************************************************
206 
207  //**Element access operator******************************************************************
212  inline const Element operator*() const {
213  return Element( op_( it_->value() ), it_->index() );
214  }
215  //*******************************************************************************************
216 
217  //**Element access operator******************************************************************
222  inline const ConstIterator* operator->() const {
223  return this;
224  }
225  //*******************************************************************************************
226 
227  //**Value function***************************************************************************
232  inline ReturnType value() const {
233  return op_( it_->value() );
234  }
235  //*******************************************************************************************
236 
237  //**Index function***************************************************************************
242  inline size_t index() const {
243  return it_->index();
244  }
245  //*******************************************************************************************
246 
247  //**Equality operator************************************************************************
253  inline bool operator==( const ConstIterator& rhs ) const {
254  return it_ == rhs.it_;
255  }
256  //*******************************************************************************************
257 
258  //**Inequality operator**********************************************************************
264  inline bool operator!=( const ConstIterator& rhs ) const {
265  return it_ != rhs.it_;
266  }
267  //*******************************************************************************************
268 
269  //**Subtraction operator*********************************************************************
275  inline DifferenceType operator-( const ConstIterator& rhs ) const {
276  return it_ - rhs.it_;
277  }
278  //*******************************************************************************************
279 
280  private:
281  //**Member variables*************************************************************************
283  OP op_;
284  //*******************************************************************************************
285  };
286  //**********************************************************************************************
287 
288  //**Compilation flags***************************************************************************
290  static constexpr bool smpAssignable = MT::smpAssignable;
291  //**********************************************************************************************
292 
293  //**Constructor*********************************************************************************
299  explicit inline SMatMapExpr( const MT& sm, OP op ) noexcept
300  : sm_( sm ) // Sparse matrix of the map expression
301  , op_( op ) // The custom unary operation
302  {}
303  //**********************************************************************************************
304 
305  //**Access operator*****************************************************************************
312  inline ReturnType operator()( size_t i, size_t j ) const {
313  BLAZE_INTERNAL_ASSERT( i < sm_.rows() , "Invalid row access index" );
314  BLAZE_INTERNAL_ASSERT( j < sm_.columns(), "Invalid column access index" );
315  return op_( sm_(i,j) );
316  }
317  //**********************************************************************************************
318 
319  //**At function*********************************************************************************
327  inline ReturnType at( size_t i, size_t j ) const {
328  if( i >= sm_.rows() ) {
329  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
330  }
331  if( j >= sm_.columns() ) {
332  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
333  }
334  return (*this)(i,j);
335  }
336  //**********************************************************************************************
337 
338  //**Begin function******************************************************************************
344  inline ConstIterator begin( size_t i ) const {
345  return ConstIterator( sm_.begin(i), op_ );
346  }
347  //**********************************************************************************************
348 
349  //**End function********************************************************************************
355  inline ConstIterator end( size_t i ) const {
356  return ConstIterator( sm_.end(i), op_ );
357  }
358  //**********************************************************************************************
359 
360  //**Rows function*******************************************************************************
365  inline size_t rows() const noexcept {
366  return sm_.rows();
367  }
368  //**********************************************************************************************
369 
370  //**Columns function****************************************************************************
375  inline size_t columns() const noexcept {
376  return sm_.columns();
377  }
378  //**********************************************************************************************
379 
380  //**NonZeros function***************************************************************************
385  inline size_t nonZeros() const {
386  return sm_.nonZeros();
387  }
388  //**********************************************************************************************
389 
390  //**NonZeros function***************************************************************************
396  inline size_t nonZeros( size_t i ) const {
397  return sm_.nonZeros(i);
398  }
399  //**********************************************************************************************
400 
401  //**Find function*******************************************************************************
408  inline ConstIterator find( size_t i, size_t j ) const {
410  return ConstIterator( sm_.find( i, j ), op_ );
411  }
412  //**********************************************************************************************
413 
414  //**LowerBound function*************************************************************************
421  inline ConstIterator lowerBound( size_t i, size_t j ) const {
423  return ConstIterator( sm_.lowerBound( i, j ), op_ );
424  }
425  //**********************************************************************************************
426 
427  //**UpperBound function*************************************************************************
434  inline ConstIterator upperBound( size_t i, size_t j ) const {
436  return ConstIterator( sm_.upperBound( i, j ), op_ );
437  }
438  //**********************************************************************************************
439 
440  //**Operand access******************************************************************************
445  inline Operand operand() const noexcept {
446  return sm_;
447  }
448  //**********************************************************************************************
449 
450  //**Operation access****************************************************************************
455  inline Operation operation() const {
456  return op_;
457  }
458  //**********************************************************************************************
459 
460  //**********************************************************************************************
466  template< typename T >
467  inline bool canAlias( const T* alias ) const noexcept {
468  return sm_.canAlias( alias );
469  }
470  //**********************************************************************************************
471 
472  //**********************************************************************************************
478  template< typename T >
479  inline bool isAliased( const T* alias ) const noexcept {
480  return sm_.isAliased( alias );
481  }
482  //**********************************************************************************************
483 
484  //**********************************************************************************************
489  inline bool canSMPAssign() const noexcept {
490  return sm_.canSMPAssign();
491  }
492  //**********************************************************************************************
493 
494  private:
495  //**Member variables****************************************************************************
498  //**********************************************************************************************
499 
500  //**Assignment to dense matrices****************************************************************
514  template< typename MT2 // Type of the target dense matrix
515  , bool SO2 > // Storage order of the target dense matrix
516  friend inline auto assign( DenseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
518  {
520 
524 
525  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
526  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
527 
528  const RT tmp( serial( rhs.sm_ ) );
529  assign( ~lhs, map( tmp, rhs.op_ ) );
530  }
532  //**********************************************************************************************
533 
534  //**Assignment to row-major sparse matrices*****************************************************
549  template< typename MT2 > // Type of the target sparse matrix
550  friend inline auto assign( SparseMatrix<MT2,false>& lhs, const SMatMapExpr& rhs )
552  IsSame_v< UnderlyingNumeric_t<MT>, UnderlyingNumeric_t<MT2> > >
553  {
555 
556  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
557  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
558 
559  assign( ~lhs, rhs.sm_ );
560 
561  const size_t m( rhs.rows() );
562 
563  for( size_t i=0UL; i<m; ++i ) {
564  const auto end( (~lhs).end(i) );
565  for( auto element=(~lhs).begin(i); element!=end; ++element ) {
566  element->value() = rhs.op_( element->value() );
567  }
568  }
569  }
571  //**********************************************************************************************
572 
573  //**Assignment to column-major sparse matrices**************************************************
588  template< typename MT2 > // Type of the target sparse matrix
589  friend inline auto assign( SparseMatrix<MT2,true>& lhs, const SMatMapExpr& rhs )
590  -> EnableIf_t< UseAssign_v<MT2> &&
591  IsSame_v< UnderlyingNumeric_t<MT>, UnderlyingNumeric_t<MT2> > >
592  {
594 
595  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
596  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
597 
598  assign( ~lhs, rhs.sm_ );
599 
600  const size_t n( rhs.columns() );
601 
602  for( size_t j=0UL; j<n; ++j ) {
603  const auto end( (~lhs).end(j) );
604  for( auto element=(~lhs).begin(j); element!=end; ++element ) {
605  element->value() = rhs.op_( element->value() );
606  }
607  }
608  }
610  //**********************************************************************************************
611 
612  //**Assignment to sparse matrices***************************************************************
627  template< typename MT2 // Type of the target sparse matrix
628  , bool SO2 > // Storage order of the target sparse matrix
629  friend inline auto assign( SparseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
630  -> EnableIf_t< UseAssign_v<MT2> &&
631  !IsSame_v< UnderlyingNumeric_t<MT>, UnderlyingNumeric_t<MT2> > >
632  {
634 
638 
639  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
640  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
641 
642  const RT tmp( serial( rhs.sm_ ) );
643  (~lhs).reserve( tmp.nonZeros() );
644  assign( ~lhs, map( tmp, rhs.op_ ) );
645  }
647  //**********************************************************************************************
648 
649  //**Addition assignment to dense matrices*******************************************************
663  template< typename MT2 // Type of the target dense matrix
664  , bool SO2 > // Storage order of the target dense matrix
665  friend inline auto addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
666  -> EnableIf_t< UseAssign_v<MT2> >
667  {
669 
673 
674  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
675  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
676 
677  const RT tmp( serial( rhs.sm_ ) );
678  addAssign( ~lhs, map( tmp, rhs.op_ ) );
679  }
681  //**********************************************************************************************
682 
683  //**Addition assignment to sparse matrices******************************************************
684  // No special implementation for the addition assignment to sparse matrices.
685  //**********************************************************************************************
686 
687  //**Subtraction assignment to dense matrices****************************************************
701  template< typename MT2 // Type of the target dense matrix
702  , bool SO2 > // Storage order of the target sparse matrix
703  friend inline auto subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
704  -> EnableIf_t< UseAssign_v<MT2> >
705  {
707 
711 
712  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
713  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
714 
715  const RT tmp( serial( rhs.sm_ ) );
716  subAssign( ~lhs, map( tmp, rhs.op_ ) );
717  }
719  //**********************************************************************************************
720 
721  //**Subtraction assignment to sparse matrices***************************************************
722  // No special implementation for the subtraction assignment to sparse matrices.
723  //**********************************************************************************************
724 
725  //**Schur product assignment to dense matrices**************************************************
739  template< typename MT2 // Type of the target dense matrix
740  , bool SO2 > // Storage order of the target dense matrix
741  friend inline auto schurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
742  -> EnableIf_t< UseAssign_v<MT2> >
743  {
745 
749 
750  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
751  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
752 
753  const RT tmp( serial( rhs.sm_ ) );
754  schurAssign( ~lhs, map( tmp, rhs.op_ ) );
755  }
757  //**********************************************************************************************
758 
759  //**Schur product assignment to sparse matrices*************************************************
760  // No special implementation for the Schur product assignment to sparse matrices.
761  //**********************************************************************************************
762 
763  //**Multiplication assignment to dense matrices*************************************************
764  // No special implementation for the multiplication assignment to dense matrices.
765  //**********************************************************************************************
766 
767  //**Multiplication assignment to sparse matrices************************************************
768  // No special implementation for the multiplication assignment to sparse matrices.
769  //**********************************************************************************************
770 
771  //**SMP assignment to dense matrices************************************************************
785  template< typename MT2 // Type of the target dense matrix
786  , bool SO2 > // Storage order of the target dense matrix
787  friend inline auto smpAssign( DenseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
788  -> EnableIf_t< UseSMPAssign_v<MT2> >
789  {
791 
795 
796  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
797  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
798 
799  const RT tmp( rhs.sm_ );
800  smpAssign( ~lhs, map( tmp, rhs.op_ ) );
801  }
803  //**********************************************************************************************
804 
805  //**SMP assignment to sparse matrices***********************************************************
806  // No special implementation for the SMP assignment to sparse matrices.
807  //**********************************************************************************************
808 
809  //**SMP addition assignment to dense matrices***************************************************
823  template< typename MT2 // Type of the target dense matrix
824  , bool SO2 > // Storage order of the target dense matrix
825  friend inline auto smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
826  -> EnableIf_t< UseSMPAssign_v<MT2> >
827  {
829 
833 
834  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
835  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
836 
837  const RT tmp( rhs.sm_ );
838  smpAddAssign( ~lhs, map( tmp, rhs.op_ ) );
839  }
841  //**********************************************************************************************
842 
843  //**SMP addition assignment to sparse matrices**************************************************
844  // No special implementation for the SMP addition assignment to sparse matrices.
845  //**********************************************************************************************
846 
847  //**SMP subtraction assignment to dense matrices************************************************
861  template< typename MT2 // Type of the target dense matrix
862  , bool SO2 > // Storage order of the target sparse matrix
863  friend inline auto smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
864  -> EnableIf_t< UseSMPAssign_v<MT2> >
865  {
867 
871 
872  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
873  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
874 
875  const RT tmp( rhs.sm_ );
876  smpSubAssign( ~lhs, map( tmp, rhs.op_ ) );
877  }
879  //**********************************************************************************************
880 
881  //**SMP subtraction assignment to sparse matrices***********************************************
882  // No special implementation for the SMP subtraction assignment to sparse matrices.
883  //**********************************************************************************************
884 
885  //**SMP Schur product assignment to dense matrices**********************************************
899  template< typename MT2 // Type of the target dense matrix
900  , bool SO2 > // Storage order of the target dense matrix
901  friend inline auto smpSchurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
902  -> EnableIf_t< UseSMPAssign_v<MT2> >
903  {
905 
909 
910  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
911  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
912 
913  const RT tmp( rhs.sm_ );
914  smpSchurAssign( ~lhs, map( tmp, rhs.op_ ) );
915  }
917  //**********************************************************************************************
918 
919  //**SMP Schur product assignment to sparse matrices*********************************************
920  // No special implementation for the SMP Schur product assignment to sparse matrices.
921  //**********************************************************************************************
922 
923  //**SMP multiplication assignment to dense matrices*********************************************
924  // No special implementation for the SMP multiplication assignment to dense matrices.
925  //**********************************************************************************************
926 
927  //**SMP multiplication assignment to sparse matrices********************************************
928  // No special implementation for the SMP multiplication assignment to sparse matrices.
929  //**********************************************************************************************
930 
931  //**Compile time checks*************************************************************************
936  //**********************************************************************************************
937 };
938 //*************************************************************************************************
939 
940 
941 
942 
943 //=================================================================================================
944 //
945 // GLOBAL FUNCTIONS
946 //
947 //=================================================================================================
948 
949 //*************************************************************************************************
967 template< typename MT // Type of the sparse matrix
968  , bool SO // Storage order
969  , typename OP > // Type of the custom operation
970 inline decltype(auto) map( const SparseMatrix<MT,SO>& sm, OP op )
971 {
973 
974  using ReturnType = const SMatMapExpr<MT,OP,SO>;
975  return ReturnType( ~sm, op );
976 }
977 //*************************************************************************************************
978 
979 
980 //*************************************************************************************************
998 template< typename MT // Type of the sparse matrix
999  , bool SO // Storage order
1000  , typename OP > // Type of the custom operation
1001 inline decltype(auto) forEach( const SparseMatrix<MT,SO>& sm, OP op )
1002 {
1004 
1005  return map( ~sm, op );
1006 }
1007 //*************************************************************************************************
1008 
1009 
1010 //*************************************************************************************************
1027 template< typename MT // Type of the sparse matrix
1028  , bool SO > // Storage order
1029 inline decltype(auto) abs( const SparseMatrix<MT,SO>& sm )
1030 {
1032 
1033  return map( ~sm, Abs() );
1034 }
1035 //*************************************************************************************************
1036 
1037 
1038 //*************************************************************************************************
1055 template< typename MT // Type of the sparse matrix
1056  , bool SO > // Storage order
1057 inline decltype(auto) sign( const SparseMatrix<MT,SO>& sm )
1058 {
1060 
1061  return map( ~sm, Sign() );
1062 }
1063 //*************************************************************************************************
1064 
1065 
1066 //*************************************************************************************************
1083 template< typename MT // Type of the sparse matrix
1084  , bool SO > // Storage order
1085 inline decltype(auto) floor( const SparseMatrix<MT,SO>& sm )
1086 {
1088 
1089  return map( ~sm, Floor() );
1090 }
1091 //*************************************************************************************************
1092 
1093 
1094 //*************************************************************************************************
1111 template< typename MT // Type of the sparse matrix
1112  , bool SO > // Storage order
1113 inline decltype(auto) ceil( const SparseMatrix<MT,SO>& sm )
1114 {
1116 
1117  return map( ~sm, Ceil() );
1118 }
1119 //*************************************************************************************************
1120 
1121 
1122 //*************************************************************************************************
1139 template< typename MT // Type of the sparse matrix
1140  , bool SO > // Storage order
1141 inline decltype(auto) trunc( const SparseMatrix<MT,SO>& sm )
1142 {
1144 
1145  return map( ~sm, Trunc() );
1146 }
1147 //*************************************************************************************************
1148 
1149 
1150 //*************************************************************************************************
1167 template< typename MT // Type of the sparse matrix
1168  , bool SO > // Storage order
1169 inline decltype(auto) round( const SparseMatrix<MT,SO>& sm )
1170 {
1172 
1173  return map( ~sm, Round() );
1174 }
1175 //*************************************************************************************************
1176 
1177 
1178 //*************************************************************************************************
1195 template< typename MT // Type of the sparse matrix
1196  , bool SO > // Storage order
1197 inline decltype(auto) conj( const SparseMatrix<MT,SO>& sm )
1198 {
1200 
1201  return map( ~sm, Conj() );
1202 }
1203 //*************************************************************************************************
1204 
1205 
1206 //*************************************************************************************************
1232 template< typename MT // Type of the sparse matrix
1233  , bool SO > // Storage order
1234 inline decltype(auto) ctrans( const SparseMatrix<MT,SO>& sm )
1235 {
1237 
1238  return trans( conj( ~sm ) );
1239 }
1240 //*************************************************************************************************
1241 
1242 
1243 //*************************************************************************************************
1260 template< typename MT // Type of the sparse matrix
1261  , bool SO > // Storage order
1262 inline decltype(auto) real( const SparseMatrix<MT,SO>& sm )
1263 {
1265 
1266  return map( ~sm, Real() );
1267 }
1268 //*************************************************************************************************
1269 
1270 
1271 //*************************************************************************************************
1288 template< typename MT // Type of the sparse matrix
1289  , bool SO > // Storage order
1290 inline decltype(auto) imag( const SparseMatrix<MT,SO>& sm )
1291 {
1293 
1294  return map( ~sm, Imag() );
1295 }
1296 //*************************************************************************************************
1297 
1298 
1299 //*************************************************************************************************
1319 template< typename MT // Type of the sparse matrix
1320  , bool SO > // Storage order
1321 inline decltype(auto) sqrt( const SparseMatrix<MT,SO>& sm )
1322 {
1324 
1325  return map( ~sm, Sqrt() );
1326 }
1327 //*************************************************************************************************
1328 
1329 
1330 //*************************************************************************************************
1350 template< typename MT // Type of the sparse matrix
1351  , bool SO > // Storage order
1352 inline decltype(auto) invsqrt( const SparseMatrix<MT,SO>& sm )
1353 {
1355 
1356  return map( ~sm, InvSqrt() );
1357 }
1358 //*************************************************************************************************
1359 
1360 
1361 //*************************************************************************************************
1381 template< typename MT // Type of the sparse matrix
1382  , bool SO > // Storage order
1383 inline decltype(auto) cbrt( const SparseMatrix<MT,SO>& sm )
1384 {
1386 
1387  return map( ~sm, Cbrt() );
1388 }
1389 //*************************************************************************************************
1390 
1391 
1392 //*************************************************************************************************
1412 template< typename MT // Type of the sparse matrix
1413  , bool SO > // Storage order
1414 inline decltype(auto) invcbrt( const SparseMatrix<MT,SO>& sm )
1415 {
1417 
1418  return map( ~sm, InvCbrt() );
1419 }
1420 //*************************************************************************************************
1421 
1422 
1423 //*************************************************************************************************
1442 template< typename MT // Type of the sparse matrix
1443  , bool SO // Storage order
1444  , typename DT > // Type of the delimiters
1445 inline decltype(auto) clamp( const SparseMatrix<MT,SO>& sm, const DT& min, const DT& max )
1446 {
1448 
1449  return map( ~sm, Clamp<DT>( min, max ) );
1450 }
1451 //*************************************************************************************************
1452 
1453 
1454 //*************************************************************************************************
1472 template< typename MT // Type of the sparse matrix
1473  , bool SO // Storage order
1474  , typename ST // Type of the scalar exponent
1475  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
1476 inline decltype(auto) pow( const SparseMatrix<MT,SO>& sm, ST exp )
1477 {
1479 
1480  using ScalarType = MultTrait_t< UnderlyingBuiltin_t<MT>, ST >;
1481  return map( ~sm, blaze::bind2nd( Pow(), ScalarType( exp ) ) );
1482 }
1483 //*************************************************************************************************
1484 
1485 
1486 //*************************************************************************************************
1503 template< typename MT // Type of the sparse matrix
1504  , bool SO > // Storage order
1505 inline decltype(auto) exp( const SparseMatrix<MT,SO>& sm )
1506 {
1508 
1509  return map( ~sm, Exp() );
1510 }
1511 //*************************************************************************************************
1512 
1513 
1514 //*************************************************************************************************
1531 template< typename MT // Type of the sparse matrix
1532  , bool SO > // Storage order
1533 inline decltype(auto) exp2( const SparseMatrix<MT,SO>& sm )
1534 {
1536 
1537  return map( ~sm, Exp2() );
1538 }
1539 //*************************************************************************************************
1540 
1541 
1542 //*************************************************************************************************
1559 template< typename MT // Type of the sparse matrix
1560  , bool SO > // Storage order
1561 inline decltype(auto) exp10( const SparseMatrix<MT,SO>& sm )
1562 {
1564 
1565  return map( ~sm, Exp10() );
1566 }
1567 //*************************************************************************************************
1568 
1569 
1570 //*************************************************************************************************
1590 template< typename MT // Type of the sparse matrix
1591  , bool SO > // Storage order
1592 inline decltype(auto) log( const SparseMatrix<MT,SO>& sm )
1593 {
1595 
1596  return map( ~sm, Log() );
1597 }
1598 //*************************************************************************************************
1599 
1600 
1601 //*************************************************************************************************
1621 template< typename MT // Type of the sparse matrix
1622  , bool SO > // Storage order
1623 inline decltype(auto) log2( const SparseMatrix<MT,SO>& sm )
1624 {
1626 
1627  return map( ~sm, Log2() );
1628 }
1629 //*************************************************************************************************
1630 
1631 
1632 //*************************************************************************************************
1652 template< typename MT // Type of the sparse matrix
1653  , bool SO > // Storage order
1654 inline decltype(auto) log10( const SparseMatrix<MT,SO>& sm )
1655 {
1657 
1658  return map( ~sm, Log10() );
1659 }
1660 //*************************************************************************************************
1661 
1662 
1663 //*************************************************************************************************
1680 template< typename MT // Type of the sparse matrix
1681  , bool SO > // Storage order
1682 inline decltype(auto) sin( const SparseMatrix<MT,SO>& sm )
1683 {
1685 
1686  return map( ~sm, Sin() );
1687 }
1688 //*************************************************************************************************
1689 
1690 
1691 //*************************************************************************************************
1711 template< typename MT // Type of the sparse matrix
1712  , bool SO > // Storage order
1713 inline decltype(auto) asin( const SparseMatrix<MT,SO>& sm )
1714 {
1716 
1717  return map( ~sm, Asin() );
1718 }
1719 //*************************************************************************************************
1720 
1721 
1722 //*************************************************************************************************
1739 template< typename MT // Type of the sparse matrix
1740  , bool SO > // Storage order
1741 inline decltype(auto) sinh( const SparseMatrix<MT,SO>& sm )
1742 {
1744 
1745  return map( ~sm, Sinh() );
1746 }
1747 //*************************************************************************************************
1748 
1749 
1750 //*************************************************************************************************
1767 template< typename MT // Type of the sparse matrix
1768  , bool SO > // Storage order
1769 inline decltype(auto) asinh( const SparseMatrix<MT,SO>& sm )
1770 {
1772 
1773  return map( ~sm, Asinh() );
1774 }
1775 //*************************************************************************************************
1776 
1777 
1778 //*************************************************************************************************
1795 template< typename MT // Type of the sparse matrix
1796  , bool SO > // Storage order
1797 inline decltype(auto) cos( const SparseMatrix<MT,SO>& sm )
1798 {
1800 
1801  return map( ~sm, Cos() );
1802 }
1803 //*************************************************************************************************
1804 
1805 
1806 //*************************************************************************************************
1826 template< typename MT // Type of the sparse matrix
1827  , bool SO > // Storage order
1828 inline decltype(auto) acos( const SparseMatrix<MT,SO>& sm )
1829 {
1831 
1832  return map( ~sm, Acos() );
1833 }
1834 //*************************************************************************************************
1835 
1836 
1837 //*************************************************************************************************
1854 template< typename MT // Type of the sparse matrix
1855  , bool SO > // Storage order
1856 inline decltype(auto) cosh( const SparseMatrix<MT,SO>& sm )
1857 {
1859 
1860  return map( ~sm, Cosh() );
1861 }
1862 //*************************************************************************************************
1863 
1864 
1865 //*************************************************************************************************
1885 template< typename MT // Type of the sparse matrix
1886  , bool SO > // Storage order
1887 inline decltype(auto) acosh( const SparseMatrix<MT,SO>& sm )
1888 {
1890 
1891  return map( ~sm, Acosh() );
1892 }
1893 //*************************************************************************************************
1894 
1895 
1896 //*************************************************************************************************
1913 template< typename MT // Type of the sparse matrix
1914  , bool SO > // Storage order
1915 inline decltype(auto) tan( const SparseMatrix<MT,SO>& sm )
1916 {
1918 
1919  return map( ~sm, Tan() );
1920 }
1921 //*************************************************************************************************
1922 
1923 
1924 //*************************************************************************************************
1941 template< typename MT // Type of the sparse matrix
1942  , bool SO > // Storage order
1943 inline decltype(auto) atan( const SparseMatrix<MT,SO>& sm )
1944 {
1946 
1947  return map( ~sm, Atan() );
1948 }
1949 //*************************************************************************************************
1950 
1951 
1952 //*************************************************************************************************
1972 template< typename MT // Type of the sparse matrix
1973  , bool SO > // Storage order
1974 inline decltype(auto) tanh( const SparseMatrix<MT,SO>& sm )
1975 {
1977 
1978  return map( ~sm, Tanh() );
1979 }
1980 //*************************************************************************************************
1981 
1982 
1983 //*************************************************************************************************
2003 template< typename MT // Type of the sparse matrix
2004  , bool SO > // Storage order
2005 inline decltype(auto) atanh( const SparseMatrix<MT,SO>& sm )
2006 {
2008 
2009  return map( ~sm, Atanh() );
2010 }
2011 //*************************************************************************************************
2012 
2013 
2014 //*************************************************************************************************
2031 template< typename MT // Type of the sparse matrix
2032  , bool SO > // Storage order
2033 inline decltype(auto) erf( const SparseMatrix<MT,SO>& sm )
2034 {
2036 
2037  return map( ~sm, Erf() );
2038 }
2039 //*************************************************************************************************
2040 
2041 
2042 //*************************************************************************************************
2060 template< typename MT // Type of the sparse matrix
2061  , bool SO > // Storage order
2062 inline decltype(auto) erfc( const SparseMatrix<MT,SO>& sm )
2063 {
2065 
2066  return map( ~sm, Erfc() );
2067 }
2068 //*************************************************************************************************
2069 
2070 
2071 
2072 
2073 //=================================================================================================
2074 //
2075 // GLOBAL RESTRUCTURING FUNCTIONS
2076 //
2077 //=================================================================================================
2078 
2079 //*************************************************************************************************
2090 template< typename MT // Type of the sparse matrix
2091  , bool SO > // Storage order
2092 inline decltype(auto) abs( const SMatMapExpr<MT,Abs,SO>& sm )
2093 {
2095 
2096  return sm;
2097 }
2099 //*************************************************************************************************
2100 
2101 
2102 //*************************************************************************************************
2113 template< typename MT // Type of the sparse matrix
2114  , bool SO > // Storage order
2115 inline decltype(auto) sign( const SMatMapExpr<MT,Sign,SO>& sm )
2116 {
2118 
2119  return sm;
2120 }
2122 //*************************************************************************************************
2123 
2124 
2125 //*************************************************************************************************
2136 template< typename MT // Type of the sparse matrix
2137  , bool SO > // Storage order
2138 inline decltype(auto) floor( const SMatMapExpr<MT,Floor,SO>& sm )
2139 {
2141 
2142  return sm;
2143 }
2145 //*************************************************************************************************
2146 
2147 
2148 //*************************************************************************************************
2159 template< typename MT // Type of the sparse matrix
2160  , bool SO > // Storage order
2161 inline decltype(auto) ceil( const SMatMapExpr<MT,Ceil,SO>& sm )
2162 {
2164 
2165  return sm;
2166 }
2168 //*************************************************************************************************
2169 
2170 
2171 //*************************************************************************************************
2182 template< typename MT // Type of the sparse matrix
2183  , bool SO > // Storage order
2184 inline decltype(auto) trunc( const SMatMapExpr<MT,Trunc,SO>& sm )
2185 {
2187 
2188  return sm;
2189 }
2191 //*************************************************************************************************
2192 
2193 
2194 //*************************************************************************************************
2205 template< typename MT // Type of the sparse matrix
2206  , bool SO > // Storage order
2207 inline decltype(auto) round( const SMatMapExpr<MT,Round,SO>& sm )
2208 {
2210 
2211  return sm;
2212 }
2214 //*************************************************************************************************
2215 
2216 
2217 //*************************************************************************************************
2235 template< typename MT // Type of the sparse matrix
2236  , bool TF > // Transpose flag
2237 inline decltype(auto) conj( const SMatMapExpr<MT,Conj,TF>& sm )
2238 {
2240 
2241  return sm.operand();
2242 }
2244 //*************************************************************************************************
2245 
2246 
2247 //*************************************************************************************************
2265 template< typename MT // Type of the sparse matrix
2266  , bool SO > // Storage order
2267 inline decltype(auto) conj( const SMatTransExpr<SMatMapExpr<MT,Conj,SO>,!SO>& sm )
2268 {
2270 
2271  return trans( sm.operand().operand() );
2272 }
2274 //*************************************************************************************************
2275 
2276 
2277 //*************************************************************************************************
2288 template< typename MT // Type of the sparse matrix
2289  , bool SO > // Storage order
2290 inline decltype(auto) real( const SMatMapExpr<MT,Real,SO>& sm )
2291 {
2293 
2294  return sm;
2295 }
2297 //*************************************************************************************************
2298 
2299 
2300 //*************************************************************************************************
2311 template< typename MT // Type of the sparse matrix
2312  , bool SO > // Storage order
2313 inline decltype(auto) imag( const SMatMapExpr<MT,Imag,SO>& sm )
2314 {
2316 
2317  return sm;
2318 }
2320 //*************************************************************************************************
2321 
2322 } // namespace blaze
2323 
2324 #endif
Header file for the UnderlyingNumeric type trait.
Generic wrapper for the trunc() function.
Definition: Trunc.h:81
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
ValueType * PointerType
Pointer return type.
Definition: SMatMapExpr.h:172
Header file for auxiliary alias declarations.
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
MapTrait_t< RT, OP > ResultType
Result type for expression template evaluations.
Definition: SMatMapExpr.h:139
Generic wrapper for the cbrt() function.
Definition: Cbrt.h:81
Header file for basic type definitions.
Operation operation() const
Returns a copy of the custom operation.
Definition: SMatMapExpr.h:455
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
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SMatMapExpr.h:408
Generic wrapper for the sin() function.
Definition: Sin.h:79
ReturnType_t< MT > RN
Return type of the sparse matrix expression.
Definition: SMatMapExpr.h:101
Generic wrapper for the conj() function.
Definition: Conj.h:83
Generic wrapper for the invsqrt() function.
Definition: InvSqrt.h:69
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
typename MapTrait< Args... >::Type MapTrait_t
Auxiliary alias declaration for the MapTrait class template.The MapTrait_t alias declaration provides...
Definition: MapTrait.h:160
ReturnType value() const
Access to the current value of the sparse element.
Definition: SMatMapExpr.h:232
IteratorType it_
Iterator over the elements of the sparse matrix expression.
Definition: SMatMapExpr.h:282
ConstIterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition: SMatMapExpr.h:421
Header file for the IsSame and IsStrictlySame type traits.
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatMapExpr.h:479
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
Iterator over the elements of the sparse matrix map expression.
Definition: SMatMapExpr.h:160
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
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the map expression.
Definition: SMatMapExpr.h:112
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SMatMapExpr.h:264
ResultType_t< MT > RT
Result type of the sparse matrix expression.
Definition: SMatMapExpr.h:99
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: SMatMapExpr.h:344
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SMatMapExpr.h:275
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: SMatMapExpr.h:355
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
Header file for the Computation base class.
size_t index() const
Access to the current index of the sparse element.
Definition: SMatMapExpr.h:242
decltype(std::declval< OP >()(std::declval< RN >())) ReturnType
Return type for expression template evaluations.
Definition: SMatMapExpr.h:145
Header file for the RequiresEvaluation type trait.
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatMapExpr.h:365
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
Operand operand() const noexcept
Returns the sparse matrix operand.
Definition: SMatMapExpr.h:445
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: SMatMapExpr.h:142
Expression object for the sparse matrix map() function.The SMatMapExpr class represents the compile t...
Definition: Forward.h:126
Operand sm_
Sparse matrix of the map expression.
Definition: SMatMapExpr.h:496
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes....
Definition: DenseMatrix.h:81
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes....
Definition: Forward.h:145
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
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
ValueIndexPair< ElementType > Element
Element type of the sparse matrix expression.
Definition: SMatMapExpr.h:165
Header file for the SparseMatrix base class.
Constraint on the data type.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SMatMapExpr.h:174
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
OP op_
The custom unary operation.
Definition: SMatMapExpr.h:283
Header file for the MatMapExpr base class.
Generic wrapper for the sqrt() function.
Definition: Sqrt.h:83
Header file for the ValueIndexPair class.
const Element operator *() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatMapExpr.h:212
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
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
decltype(auto) ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatMapExpr.h:1361
If_t< IsExpression_v< MT >, const MT, const MT & > Operand
Composite data type of the sparse matrix expression.
Definition: SMatMapExpr.h:151
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
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
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
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SMatMapExpr.h:253
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
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.
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
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SMatMapExpr.h:290
Generic wrapper for the exp2() function.
Definition: Exp2.h:67
Generic wrapper for the asin() function.
Definition: Asin.h:79
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
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SMatMapExpr.h:170
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
Generic wrapper for the erf() function.
Definition: Erf.h:77
ConstIterator(IteratorType it, OP op)
Constructor for the ConstIterator class.
Definition: SMatMapExpr.h:190
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatMapExpr.h:312
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
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatMapExpr.h:140
Constraint on the data type.
Generic wrapper for the floor() function.
Definition: Floor.h:81
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.
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
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
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.
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
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatMapExpr.h:141
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
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SMatMapExpr.h:434
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
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
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: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
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatMapExpr.h:375
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
#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.
ConstIterator_t< RemoveReference_t< Operand > > IteratorType
Iterator type of the sparse matrix expression.
Definition: SMatMapExpr.h:168
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
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
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
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatMapExpr.h:396
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatMapExpr.h:467
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
Header file for the RemoveReference type trait.
Generic wrapper for the sign() function.
Definition: Sign.h:81
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatMapExpr.h:489
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
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatMapExpr.h:327
decltype(auto) sin(const DenseMatrix< MT, SO > &dm)
Computes the sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1809
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatMapExpr.h:385
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
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:73
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
SMatMapExpr(const MT &sm, OP op) noexcept
Constructor for the SMatMapExpr class.
Definition: SMatMapExpr.h:299
Header file for the IsComputation type trait class.
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
Generic wrapper for the acos() function.
Definition: Acos.h:69
decltype(auto) tan(const DenseMatrix< MT, SO > &dm)
Computes the tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2042
OppositeType_t< MT > OT
Opposite type of the sparse matrix expression.
Definition: SMatMapExpr.h:100
If_t< useAssign, const ResultType, const SMatMapExpr & > CompositeType
Data type for composite expression templates.
Definition: SMatMapExpr.h:148
ValueType & ReferenceType
Reference return type.
Definition: SMatMapExpr.h:173
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
OP Operation
Data type of the custom unary operation.
Definition: SMatMapExpr.h:154
Header file for the map trait.
IteratorCategory iterator_category
The iterator category.
Definition: SMatMapExpr.h:177
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
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
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
Generic wrapper for the exp() function.
Definition: Exp.h:69
#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
ConstIterator & operator++()
Pre-increment operator.
Definition: SMatMapExpr.h:201
Element ValueType
Type of the underlying pointers.
Definition: SMatMapExpr.h:171
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type,...
Definition: SparseMatrix.h:61
Header file for the IsExpression type trait class.
Header file for the function trace functionality.
Operation op_
The custom unary operation.
Definition: SMatMapExpr.h:497
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
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatMapExpr.h:222