Blaze  3.6
SVecMapExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SVECMAPEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SVECMAPEXPR_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>
72 
73 
74 namespace blaze {
75 
76 //=================================================================================================
77 //
78 // CLASS SVECMAPEXPR
79 //
80 //=================================================================================================
81 
82 //*************************************************************************************************
89 template< typename VT // Type of the sparse vector
90  , typename OP // Type of the custom operation
91  , bool TF > // Transpose flag
92 class SVecMapExpr
93  : public VecMapExpr< SparseVector< SVecMapExpr<VT,OP,TF>, TF > >
94  , private Computation
95 {
96  private:
97  //**Type definitions****************************************************************************
98  using RT = ResultType_t<VT>;
99  using RN = ReturnType_t<VT>;
100  //**********************************************************************************************
101 
102  //**Serial evaluation strategy******************************************************************
104 
110  static constexpr bool useAssign = RequiresEvaluation_v<VT>;
111 
113  template< typename VT2 >
115  static constexpr bool UseAssign_v = useAssign;
117  //**********************************************************************************************
118 
119  //**Parallel evaluation strategy****************************************************************
121 
127  template< typename VT2 >
128  static constexpr bool UseSMPAssign_v =
129  ( ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign );
131  //**********************************************************************************************
132 
133  public:
134  //**Type definitions****************************************************************************
140 
142  using ReturnType = decltype( std::declval<OP>()( std::declval<RN>() ) );
143 
146 
148  using Operand = If_t< IsExpression_v<VT>, const VT, const VT& >;
149 
151  using Operation = OP;
152  //**********************************************************************************************
153 
154  //**ConstIterator class definition**************************************************************
158  {
159  public:
160  //**Type definitions*************************************************************************
163 
166 
167  using IteratorCategory = std::forward_iterator_tag;
168  using ValueType = Element;
172 
173  // STL iterator requirements
179  //*******************************************************************************************
180 
181  //**Constructor******************************************************************************
187  inline ConstIterator( IteratorType it, OP op )
188  : it_( it ) // Iterator over the elements of the sparse vector expression
189  , op_( op ) // The custom unary operation
190  {}
191  //*******************************************************************************************
192 
193  //**Prefix increment operator****************************************************************
199  ++it_;
200  return *this;
201  }
202  //*******************************************************************************************
203 
204  //**Element access operator******************************************************************
209  inline const Element operator*() const {
210  return Element( op_( it_->value() ), it_->index() );
211  }
212  //*******************************************************************************************
213 
214  //**Element access operator******************************************************************
219  inline const ConstIterator* operator->() const {
220  return this;
221  }
222  //*******************************************************************************************
223 
224  //**Value function***************************************************************************
229  inline ReturnType value() const {
230  return op_( it_->value() );
231  }
232  //*******************************************************************************************
233 
234  //**Index function***************************************************************************
239  inline size_t index() const {
240  return it_->index();
241  }
242  //*******************************************************************************************
243 
244  //**Equality operator************************************************************************
250  inline bool operator==( const ConstIterator& rhs ) const {
251  return it_ == rhs.it_;
252  }
253  //*******************************************************************************************
254 
255  //**Inequality operator**********************************************************************
261  inline bool operator!=( const ConstIterator& rhs ) const {
262  return it_ != rhs.it_;
263  }
264  //*******************************************************************************************
265 
266  //**Subtraction operator*********************************************************************
272  inline DifferenceType operator-( const ConstIterator& rhs ) const {
273  return it_ - rhs.it_;
274  }
275  //*******************************************************************************************
276 
277  private:
278  //**Member variables*************************************************************************
280  OP op_;
281  //*******************************************************************************************
282  };
283  //**********************************************************************************************
284 
285  //**Compilation flags***************************************************************************
287  static constexpr bool smpAssignable = VT::smpAssignable;
288  //**********************************************************************************************
289 
290  //**Constructor*********************************************************************************
296  explicit inline SVecMapExpr( const VT& sv, OP op ) noexcept
297  : sv_( sv ) // Sparse vector of the map expression
298  , op_( op ) // The custom unary operation
299  {}
300  //**********************************************************************************************
301 
302  //**Subscript operator**************************************************************************
308  inline ReturnType operator[]( size_t index ) const {
309  BLAZE_INTERNAL_ASSERT( index < sv_.size(), "Invalid vector access index" );
310  return op_( sv_[index] );
311  }
312  //**********************************************************************************************
313 
314  //**At function*********************************************************************************
321  inline ReturnType at( size_t index ) const {
322  if( index >= sv_.size() ) {
323  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
324  }
325  return (*this)[index];
326  }
327  //**********************************************************************************************
328 
329  //**Begin function******************************************************************************
334  inline ConstIterator begin() const {
335  return ConstIterator( sv_.begin(), op_ );
336  }
337  //**********************************************************************************************
338 
339  //**End function********************************************************************************
344  inline ConstIterator end() const {
345  return ConstIterator( sv_.end(), op_ );
346  }
347  //**********************************************************************************************
348 
349  //**Size function*******************************************************************************
354  inline size_t size() const noexcept {
355  return sv_.size();
356  }
357  //**********************************************************************************************
358 
359  //**NonZeros function***************************************************************************
364  inline size_t nonZeros() const {
365  return sv_.nonZeros();
366  }
367  //**********************************************************************************************
368 
369  //**Find function*******************************************************************************
375  inline ConstIterator find( size_t index ) const {
377  return ConstIterator( sv_.find( index ), op_ );
378  }
379  //**********************************************************************************************
380 
381  //**LowerBound function*************************************************************************
387  inline ConstIterator lowerBound( size_t index ) const {
389  return ConstIterator( sv_.lowerBound( index ), op_ );
390  }
391  //**********************************************************************************************
392 
393  //**UpperBound function*************************************************************************
399  inline ConstIterator upperBound( size_t index ) const {
401  return ConstIterator( sv_.upperBound( index ), op_ );
402  }
403  //**********************************************************************************************
404 
405  //**Operand access******************************************************************************
410  inline Operand operand() const noexcept {
411  return sv_;
412  }
413  //**********************************************************************************************
414 
415  //**Operation access****************************************************************************
420  inline Operation operation() const {
421  return op_;
422  }
423  //**********************************************************************************************
424 
425  //**********************************************************************************************
431  template< typename T >
432  inline bool canAlias( const T* alias ) const noexcept {
433  return sv_.canAlias( alias );
434  }
435  //**********************************************************************************************
436 
437  //**********************************************************************************************
443  template< typename T >
444  inline bool isAliased( const T* alias ) const noexcept {
445  return sv_.isAliased( alias );
446  }
447  //**********************************************************************************************
448 
449  //**********************************************************************************************
454  inline bool canSMPAssign() const noexcept {
455  return sv_.canSMPAssign();
456  }
457  //**********************************************************************************************
458 
459  private:
460  //**Member variables****************************************************************************
463  //**********************************************************************************************
464 
465  //**Assignment to dense vectors*****************************************************************
479  template< typename VT2 > // Type of the target dense vector
480  friend inline auto assign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
482  {
484 
488 
489  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
490 
491  const RT tmp( serial( rhs.sv_ ) );
492  assign( ~lhs, map( tmp, rhs.op_ ) );
493  }
495  //**********************************************************************************************
496 
497  //**Assignment to sparse vectors****************************************************************
512  template< typename VT2 > // Type of the target sparse vector
513  friend inline auto assign( SparseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
515  IsSame_v< UnderlyingNumeric_t<VT>, UnderlyingNumeric_t<VT2> > >
516  {
518 
519  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
520 
521  assign( ~lhs, rhs.sv_ );
522 
523  const auto end( (~lhs).end() );
524  for( auto element=(~lhs).begin(); element!=end; ++element ) {
525  element->value() = rhs.op_( element->value() );
526  }
527  }
529  //**********************************************************************************************
530 
531  //**Assignment to sparse vectors****************************************************************
546  template< typename VT2 > // Type of the target sparse vector
547  friend inline auto assign( SparseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
548  -> EnableIf_t< UseAssign_v<VT2> &&
549  !IsSame_v< UnderlyingNumeric_t<VT>, UnderlyingNumeric_t<VT2> > >
550  {
552 
556 
557  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
558 
559  const RT tmp( serial( rhs.sv_ ) );
560  (~lhs).reserve( tmp.nonZeros() );
561  assign( ~lhs, map( tmp, rhs.op_ ) );
562  }
564  //**********************************************************************************************
565 
566  //**Addition assignment to dense vectors********************************************************
580  template< typename VT2 > // Type of the target dense vector
581  friend inline auto addAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
582  -> EnableIf_t< UseAssign_v<VT2> >
583  {
585 
589 
590  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
591 
592  const RT tmp( serial( rhs.sv_ ) );
593  addAssign( ~lhs, map( tmp, rhs.op_ ) );
594  }
596  //**********************************************************************************************
597 
598  //**Addition assignment to sparse vectors*******************************************************
599  // No special implementation for the addition assignment to sparse vectors.
600  //**********************************************************************************************
601 
602  //**Subtraction assignment to dense vectors*****************************************************
616  template< typename VT2 > // Type of the target dense vector
617  friend inline auto subAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
618  -> EnableIf_t< UseAssign_v<VT2> >
619  {
621 
625 
626  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
627 
628  const RT tmp( serial( rhs.sv_ ) );
629  subAssign( ~lhs, map( tmp, rhs.op_ ) );
630  }
632  //**********************************************************************************************
633 
634  //**Subtraction assignment to sparse vectors****************************************************
635  // No special implementation for the subtraction assignment to sparse vectors.
636  //**********************************************************************************************
637 
638  //**Multiplication assignment to dense vectors**************************************************
652  template< typename VT2 > // Type of the target dense vector
653  friend inline auto multAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
654  -> EnableIf_t< UseAssign_v<VT2> >
655  {
657 
661 
662  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
663 
664  const RT tmp( serial( rhs.sv_ ) );
665  multAssign( ~lhs, map( tmp, rhs.op_ ) );
666  }
668  //**********************************************************************************************
669 
670  //**Multiplication assignment to sparse vectors*************************************************
671  // No special implementation for the multiplication assignment to sparse vectors.
672  //**********************************************************************************************
673 
674  //**SMP assignment to dense vectors*************************************************************
688  template< typename VT2 > // Type of the target dense vector
689  friend inline auto smpAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
690  -> EnableIf_t< UseSMPAssign_v<VT2> >
691  {
693 
697 
698  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
699 
700  const RT tmp( rhs.sv_ );
701  smpAssign( ~lhs, map( tmp, rhs.op_ ) );
702  }
704  //**********************************************************************************************
705 
706  //**SMP assignment to sparse vectors************************************************************
707  // No special implementation for the SMP assignment to sparse vectors.
708  //**********************************************************************************************
709 
710  //**SMP addition assignment to dense vectors****************************************************
724  template< typename VT2 > // Type of the target dense vector
725  friend inline auto smpAddAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
726  -> EnableIf_t< UseSMPAssign_v<VT2> >
727  {
729 
733 
734  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
735 
736  const RT tmp( rhs.sv_ );
737  smpAddAssign( ~lhs, map( tmp, rhs.op_ ) );
738  }
740  //**********************************************************************************************
741 
742  //**SMP addition assignment to sparse vectors***************************************************
743  // No special implementation for the SMP addition assignment to sparse vectors.
744  //**********************************************************************************************
745 
746  //**SMP subtraction assignment to dense vectors*************************************************
760  template< typename VT2 > // Type of the target dense vector
761  friend inline auto smpSubAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
762  -> EnableIf_t< UseSMPAssign_v<VT2> >
763  {
765 
769 
770  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
771 
772  const RT tmp( rhs.sv_ );
773  smpSubAssign( ~lhs, map( tmp, rhs.op_ ) );
774  }
776  //**********************************************************************************************
777 
778  //**SMP subtraction assignment to sparse vectors************************************************
779  // No special implementation for the SMP subtraction assignment to sparse vectors.
780  //**********************************************************************************************
781 
782  //**SMP multiplication assignment to dense vectors**********************************************
796  template< typename VT2 > // Type of the target dense vector
797  friend inline auto smpMultAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
798  -> EnableIf_t< UseSMPAssign_v<VT2> >
799  {
801 
805 
806  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
807 
808  const RT tmp( rhs.sv_ );
809  smpMultAssign( ~lhs, map( tmp, rhs.op_ ) );
810  }
812  //**********************************************************************************************
813 
814  //**SMP multiplication assignment to sparse vectors*********************************************
815  // No special implementation for the SMP multiplication assignment to sparse vectors.
816  //**********************************************************************************************
817 
818  //**Compile time checks*************************************************************************
823  //**********************************************************************************************
824 };
825 //*************************************************************************************************
826 
827 
828 
829 
830 //=================================================================================================
831 //
832 // GLOBAL FUNCTIONS
833 //
834 //=================================================================================================
835 
836 //*************************************************************************************************
854 template< typename VT // Type of the sparse vector
855  , bool TF // Transpose flag
856  , typename OP > // Type of the custom operation
857 inline decltype(auto) map( const SparseVector<VT,TF>& sv, OP op )
858 {
860 
861  using ReturnType = const SVecMapExpr<VT,OP,TF>;
862  return ReturnType( ~sv, op );
863 }
864 //*************************************************************************************************
865 
866 
867 //*************************************************************************************************
885 template< typename VT // Type of the sparse vector
886  , bool TF // Transpose flag
887  , typename OP > // Type of the custom operation
888 inline decltype(auto) forEach( const SparseVector<VT,TF>& sv, OP op )
889 {
891 
892  return map( ~sv, op );
893 }
894 //*************************************************************************************************
895 
896 
897 //*************************************************************************************************
914 template< typename VT // Type of the sparse vector
915  , bool TF > // Transpose flag
916 inline decltype(auto) abs( const SparseVector<VT,TF>& sv )
917 {
919 
920  return map( ~sv, Abs() );
921 }
922 //*************************************************************************************************
923 
924 
925 //*************************************************************************************************
942 template< typename VT // Type of the sparse vector
943  , bool TF > // Transpose flag
944 inline decltype(auto) sign( const SparseVector<VT,TF>& sv )
945 {
947 
948  return map( ~sv, Sign() );
949 }
950 //*************************************************************************************************
951 
952 
953 //*************************************************************************************************
970 template< typename VT // Type of the sparse vector
971  , bool TF > // Transpose flag
972 inline decltype(auto) floor( const SparseVector<VT,TF>& sv )
973 {
975 
976  return map( ~sv, Floor() );
977 }
978 //*************************************************************************************************
979 
980 
981 //*************************************************************************************************
998 template< typename VT // Type of the sparse vector
999  , bool TF > // Transpose flag
1000 inline decltype(auto) ceil( const SparseVector<VT,TF>& sv )
1001 {
1003 
1004  return map( ~sv, Ceil() );
1005 }
1006 //*************************************************************************************************
1007 
1008 
1009 //*************************************************************************************************
1026 template< typename VT // Type of the sparse vector
1027  , bool TF > // Transpose flag
1028 inline decltype(auto) trunc( const SparseVector<VT,TF>& sv )
1029 {
1031 
1032  return map( ~sv, Trunc() );
1033 }
1034 //*************************************************************************************************
1035 
1036 
1037 //*************************************************************************************************
1054 template< typename VT // Type of the sparse vector
1055  , bool TF > // Transpose flag
1056 inline decltype(auto) round( const SparseVector<VT,TF>& sv )
1057 {
1059 
1060  return map( ~sv, Round() );
1061 }
1062 //*************************************************************************************************
1063 
1064 
1065 //*************************************************************************************************
1082 template< typename VT // Type of the sparse vector
1083  , bool TF > // Transpose flag
1084 inline decltype(auto) conj( const SparseVector<VT,TF>& sv )
1085 {
1087 
1088  return map( ~sv, Conj() );
1089 }
1090 //*************************************************************************************************
1091 
1092 
1093 //*************************************************************************************************
1119 template< typename VT // Type of the sparse vector
1120  , bool TF > // Transpose flag
1121 inline decltype(auto) ctrans( const SparseVector<VT,TF>& sv )
1122 {
1124 
1125  return trans( conj( ~sv ) );
1126 }
1127 //*************************************************************************************************
1128 
1129 
1130 //*************************************************************************************************
1147 template< typename VT // Type of the sparse vector
1148  , bool TF > // Transpose flag
1149 inline decltype(auto) real( const SparseVector<VT,TF>& sv )
1150 {
1152 
1153  return map( ~sv, Real() );
1154 }
1155 //*************************************************************************************************
1156 
1157 
1158 //*************************************************************************************************
1175 template< typename VT // Type of the sparse vector
1176  , bool TF > // Transpose flag
1177 inline decltype(auto) imag( const SparseVector<VT,TF>& sv )
1178 {
1180 
1181  return map( ~sv, Imag() );
1182 }
1183 //*************************************************************************************************
1184 
1185 
1186 //*************************************************************************************************
1206 template< typename VT // Type of the sparse vector
1207  , bool TF > // Transpose flag
1208 inline decltype(auto) sqrt( const SparseVector<VT,TF>& sv )
1209 {
1211 
1212  return map( ~sv, Sqrt() );
1213 }
1214 //*************************************************************************************************
1215 
1216 
1217 //*************************************************************************************************
1237 template< typename VT // Type of the sparse vector
1238  , bool TF > // Transpose flag
1239 inline decltype(auto) invsqrt( const SparseVector<VT,TF>& sv )
1240 {
1242 
1243  return map( ~sv, InvSqrt() );
1244 }
1245 //*************************************************************************************************
1246 
1247 
1248 //*************************************************************************************************
1268 template< typename VT // Type of the sparse vector
1269  , bool TF > // Transpose flag
1270 inline decltype(auto) cbrt( const SparseVector<VT,TF>& sv )
1271 {
1273 
1274  return map( ~sv, Cbrt() );
1275 }
1276 //*************************************************************************************************
1277 
1278 
1279 //*************************************************************************************************
1299 template< typename VT // Type of the sparse vector
1300  , bool TF > // Transpose flag
1301 inline decltype(auto) invcbrt( const SparseVector<VT,TF>& sv )
1302 {
1304 
1305  return map( ~sv, InvCbrt() );
1306 }
1307 //*************************************************************************************************
1308 
1309 
1310 //*************************************************************************************************
1329 template< typename VT // Type of the sparse vector
1330  , bool TF // Transpose flag
1331  , typename DT > // Type of the delimiters
1332 inline decltype(auto) clamp( const SparseVector<VT,TF>& sv, const DT& min, const DT& max )
1333 {
1335 
1336  return map( ~sv, Clamp<DT>( min, max ) );
1337 }
1338 //*************************************************************************************************
1339 
1340 
1341 //*************************************************************************************************
1359 template< typename VT // Type of the sparse vector
1360  , bool TF // Transpose flag
1361  , typename ST // Type of the scalar exponent
1362  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
1363 inline decltype(auto) pow( const SparseVector<VT,TF>& sv, ST exp )
1364 {
1366 
1367  using ScalarType = MultTrait_t< UnderlyingBuiltin_t<VT>, ST >;
1368  return map( ~sv, blaze::bind2nd( Pow(), ScalarType( exp ) ) );
1369 }
1370 //*************************************************************************************************
1371 
1372 
1373 //*************************************************************************************************
1390 template< typename VT // Type of the sparse vector
1391  , bool TF > // Transpose flag
1392 inline decltype(auto) exp( const SparseVector<VT,TF>& sv )
1393 {
1395 
1396  return map( ~sv, Exp() );
1397 }
1398 //*************************************************************************************************
1399 
1400 
1401 //*************************************************************************************************
1418 template< typename VT // Type of the sparse vector
1419  , bool TF > // Transpose flag
1420 inline decltype(auto) exp2( const SparseVector<VT,TF>& sv )
1421 {
1423 
1424  return map( ~sv, Exp2() );
1425 }
1426 //*************************************************************************************************
1427 
1428 
1429 //*************************************************************************************************
1446 template< typename VT // Type of the sparse vector
1447  , bool TF > // Transpose flag
1448 inline decltype(auto) exp10( const SparseVector<VT,TF>& sv )
1449 {
1451 
1452  return map( ~sv, Exp10() );
1453 }
1454 //*************************************************************************************************
1455 
1456 
1457 //*************************************************************************************************
1477 template< typename VT // Type of the sparse vector
1478  , bool TF > // Transpose flag
1479 inline decltype(auto) log( const SparseVector<VT,TF>& sv )
1480 {
1482 
1483  return map( ~sv, Log() );
1484 }
1485 //*************************************************************************************************
1486 
1487 
1488 //*************************************************************************************************
1508 template< typename VT // Type of the sparse vector
1509  , bool TF > // Transpose flag
1510 inline decltype(auto) log2( const SparseVector<VT,TF>& sv )
1511 {
1513 
1514  return map( ~sv, Log2() );
1515 }
1516 //*************************************************************************************************
1517 
1518 
1519 //*************************************************************************************************
1539 template< typename VT // Type of the sparse vector
1540  , bool TF > // Transpose flag
1541 inline decltype(auto) log10( const SparseVector<VT,TF>& sv )
1542 {
1544 
1545  return map( ~sv, Log10() );
1546 }
1547 //*************************************************************************************************
1548 
1549 
1550 //*************************************************************************************************
1567 template< typename VT // Type of the sparse vector
1568  , bool TF > // Transpose flag
1569 inline decltype(auto) sin( const SparseVector<VT,TF>& sv )
1570 {
1572 
1573  return map( ~sv, Sin() );
1574 }
1575 //*************************************************************************************************
1576 
1577 
1578 //*************************************************************************************************
1598 template< typename VT // Type of the sparse vector
1599  , bool TF > // Transpose flag
1600 inline decltype(auto) asin( const SparseVector<VT,TF>& sv )
1601 {
1603 
1604  return map( ~sv, Asin() );
1605 }
1606 //*************************************************************************************************
1607 
1608 
1609 //*************************************************************************************************
1626 template< typename VT // Type of the sparse vector
1627  , bool TF > // Transpose flag
1628 inline decltype(auto) sinh( const SparseVector<VT,TF>& sv )
1629 {
1631 
1632  return map( ~sv, Sinh() );
1633 }
1634 //*************************************************************************************************
1635 
1636 
1637 //*************************************************************************************************
1654 template< typename VT // Type of the sparse vector
1655  , bool TF > // Transpose flag
1656 inline decltype(auto) asinh( const SparseVector<VT,TF>& sv )
1657 {
1659 
1660  return map( ~sv, Asinh() );
1661 }
1662 //*************************************************************************************************
1663 
1664 
1665 //*************************************************************************************************
1682 template< typename VT // Type of the sparse vector
1683  , bool TF > // Transpose flag
1684 inline decltype(auto) cos( const SparseVector<VT,TF>& sv )
1685 {
1687 
1688  return map( ~sv, Cos() );
1689 }
1690 //*************************************************************************************************
1691 
1692 
1693 //*************************************************************************************************
1713 template< typename VT // Type of the sparse vector
1714  , bool TF > // Transpose flag
1715 inline decltype(auto) acos( const SparseVector<VT,TF>& sv )
1716 {
1718 
1719  return map( ~sv, Acos() );
1720 }
1721 //*************************************************************************************************
1722 
1723 
1724 //*************************************************************************************************
1741 template< typename VT // Type of the sparse vector
1742  , bool TF > // Transpose flag
1743 inline decltype(auto) cosh( const SparseVector<VT,TF>& sv )
1744 {
1746 
1747  return map( ~sv, Cosh() );
1748 }
1749 //*************************************************************************************************
1750 
1751 
1752 //*************************************************************************************************
1772 template< typename VT // Type of the sparse vector
1773  , bool TF > // Transpose flag
1774 inline decltype(auto) acosh( const SparseVector<VT,TF>& sv )
1775 {
1777 
1778  return map( ~sv, Acosh() );
1779 }
1780 //*************************************************************************************************
1781 
1782 
1783 //*************************************************************************************************
1800 template< typename VT // Type of the sparse vector
1801  , bool TF > // Transpose flag
1802 inline decltype(auto) tan( const SparseVector<VT,TF>& sv )
1803 {
1805 
1806  return map( ~sv, Tan() );
1807 }
1808 //*************************************************************************************************
1809 
1810 
1811 //*************************************************************************************************
1828 template< typename VT // Type of the sparse vector
1829  , bool TF > // Transpose flag
1830 inline decltype(auto) atan( const SparseVector<VT,TF>& sv )
1831 {
1833 
1834  return map( ~sv, Atan() );
1835 }
1836 //*************************************************************************************************
1837 
1838 
1839 //*************************************************************************************************
1859 template< typename VT // Type of the sparse vector
1860  , bool TF > // Transpose flag
1861 inline decltype(auto) tanh( const SparseVector<VT,TF>& sv )
1862 {
1864 
1865  return map( ~sv, Tanh() );
1866 }
1867 //*************************************************************************************************
1868 
1869 
1870 //*************************************************************************************************
1890 template< typename VT // Type of the sparse vector
1891  , bool TF > // Transpose flag
1892 inline decltype(auto) atanh( const SparseVector<VT,TF>& sv )
1893 {
1895 
1896  return map( ~sv, Atanh() );
1897 }
1898 //*************************************************************************************************
1899 
1900 
1901 //*************************************************************************************************
1918 template< typename VT // Type of the sparse vector
1919  , bool TF > // Transpose flag
1920 inline decltype(auto) erf( const SparseVector<VT,TF>& sv )
1921 {
1923 
1924  return map( ~sv, Erf() );
1925 }
1926 //*************************************************************************************************
1927 
1928 
1929 //*************************************************************************************************
1946 template< typename VT // Type of the sparse vector
1947  , bool TF > // Transpose flag
1948 inline decltype(auto) erfc( const SparseVector<VT,TF>& sv )
1949 {
1951 
1952  return map( ~sv, Erfc() );
1953 }
1954 //*************************************************************************************************
1955 
1956 
1957 
1958 
1959 //=================================================================================================
1960 //
1961 // GLOBAL RESTRUCTURING FUNCTIONS
1962 //
1963 //=================================================================================================
1964 
1965 //*************************************************************************************************
1976 template< typename VT // Type of the sparse vector
1977  , bool TF > // Transpose flag
1978 inline decltype(auto) abs( const SVecMapExpr<VT,Abs,TF>& sv )
1979 {
1981 
1982  return sv;
1983 }
1985 //*************************************************************************************************
1986 
1987 
1988 //*************************************************************************************************
1999 template< typename VT // Type of the sparse vector
2000  , bool TF > // Transpose flag
2001 inline decltype(auto) sign( const SVecMapExpr<VT,Sign,TF>& sv )
2002 {
2004 
2005  return sv;
2006 }
2008 //*************************************************************************************************
2009 
2010 
2011 //*************************************************************************************************
2022 template< typename VT // Type of the sparse vector
2023  , bool TF > // Transpose flag
2024 inline decltype(auto) floor( const SVecMapExpr<VT,Floor,TF>& sv )
2025 {
2027 
2028  return sv;
2029 }
2031 //*************************************************************************************************
2032 
2033 
2034 //*************************************************************************************************
2045 template< typename VT // Type of the sparse vector
2046  , bool TF > // Transpose flag
2047 inline decltype(auto) ceil( const SVecMapExpr<VT,Ceil,TF>& sv )
2048 {
2050 
2051  return sv;
2052 }
2054 //*************************************************************************************************
2055 
2056 
2057 //*************************************************************************************************
2068 template< typename VT // Type of the sparse vector
2069  , bool TF > // Transpose flag
2070 inline decltype(auto) trunc( const SVecMapExpr<VT,Trunc,TF>& sv )
2071 {
2073 
2074  return sv;
2075 }
2077 //*************************************************************************************************
2078 
2079 
2080 //*************************************************************************************************
2091 template< typename VT // Type of the sparse vector
2092  , bool TF > // Transpose flag
2093 inline decltype(auto) round( const SVecMapExpr<VT,Round,TF>& sv )
2094 {
2096 
2097  return sv;
2098 }
2100 //*************************************************************************************************
2101 
2102 
2103 //*************************************************************************************************
2121 template< typename VT // Type of the sparse vector
2122  , bool TF > // Transpose flag
2123 inline decltype(auto) conj( const SVecMapExpr<VT,Conj,TF>& sv )
2124 {
2126 
2127  return sv.operand();
2128 }
2130 //*************************************************************************************************
2131 
2132 
2133 //*************************************************************************************************
2151 template< typename VT // Type of the sparse vector
2152  , bool TF > // Transpose flag
2153 inline decltype(auto) conj( const SVecTransExpr<SVecMapExpr<VT,Conj,TF>,!TF>& sv )
2154 {
2156 
2157  return trans( sv.operand().operand() );
2158 }
2160 //*************************************************************************************************
2161 
2162 
2163 //*************************************************************************************************
2174 template< typename VT // Type of the sparse vector
2175  , bool TF > // Transpose flag
2176 inline decltype(auto) real( const SVecMapExpr<VT,Real,TF>& sv )
2177 {
2179 
2180  return sv;
2181 }
2183 //*************************************************************************************************
2184 
2185 } // namespace blaze
2186 
2187 #endif
Header file for the UnderlyingNumeric type trait.
If_t< IsExpression_v< VT >, const VT, const VT & > Operand
Composite data type of the sparse vector expression.
Definition: SVecMapExpr.h:148
Generic wrapper for the trunc() function.
Definition: Trunc.h:81
ConstIterator(IteratorType it, OP op)
Constructor for the ConstIterator class.
Definition: SVecMapExpr.h:187
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
ConstIterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition: SVecMapExpr.h:399
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
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SVecMapExpr.h:454
Generic wrapper for the cbrt() function.
Definition: Cbrt.h:81
Header file for basic type definitions.
Header file for the SparseVector base class.
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
ValueIndexPair< ElementType > Element
Element type of the sparse vector expression.
Definition: SVecMapExpr.h:162
Generic wrapper for the sin() function.
Definition: Sin.h:79
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
typename MapTrait< Args... >::Type MapTrait_t
Auxiliary alias declaration for the MapTrait class template.The MapTrait_t alias declaration provides...
Definition: MapTrait.h:160
Header file for the IsSame and IsStrictlySame type traits.
ResultType_t< VT > RT
Result type of the sparse vector expression.
Definition: SVecMapExpr.h:98
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
ReturnType value() const
Access to the current value of the sparse element.
Definition: SVecMapExpr.h:229
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
Header file for the VecMapExpr base class.
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SVecMapExpr.h:287
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
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecMapExpr.h:321
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.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SVecMapExpr.h:261
Header file for the RequiresEvaluation type trait.
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the map expression.
Definition: SVecMapExpr.h:110
Iterator over the elements of the sparse vector map expression.
Definition: SVecMapExpr.h:157
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SVecMapExpr.h:432
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
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SVecMapExpr.h:444
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
const Element operator *() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecMapExpr.h:209
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
ValueType * PointerType
Pointer return type.
Definition: SVecMapExpr.h:169
const ConstIterator * operator->() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecMapExpr.h:219
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
Operation op_
The custom unary operation.
Definition: SVecMapExpr.h:462
Generic wrapper for the sqrt() function.
Definition: Sqrt.h:83
Header file for the ValueIndexPair class.
IteratorCategory iterator_category
The iterator category.
Definition: SVecMapExpr.h:174
If_t< useAssign, const ResultType, const SVecMapExpr & > CompositeType
Data type for composite expression templates.
Definition: SVecMapExpr.h:145
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
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SVecMapExpr.h:354
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
ValueType & ReferenceType
Reference return type.
Definition: SVecMapExpr.h:170
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SVecMapExpr.h:272
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
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
ConstIterator & operator++()
Pre-increment operator.
Definition: SVecMapExpr.h:198
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
OP Operation
Data type of the custom unary operation.
Definition: SVecMapExpr.h:151
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
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type,...
Definition: SparseVector.h:61
Generic wrapper for the exp2() function.
Definition: Exp2.h:67
Generic wrapper for the asin() function.
Definition: Asin.h:79
Constraint on the data type.
decltype(auto) atan(const DenseMatrix< MT, SO > &dm)
Computes the inverse tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2070
decltype(auto) asinh(const DenseMatrix< MT, SO > &dm)
Computes the inverse hyperbolic sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1896
Generic wrapper for the erf() function.
Definition: Erf.h:77
ReturnType_t< VT > RN
Return type of the sparse vector expression.
Definition: SVecMapExpr.h:99
Expression object for the sparse vector map() function.The SVecMapExpr class represents the compile t...
Definition: Forward.h:155
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:1198
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SVecMapExpr.h:250
Constraint on the data type.
ConstIterator find(size_t index) const
Searches for a specific vector element.
Definition: SVecMapExpr.h:375
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
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SVecMapExpr.h:167
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
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
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
size_t index() const
Access to the current index of the sparse element.
Definition: SVecMapExpr.h:239
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
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
ConstIterator begin() const
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecMapExpr.h:334
#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.
OP op_
The custom unary operation.
Definition: SVecMapExpr.h:280
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
MapTrait_t< RT, OP > ResultType
Result type for expression template evaluations.
Definition: SVecMapExpr.h:137
ConstIterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition: SVecMapExpr.h:387
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
Operand operand() const noexcept
Returns the sparse vector operand.
Definition: SVecMapExpr.h:410
Element ValueType
Type of the underlying pointers.
Definition: SVecMapExpr.h:168
Header file for the RemoveReference type trait.
Generic wrapper for the sign() function.
Definition: Sign.h:81
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
ConstIterator end() const
Returns an iterator just past the last non-zero element of the sparse vector.
Definition: SVecMapExpr.h:344
ConstIterator_t< RemoveReference_t< Operand > > IteratorType
Iterator type of the sparse vector expression.
Definition: SVecMapExpr.h:165
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
decltype(auto) sin(const DenseMatrix< MT, SO > &dm)
Computes the sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1809
SVecMapExpr(const VT &sv, OP op) noexcept
Constructor for the SVecMapExpr class.
Definition: SVecMapExpr.h:296
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
Header file for the IsComputation type trait class.
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
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
size_t nonZeros() const
Returns the number of non-zero elements in the sparse vector.
Definition: SVecMapExpr.h:364
Generic wrapper for the atan() function.
Definition: Atan.h:79
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:146
Generic wrapper for the round() function.
Definition: Round.h:81
decltype(std::declval< OP >()(std::declval< RN >())) ReturnType
Return type for expression template evaluations.
Definition: SVecMapExpr.h:142
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SVecMapExpr.h:138
Generic wrapper for the sinh() function.
Definition: Sinh.h:79
Header file for the map trait.
decltype(auto) log10(const DenseMatrix< MT, SO > &dm)
Computes the common logarithm for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1781
Generic wrapper for the log2() function.
Definition: Log2.h:67
Operand sv_
Sparse vector of the map expression.
Definition: SVecMapExpr.h:461
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
IteratorType it_
Iterator over the elements of the sparse vector expression.
Definition: SVecMapExpr.h:279
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
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SVecMapExpr.h:171
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: SVecMapExpr.h:139
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
Operation operation() const
Returns a copy of the custom operation.
Definition: SVecMapExpr.h:420
Generic wrapper for the exp() function.
Definition: Exp.h:69
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecMapExpr.h:308
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.In case the given data type T is not a dense or sparse vector type and in...
Definition: TransposeFlag.h:63
#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
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector.
Definition: DenseVector.h:191
Header file for the IsExpression type trait class.
Header file for the function trace functionality.
decltype(auto) map(const DenseMatrix< MT1, SO > &lhs, const DenseMatrix< MT2, SO > &rhs, OP op)
Evaluates the given binary operation on each single element of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1121