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 =
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  using ReturnType = const SVecMapExpr<VT,OP,TF>;
893  return ReturnType( ~sv, op );
894 }
895 //*************************************************************************************************
896 
897 
898 //*************************************************************************************************
915 template< typename VT // Type of the sparse vector
916  , bool TF > // Transpose flag
917 inline decltype(auto) abs( const SparseVector<VT,TF>& sv )
918 {
920 
921  using ReturnType = const SVecMapExpr<VT,Abs,TF>;
922  return ReturnType( ~sv, Abs() );
923 }
924 //*************************************************************************************************
925 
926 
927 //*************************************************************************************************
944 template< typename VT // Type of the sparse vector
945  , bool TF > // Transpose flag
946 inline decltype(auto) sign( const SparseVector<VT,TF>& sv )
947 {
949 
950  using ReturnType = const SVecMapExpr<VT,Sign,TF>;
951  return ReturnType( ~sv, Sign() );
952 }
953 //*************************************************************************************************
954 
955 
956 //*************************************************************************************************
973 template< typename VT // Type of the sparse vector
974  , bool TF > // Transpose flag
975 inline decltype(auto) floor( const SparseVector<VT,TF>& sv )
976 {
978 
979  using ReturnType = const SVecMapExpr<VT,Floor,TF>;
980  return ReturnType( ~sv, Floor() );
981 }
982 //*************************************************************************************************
983 
984 
985 //*************************************************************************************************
1002 template< typename VT // Type of the sparse vector
1003  , bool TF > // Transpose flag
1004 inline decltype(auto) ceil( const SparseVector<VT,TF>& sv )
1005 {
1007 
1008  using ReturnType = const SVecMapExpr<VT,Ceil,TF>;
1009  return ReturnType( ~sv, Ceil() );
1010 }
1011 //*************************************************************************************************
1012 
1013 
1014 //*************************************************************************************************
1031 template< typename VT // Type of the sparse vector
1032  , bool TF > // Transpose flag
1033 inline decltype(auto) trunc( const SparseVector<VT,TF>& sv )
1034 {
1036 
1037  using ReturnType = const SVecMapExpr<VT,Trunc,TF>;
1038  return ReturnType( ~sv, Trunc() );
1039 }
1040 //*************************************************************************************************
1041 
1042 
1043 //*************************************************************************************************
1060 template< typename VT // Type of the sparse vector
1061  , bool TF > // Transpose flag
1062 inline decltype(auto) round( const SparseVector<VT,TF>& sv )
1063 {
1065 
1066  using ReturnType = const SVecMapExpr<VT,Round,TF>;
1067  return ReturnType( ~sv, Round() );
1068 }
1069 //*************************************************************************************************
1070 
1071 
1072 //*************************************************************************************************
1089 template< typename VT // Type of the sparse vector
1090  , bool TF > // Transpose flag
1091 inline decltype(auto) conj( const SparseVector<VT,TF>& sv )
1092 {
1094 
1095  using ReturnType = const SVecMapExpr<VT,Conj,TF>;
1096  return ReturnType( ~sv, Conj() );
1097 }
1098 //*************************************************************************************************
1099 
1100 
1101 //*************************************************************************************************
1127 template< typename VT // Type of the sparse vector
1128  , bool TF > // Transpose flag
1129 inline decltype(auto) ctrans( const SparseVector<VT,TF>& sv )
1130 {
1132 
1133  return trans( conj( ~sv ) );
1134 }
1135 //*************************************************************************************************
1136 
1137 
1138 //*************************************************************************************************
1155 template< typename VT // Type of the sparse vector
1156  , bool TF > // Transpose flag
1157 inline decltype(auto) real( const SparseVector<VT,TF>& sv )
1158 {
1160 
1161  using ReturnType = const SVecMapExpr<VT,Real,TF>;
1162  return ReturnType( ~sv, Real() );
1163 }
1164 //*************************************************************************************************
1165 
1166 
1167 //*************************************************************************************************
1184 template< typename VT // Type of the sparse vector
1185  , bool TF > // Transpose flag
1186 inline decltype(auto) imag( const SparseVector<VT,TF>& sv )
1187 {
1189 
1190  using ReturnType = const SVecMapExpr<VT,Imag,TF>;
1191  return ReturnType( ~sv, Imag() );
1192 }
1193 //*************************************************************************************************
1194 
1195 
1196 //*************************************************************************************************
1216 template< typename VT // Type of the sparse vector
1217  , bool TF > // Transpose flag
1218 inline decltype(auto) sqrt( const SparseVector<VT,TF>& sv )
1219 {
1221 
1222  using ReturnType = const SVecMapExpr<VT,Sqrt,TF>;
1223  return ReturnType( ~sv, Sqrt() );
1224 }
1225 //*************************************************************************************************
1226 
1227 
1228 //*************************************************************************************************
1248 template< typename VT // Type of the sparse vector
1249  , bool TF > // Transpose flag
1250 inline decltype(auto) invsqrt( const SparseVector<VT,TF>& sv )
1251 {
1253 
1254  using ReturnType = const SVecMapExpr<VT,InvSqrt,TF>;
1255  return ReturnType( ~sv, InvSqrt() );
1256 }
1257 //*************************************************************************************************
1258 
1259 
1260 //*************************************************************************************************
1280 template< typename VT // Type of the sparse vector
1281  , bool TF > // Transpose flag
1282 inline decltype(auto) cbrt( const SparseVector<VT,TF>& sv )
1283 {
1285 
1286  using ReturnType = const SVecMapExpr<VT,Cbrt,TF>;
1287  return ReturnType( ~sv, Cbrt() );
1288 }
1289 //*************************************************************************************************
1290 
1291 
1292 //*************************************************************************************************
1312 template< typename VT // Type of the sparse vector
1313  , bool TF > // Transpose flag
1314 inline decltype(auto) invcbrt( const SparseVector<VT,TF>& sv )
1315 {
1317 
1318  using ReturnType = const SVecMapExpr<VT,InvCbrt,TF>;
1319  return ReturnType( ~sv, InvCbrt() );
1320 }
1321 //*************************************************************************************************
1322 
1323 
1324 //*************************************************************************************************
1343 template< typename VT // Type of the sparse vector
1344  , bool TF // Transpose flag
1345  , typename DT > // Type of the delimiters
1346 inline decltype(auto) clamp( const SparseVector<VT,TF>& sv, const DT& min, const DT& max )
1347 {
1349 
1350  using ReturnType = const SVecMapExpr<VT,Clamp<DT>,TF>;
1351  return ReturnType( ~sv, Clamp<DT>( min, max ) );
1352 }
1353 //*************************************************************************************************
1354 
1355 
1356 //*************************************************************************************************
1374 template< typename VT // Type of the sparse vector
1375  , bool TF // Transpose flag
1376  , typename ST // Type of the scalar exponent
1377  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
1378 inline decltype(auto) pow( const SparseVector<VT,TF>& sv, ST exp )
1379 {
1381 
1382  using ScalarType = MultTrait_t< UnderlyingBuiltin_t<VT>, ST >;
1384  return ReturnType( ~sv, UnaryPow<ScalarType>( exp ) );
1385 }
1386 //*************************************************************************************************
1387 
1388 
1389 //*************************************************************************************************
1406 template< typename VT // Type of the sparse vector
1407  , bool TF > // Transpose flag
1408 inline decltype(auto) exp( const SparseVector<VT,TF>& sv )
1409 {
1411 
1412  using ReturnType = const SVecMapExpr<VT,Exp,TF>;
1413  return ReturnType( ~sv, Exp() );
1414 }
1415 //*************************************************************************************************
1416 
1417 
1418 //*************************************************************************************************
1435 template< typename VT // Type of the sparse vector
1436  , bool TF > // Transpose flag
1437 inline decltype(auto) exp2( const SparseVector<VT,TF>& sv )
1438 {
1440 
1441  using ReturnType = const SVecMapExpr<VT,Exp2,TF>;
1442  return ReturnType( ~sv, Exp2() );
1443 }
1444 //*************************************************************************************************
1445 
1446 
1447 //*************************************************************************************************
1464 template< typename VT // Type of the sparse vector
1465  , bool TF > // Transpose flag
1466 inline decltype(auto) exp10( const SparseVector<VT,TF>& sv )
1467 {
1469 
1470  using ReturnType = const SVecMapExpr<VT,Exp10,TF>;
1471  return ReturnType( ~sv, Exp10() );
1472 }
1473 //*************************************************************************************************
1474 
1475 
1476 //*************************************************************************************************
1496 template< typename VT // Type of the sparse vector
1497  , bool TF > // Transpose flag
1498 inline decltype(auto) log( const SparseVector<VT,TF>& sv )
1499 {
1501 
1502  using ReturnType = const SVecMapExpr<VT,Log,TF>;
1503  return ReturnType( ~sv, Log() );
1504 }
1505 //*************************************************************************************************
1506 
1507 
1508 //*************************************************************************************************
1528 template< typename VT // Type of the sparse vector
1529  , bool TF > // Transpose flag
1530 inline decltype(auto) log2( const SparseVector<VT,TF>& sv )
1531 {
1533 
1534  using ReturnType = const SVecMapExpr<VT,Log2,TF>;
1535  return ReturnType( ~sv, Log2() );
1536 }
1537 //*************************************************************************************************
1538 
1539 
1540 //*************************************************************************************************
1560 template< typename VT // Type of the sparse vector
1561  , bool TF > // Transpose flag
1562 inline decltype(auto) log10( const SparseVector<VT,TF>& sv )
1563 {
1565 
1566  using ReturnType = const SVecMapExpr<VT,Log10,TF>;
1567  return ReturnType( ~sv, Log10() );
1568 }
1569 //*************************************************************************************************
1570 
1571 
1572 //*************************************************************************************************
1589 template< typename VT // Type of the sparse vector
1590  , bool TF > // Transpose flag
1591 inline decltype(auto) sin( const SparseVector<VT,TF>& sv )
1592 {
1594 
1595  using ReturnType = const SVecMapExpr<VT,Sin,TF>;
1596  return ReturnType( ~sv, Sin() );
1597 }
1598 //*************************************************************************************************
1599 
1600 
1601 //*************************************************************************************************
1621 template< typename VT // Type of the sparse vector
1622  , bool TF > // Transpose flag
1623 inline decltype(auto) asin( const SparseVector<VT,TF>& sv )
1624 {
1626 
1627  using ReturnType = const SVecMapExpr<VT,Asin,TF>;
1628  return ReturnType( ~sv, Asin() );
1629 }
1630 //*************************************************************************************************
1631 
1632 
1633 //*************************************************************************************************
1650 template< typename VT // Type of the sparse vector
1651  , bool TF > // Transpose flag
1652 inline decltype(auto) sinh( const SparseVector<VT,TF>& sv )
1653 {
1655 
1656  using ReturnType = const SVecMapExpr<VT,Sinh,TF>;
1657  return ReturnType( ~sv, Sinh() );
1658 }
1659 //*************************************************************************************************
1660 
1661 
1662 //*************************************************************************************************
1679 template< typename VT // Type of the sparse vector
1680  , bool TF > // Transpose flag
1681 inline decltype(auto) asinh( const SparseVector<VT,TF>& sv )
1682 {
1684 
1685  using ReturnType = const SVecMapExpr<VT,Asinh,TF>;
1686  return ReturnType( ~sv, Asinh() );
1687 }
1688 //*************************************************************************************************
1689 
1690 
1691 //*************************************************************************************************
1708 template< typename VT // Type of the sparse vector
1709  , bool TF > // Transpose flag
1710 inline decltype(auto) cos( const SparseVector<VT,TF>& sv )
1711 {
1713 
1714  using ReturnType = const SVecMapExpr<VT,Cos,TF>;
1715  return ReturnType( ~sv, Cos() );
1716 }
1717 //*************************************************************************************************
1718 
1719 
1720 //*************************************************************************************************
1740 template< typename VT // Type of the sparse vector
1741  , bool TF > // Transpose flag
1742 inline decltype(auto) acos( const SparseVector<VT,TF>& sv )
1743 {
1745 
1746  using ReturnType = const SVecMapExpr<VT,Acos,TF>;
1747  return ReturnType( ~sv, Acos() );
1748 }
1749 //*************************************************************************************************
1750 
1751 
1752 //*************************************************************************************************
1769 template< typename VT // Type of the sparse vector
1770  , bool TF > // Transpose flag
1771 inline decltype(auto) cosh( const SparseVector<VT,TF>& sv )
1772 {
1774 
1775  using ReturnType = const SVecMapExpr<VT,Cosh,TF>;
1776  return ReturnType( ~sv, Cosh() );
1777 }
1778 //*************************************************************************************************
1779 
1780 
1781 //*************************************************************************************************
1801 template< typename VT // Type of the sparse vector
1802  , bool TF > // Transpose flag
1803 inline decltype(auto) acosh( const SparseVector<VT,TF>& sv )
1804 {
1806 
1807  using ReturnType = const SVecMapExpr<VT,Acosh,TF>;
1808  return ReturnType( ~sv, Acosh() );
1809 }
1810 //*************************************************************************************************
1811 
1812 
1813 //*************************************************************************************************
1830 template< typename VT // Type of the sparse vector
1831  , bool TF > // Transpose flag
1832 inline decltype(auto) tan( const SparseVector<VT,TF>& sv )
1833 {
1835 
1836  using ReturnType = const SVecMapExpr<VT,Tan,TF>;
1837  return ReturnType( ~sv, Tan() );
1838 }
1839 //*************************************************************************************************
1840 
1841 
1842 //*************************************************************************************************
1859 template< typename VT // Type of the sparse vector
1860  , bool TF > // Transpose flag
1861 inline decltype(auto) atan( const SparseVector<VT,TF>& sv )
1862 {
1864 
1865  using ReturnType = const SVecMapExpr<VT,Atan,TF>;
1866  return ReturnType( ~sv, Atan() );
1867 }
1868 //*************************************************************************************************
1869 
1870 
1871 //*************************************************************************************************
1891 template< typename VT // Type of the sparse vector
1892  , bool TF > // Transpose flag
1893 inline decltype(auto) tanh( const SparseVector<VT,TF>& sv )
1894 {
1896 
1897  using ReturnType = const SVecMapExpr<VT,Tanh,TF>;
1898  return ReturnType( ~sv, Tanh() );
1899 }
1900 //*************************************************************************************************
1901 
1902 
1903 //*************************************************************************************************
1923 template< typename VT // Type of the sparse vector
1924  , bool TF > // Transpose flag
1925 inline decltype(auto) atanh( const SparseVector<VT,TF>& sv )
1926 {
1928 
1929  using ReturnType = const SVecMapExpr<VT,Atanh,TF>;
1930  return ReturnType( ~sv, Atanh() );
1931 }
1932 //*************************************************************************************************
1933 
1934 
1935 //*************************************************************************************************
1952 template< typename VT // Type of the sparse vector
1953  , bool TF > // Transpose flag
1954 inline decltype(auto) erf( const SparseVector<VT,TF>& sv )
1955 {
1957 
1958  using ReturnType = const SVecMapExpr<VT,Erf,TF>;
1959  return ReturnType( ~sv, Erf() );
1960 }
1961 //*************************************************************************************************
1962 
1963 
1964 //*************************************************************************************************
1981 template< typename VT // Type of the sparse vector
1982  , bool TF > // Transpose flag
1983 inline decltype(auto) erfc( const SparseVector<VT,TF>& sv )
1984 {
1986 
1987  using ReturnType = const SVecMapExpr<VT,Erfc,TF>;
1988  return ReturnType( ~sv, Erfc() );
1989 }
1990 //*************************************************************************************************
1991 
1992 
1993 
1994 
1995 //=================================================================================================
1996 //
1997 // GLOBAL RESTRUCTURING FUNCTIONS
1998 //
1999 //=================================================================================================
2000 
2001 //*************************************************************************************************
2012 template< typename VT // Type of the sparse vector
2013  , bool TF > // Transpose flag
2014 inline decltype(auto) abs( const SVecMapExpr<VT,Abs,TF>& sv )
2015 {
2017 
2018  return sv;
2019 }
2021 //*************************************************************************************************
2022 
2023 
2024 //*************************************************************************************************
2035 template< typename VT // Type of the sparse vector
2036  , bool TF > // Transpose flag
2037 inline decltype(auto) sign( const SVecMapExpr<VT,Sign,TF>& sv )
2038 {
2040 
2041  return sv;
2042 }
2044 //*************************************************************************************************
2045 
2046 
2047 //*************************************************************************************************
2058 template< typename VT // Type of the sparse vector
2059  , bool TF > // Transpose flag
2060 inline decltype(auto) floor( const SVecMapExpr<VT,Floor,TF>& sv )
2061 {
2063 
2064  return sv;
2065 }
2067 //*************************************************************************************************
2068 
2069 
2070 //*************************************************************************************************
2081 template< typename VT // Type of the sparse vector
2082  , bool TF > // Transpose flag
2083 inline decltype(auto) ceil( const SVecMapExpr<VT,Ceil,TF>& sv )
2084 {
2086 
2087  return sv;
2088 }
2090 //*************************************************************************************************
2091 
2092 
2093 //*************************************************************************************************
2104 template< typename VT // Type of the sparse vector
2105  , bool TF > // Transpose flag
2106 inline decltype(auto) trunc( const SVecMapExpr<VT,Trunc,TF>& sv )
2107 {
2109 
2110  return sv;
2111 }
2113 //*************************************************************************************************
2114 
2115 
2116 //*************************************************************************************************
2127 template< typename VT // Type of the sparse vector
2128  , bool TF > // Transpose flag
2129 inline decltype(auto) round( const SVecMapExpr<VT,Round,TF>& sv )
2130 {
2132 
2133  return sv;
2134 }
2136 //*************************************************************************************************
2137 
2138 
2139 //*************************************************************************************************
2157 template< typename VT // Type of the sparse vector
2158  , bool TF > // Transpose flag
2159 inline decltype(auto) conj( const SVecMapExpr<VT,Conj,TF>& sv )
2160 {
2162 
2163  return sv.operand();
2164 }
2166 //*************************************************************************************************
2167 
2168 
2169 //*************************************************************************************************
2187 template< typename VT // Type of the sparse vector
2188  , bool TF > // Transpose flag
2189 inline decltype(auto) conj( const SVecTransExpr<SVecMapExpr<VT,Conj,TF>,!TF>& sv )
2190 {
2192 
2193  using ReturnType = const SVecTransExpr<VT,!TF>;
2194  return ReturnType( sv.operand().operand() );
2195 }
2197 //*************************************************************************************************
2198 
2199 
2200 //*************************************************************************************************
2211 template< typename VT // Type of the sparse vector
2212  , bool TF > // Transpose flag
2213 inline decltype(auto) real( const SVecMapExpr<VT,Real,TF>& sv )
2214 {
2216 
2217  return sv;
2218 }
2220 //*************************************************************************************************
2221 
2222 } // namespace blaze
2223 
2224 #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:80
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:2038
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:80
decltype(auto) exp10(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1701
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:80
Header file for basic type definitions.
Header file for the SparseVector base class.
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias declaration for the If class template.The If_t alias declaration provides a convenien...
Definition: If.h:109
ValueIndexPair< ElementType > Element
Element type of the sparse vector expression.
Definition: SVecMapExpr.h:162
Generic wrapper for the sin() function.
Definition: Sin.h:78
typename UnderlyingNumeric< T >::Type UnderlyingNumeric_t
Auxiliary alias declaration for the UnderlyingNumeric type trait.The UnderlyingNumeric_t alias declar...
Definition: UnderlyingNumeric.h:123
Generic wrapper for the conj() function.
Definition: Conj.h:82
Generic wrapper for the invsqrt() function.
Definition: InvSqrt.h:68
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
Header file for the serial shim.
decltype(auto) real(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the real part of each single element of dm.
Definition: DMatMapExpr.h:1392
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:1239
Generic wrapper for the clamp() function.
Definition: Clamp.h:60
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:1243
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:68
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
decltype(auto) clamp(const DenseMatrix< MT, SO > &dm, const DT &min, const DT &max)
Restricts each single element of the dense matrix dm to the range .
Definition: DMatMapExpr.h:1581
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecMapExpr.h:321
Generic wrapper for the pow() function with fixed exponent.
Definition: Forward.h:129
decltype(auto) sign(const DenseMatrix< MT, SO > &dm)
Applies the sign() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1181
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:1977
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
decltype(auto) erf(const DenseMatrix< MT, SO > &dm)
Computes the error function for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2189
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:82
Operation op_
The custom unary operation.
Definition: SVecMapExpr.h:462
Generic wrapper for the sqrt() function.
Definition: Sqrt.h:82
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.
decltype(auto) cos(const DenseMatrix< MT, SO > &dm)
Computes the cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1945
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:1364
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:73
Generic wrapper for the exp10() function.
Definition: Exp10.h:66
decltype(auto) exp2(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1672
decltype(auto) sinh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1887
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.
const Element operator*() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecMapExpr.h:209
decltype(auto) asin(const DenseMatrix< MT, SO > &dm)
Computes the inverse sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1858
decltype(auto) cosh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2006
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1147
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:1517
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
OP Operation
Data type of the custom unary operation.
Definition: SVecMapExpr.h:151
Generic wrapper for the log10() function.
Definition: Log10.h:68
decltype(auto) trunc(const DenseMatrix< MT, SO > &dm)
Applies the trunc() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1268
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
Header file for all functors.
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:66
Generic wrapper for the asin() function.
Definition: Asin.h:78
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:2096
decltype(auto) asinh(const DenseMatrix< MT, SO > &dm)
Computes the inverse hyperbolic sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1916
Generic wrapper for the erf() function.
Definition: Erf.h:76
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:146
Header file for the exception macros of the math module.
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1179
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
Header file for all forward declarations for expression class templates.
Constraint on the data type.
Generic wrapper for the floor() function.
Definition: Floor.h:80
decltype(auto) exp(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1643
Header file for the EnableIf class template.
decltype(auto) abs(const DenseMatrix< MT, SO > &dm)
Applies the abs() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1152
decltype(auto) log(const DenseMatrix< MT, SO > &dm)
Computes the natural logarithm for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1733
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:1210
decltype(auto) round(const DenseMatrix< MT, SO > &dm)
Applies the round() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1297
decltype(auto) tanh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2128
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:1123
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
Header file for run time assertion macros.
Generic wrapper for the atanh() function.
Definition: Atanh.h:78
Generic wrapper for the invcbrt() function.
Definition: InvCbrt.h:66
Generic wrapper for the real() function.
Definition: Real.h:79
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
Generic wrapper for the asinh() function.
Definition: Asinh.h:78
decltype(auto) invcbrt(const DenseMatrix< MT, SO > &dm)
Computes the inverse cubic root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1549
Generic wrapper for the tan() function.
Definition: Tan.h:78
Generic wrapper for the log() function.
Definition: Log.h:68
decltype(auto) atanh(const DenseMatrix< MT, SO > &dm)
Computes the inverse hyperbolic tangent for each single element of the dense matrix dm...
Definition: DMatMapExpr.h:2160
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
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:66
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:68
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
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:80
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
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
decltype(auto) sin(const DenseMatrix< MT, SO > &dm)
Computes the sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1826
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:2218
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:1453
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:68
decltype(auto) tan(const DenseMatrix< MT, SO > &dm)
Computes the tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2067
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:78
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:138
Generic wrapper for the round() function.
Definition: Round.h:80
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:78
Header file for the map trait.
decltype(auto) log10(const DenseMatrix< MT, SO > &dm)
Computes the common logarithm for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1797
Generic wrapper for the log2() function.
Definition: Log2.h:66
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:1421
IteratorType it_
Iterator over the elements of the sparse vector expression.
Definition: SVecMapExpr.h:279
Generic wrapper for the cosh() function.
Definition: Cosh.h:68
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1326
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:1765
decltype(auto) invsqrt(const DenseMatrix< MT, SO > &dm)
Computes the inverse square root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1485
Generic wrapper for the tanh() function.
Definition: Tanh.h:78
Operation operation() const
Returns a copy of the custom operation.
Definition: SVecMapExpr.h:420
Generic wrapper for the exp() function.
Definition: Exp.h:68
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, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
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:1110