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>
63 #include <blaze/util/Assert.h>
64 #include <blaze/util/EnableIf.h>
66 #include <blaze/util/mpl/And.h>
67 #include <blaze/util/mpl/If.h>
68 #include <blaze/util/mpl/Not.h>
69 #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_<VT>;
99  using RN = ReturnType_<VT>;
100  //**********************************************************************************************
101 
102  //**Serial evaluation strategy******************************************************************
104 
110  enum : bool { useAssign = RequiresEvaluation<VT>::value };
111 
113  template< typename VT2 >
115  struct UseAssign {
116  enum : bool { value = useAssign };
117  };
119  //**********************************************************************************************
120 
121  //**Parallel evaluation strategy****************************************************************
123 
129  template< typename VT2 >
130  struct UseSMPAssign {
131  enum : bool { value = ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign };
132  };
134  //**********************************************************************************************
135 
136  public:
137  //**Type definitions****************************************************************************
142 
144  using ReturnType = decltype( std::declval<OP>()( std::declval<RN>() ) );
145 
148 
150  using Operand = If_< IsExpression<VT>, const VT, const VT& >;
151 
153  using Operation = OP;
154  //**********************************************************************************************
155 
156  //**ConstIterator class definition**************************************************************
160  {
161  public:
162  //**Type definitions*************************************************************************
165 
168 
169  using IteratorCategory = std::forward_iterator_tag;
170  using ValueType = Element;
174 
175  // STL iterator requirements
181  //*******************************************************************************************
182 
183  //**Constructor******************************************************************************
189  inline ConstIterator( IteratorType it, OP op )
190  : it_( it ) // Iterator over the elements of the sparse vector expression
191  , op_( op ) // The custom unary operation
192  {}
193  //*******************************************************************************************
194 
195  //**Prefix increment operator****************************************************************
201  ++it_;
202  return *this;
203  }
204  //*******************************************************************************************
205 
206  //**Element access operator******************************************************************
211  inline const Element operator*() const {
212  return Element( op_( it_->value() ), it_->index() );
213  }
214  //*******************************************************************************************
215 
216  //**Element access operator******************************************************************
221  inline const ConstIterator* operator->() const {
222  return this;
223  }
224  //*******************************************************************************************
225 
226  //**Value function***************************************************************************
231  inline ReturnType value() const {
232  return op_( it_->value() );
233  }
234  //*******************************************************************************************
235 
236  //**Index function***************************************************************************
241  inline size_t index() const {
242  return it_->index();
243  }
244  //*******************************************************************************************
245 
246  //**Equality operator************************************************************************
252  inline bool operator==( const ConstIterator& rhs ) const {
253  return it_ == rhs.it_;
254  }
255  //*******************************************************************************************
256 
257  //**Inequality operator**********************************************************************
263  inline bool operator!=( const ConstIterator& rhs ) const {
264  return it_ != rhs.it_;
265  }
266  //*******************************************************************************************
267 
268  //**Subtraction operator*********************************************************************
274  inline DifferenceType operator-( const ConstIterator& rhs ) const {
275  return it_ - rhs.it_;
276  }
277  //*******************************************************************************************
278 
279  private:
280  //**Member variables*************************************************************************
282  OP op_;
283  //*******************************************************************************************
284  };
285  //**********************************************************************************************
286 
287  //**Compilation flags***************************************************************************
289  enum : bool { smpAssignable = VT::smpAssignable };
290  //**********************************************************************************************
291 
292  //**Constructor*********************************************************************************
298  explicit inline SVecMapExpr( const VT& sv, OP op ) noexcept
299  : sv_( sv ) // Sparse vector of the map expression
300  , op_( op ) // The custom unary operation
301  {}
302  //**********************************************************************************************
303 
304  //**Subscript operator**************************************************************************
310  inline ReturnType operator[]( size_t index ) const {
311  BLAZE_INTERNAL_ASSERT( index < sv_.size(), "Invalid vector access index" );
312  return op_( sv_[index] );
313  }
314  //**********************************************************************************************
315 
316  //**At function*********************************************************************************
323  inline ReturnType at( size_t index ) const {
324  if( index >= sv_.size() ) {
325  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
326  }
327  return (*this)[index];
328  }
329  //**********************************************************************************************
330 
331  //**Begin function******************************************************************************
336  inline ConstIterator begin() const {
337  return ConstIterator( sv_.begin(), op_ );
338  }
339  //**********************************************************************************************
340 
341  //**End function********************************************************************************
346  inline ConstIterator end() const {
347  return ConstIterator( sv_.end(), op_ );
348  }
349  //**********************************************************************************************
350 
351  //**Size function*******************************************************************************
356  inline size_t size() const noexcept {
357  return sv_.size();
358  }
359  //**********************************************************************************************
360 
361  //**NonZeros function***************************************************************************
366  inline size_t nonZeros() const {
367  return sv_.nonZeros();
368  }
369  //**********************************************************************************************
370 
371  //**Find function*******************************************************************************
377  inline ConstIterator find( size_t index ) const {
379  return ConstIterator( sv_.find( index ), op_ );
380  }
381  //**********************************************************************************************
382 
383  //**LowerBound function*************************************************************************
389  inline ConstIterator lowerBound( size_t index ) const {
391  return ConstIterator( sv_.lowerBound( index ), op_ );
392  }
393  //**********************************************************************************************
394 
395  //**UpperBound function*************************************************************************
401  inline ConstIterator upperBound( size_t index ) const {
403  return ConstIterator( sv_.upperBound( index ), op_ );
404  }
405  //**********************************************************************************************
406 
407  //**Operand access******************************************************************************
412  inline Operand operand() const noexcept {
413  return sv_;
414  }
415  //**********************************************************************************************
416 
417  //**Operation access****************************************************************************
422  inline Operation operation() const {
423  return op_;
424  }
425  //**********************************************************************************************
426 
427  //**********************************************************************************************
433  template< typename T >
434  inline bool canAlias( const T* alias ) const noexcept {
435  return sv_.canAlias( alias );
436  }
437  //**********************************************************************************************
438 
439  //**********************************************************************************************
445  template< typename T >
446  inline bool isAliased( const T* alias ) const noexcept {
447  return sv_.isAliased( alias );
448  }
449  //**********************************************************************************************
450 
451  //**********************************************************************************************
456  inline bool canSMPAssign() const noexcept {
457  return sv_.canSMPAssign();
458  }
459  //**********************************************************************************************
460 
461  private:
462  //**Member variables****************************************************************************
465  //**********************************************************************************************
466 
467  //**Assignment to dense vectors*****************************************************************
481  template< typename VT2 > // Type of the target dense vector
482  friend inline EnableIf_< UseAssign<VT2> >
483  assign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
484  {
486 
490 
491  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
492 
493  const RT tmp( serial( rhs.sv_ ) );
494  assign( ~lhs, map( tmp, rhs.op_ ) );
495  }
497  //**********************************************************************************************
498 
499  //**Assignment to sparse vectors****************************************************************
514  template< typename VT2 > // Type of the target sparse vector
515  friend inline EnableIf_< And< UseAssign<VT2>
517  assign( SparseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
518  {
520 
521  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
522 
523  using Iterator = Iterator_<VT2>;
524 
525  assign( ~lhs, rhs.sv_ );
526 
527  const Iterator end( (~lhs).end() );
528  for( Iterator element=(~lhs).begin(); element!=end; ++element ) {
529  element->value() = rhs.op_( element->value() );
530  }
531  }
533  //**********************************************************************************************
534 
535  //**Assignment to sparse vectors****************************************************************
550  template< typename VT2 > // Type of the target sparse vector
551  friend inline EnableIf_< And< UseAssign<VT2>
553  assign( SparseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
554  {
556 
560 
561  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
562 
563  const RT tmp( serial( rhs.sv_ ) );
564  (~lhs).reserve( tmp.nonZeros() );
565  assign( ~lhs, map( tmp, rhs.op_ ) );
566  }
568  //**********************************************************************************************
569 
570  //**Addition assignment to dense vectors********************************************************
584  template< typename VT2 > // Type of the target dense vector
585  friend inline EnableIf_< UseAssign<VT2> >
586  addAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
587  {
589 
593 
594  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
595 
596  const RT tmp( serial( rhs.sv_ ) );
597  addAssign( ~lhs, map( tmp, rhs.op_ ) );
598  }
600  //**********************************************************************************************
601 
602  //**Addition assignment to sparse vectors*******************************************************
603  // No special implementation for the addition assignment to sparse vectors.
604  //**********************************************************************************************
605 
606  //**Subtraction assignment to dense vectors*****************************************************
620  template< typename VT2 > // Type of the target dense vector
621  friend inline EnableIf_< UseAssign<VT2> >
622  subAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
623  {
625 
629 
630  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
631 
632  const RT tmp( serial( rhs.sv_ ) );
633  subAssign( ~lhs, map( tmp, rhs.op_ ) );
634  }
636  //**********************************************************************************************
637 
638  //**Subtraction assignment to sparse vectors****************************************************
639  // No special implementation for the subtraction assignment to sparse vectors.
640  //**********************************************************************************************
641 
642  //**Multiplication assignment to dense vectors**************************************************
656  template< typename VT2 > // Type of the target dense vector
657  friend inline EnableIf_< UseAssign<VT2> >
658  multAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
659  {
661 
665 
666  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
667 
668  const RT tmp( serial( rhs.sv_ ) );
669  multAssign( ~lhs, map( tmp, rhs.op_ ) );
670  }
672  //**********************************************************************************************
673 
674  //**Multiplication assignment to sparse vectors*************************************************
675  // No special implementation for the multiplication assignment to sparse vectors.
676  //**********************************************************************************************
677 
678  //**SMP assignment to dense vectors*************************************************************
692  template< typename VT2 > // Type of the target dense vector
693  friend inline EnableIf_< UseSMPAssign<VT2> >
694  smpAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
695  {
697 
701 
702  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
703 
704  const RT tmp( rhs.sv_ );
705  smpAssign( ~lhs, map( tmp, rhs.op_ ) );
706  }
708  //**********************************************************************************************
709 
710  //**SMP assignment to sparse vectors************************************************************
711  // No special implementation for the SMP assignment to sparse vectors.
712  //**********************************************************************************************
713 
714  //**SMP addition assignment to dense vectors****************************************************
728  template< typename VT2 > // Type of the target dense vector
729  friend inline EnableIf_< UseSMPAssign<VT2> >
730  smpAddAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
731  {
733 
737 
738  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
739 
740  const RT tmp( rhs.sv_ );
741  smpAddAssign( ~lhs, map( tmp, rhs.op_ ) );
742  }
744  //**********************************************************************************************
745 
746  //**SMP addition assignment to sparse vectors***************************************************
747  // No special implementation for the SMP addition assignment to sparse vectors.
748  //**********************************************************************************************
749 
750  //**SMP subtraction assignment to dense vectors*************************************************
764  template< typename VT2 > // Type of the target dense vector
765  friend inline EnableIf_< UseSMPAssign<VT2> >
766  smpSubAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
767  {
769 
773 
774  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
775 
776  const RT tmp( rhs.sv_ );
777  smpSubAssign( ~lhs, map( tmp, rhs.op_ ) );
778  }
780  //**********************************************************************************************
781 
782  //**SMP subtraction assignment to sparse vectors************************************************
783  // No special implementation for the SMP subtraction assignment to sparse vectors.
784  //**********************************************************************************************
785 
786  //**SMP multiplication assignment to dense vectors**********************************************
800  template< typename VT2 > // Type of the target dense vector
801  friend inline EnableIf_< UseSMPAssign<VT2> >
802  smpMultAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
803  {
805 
809 
810  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
811 
812  const RT tmp( rhs.sv_ );
813  smpMultAssign( ~lhs, map( tmp, rhs.op_ ) );
814  }
816  //**********************************************************************************************
817 
818  //**SMP multiplication assignment to sparse vectors*********************************************
819  // No special implementation for the SMP multiplication assignment to sparse vectors.
820  //**********************************************************************************************
821 
822  //**Compile time checks*************************************************************************
827  //**********************************************************************************************
828 };
829 //*************************************************************************************************
830 
831 
832 
833 
834 //=================================================================================================
835 //
836 // GLOBAL FUNCTIONS
837 //
838 //=================================================================================================
839 
840 //*************************************************************************************************
858 template< typename VT // Type of the sparse vector
859  , bool TF // Transpose flag
860  , typename OP > // Type of the custom operation
861 inline decltype(auto) map( const SparseVector<VT,TF>& sv, OP op )
862 {
864 
865  using ReturnType = const SVecMapExpr<VT,OP,TF>;
866  return ReturnType( ~sv, op );
867 }
868 //*************************************************************************************************
869 
870 
871 //*************************************************************************************************
889 template< typename VT // Type of the sparse vector
890  , bool TF // Transpose flag
891  , typename OP > // Type of the custom operation
892 inline decltype(auto) forEach( const SparseVector<VT,TF>& sv, OP op )
893 {
895 
896  using ReturnType = const SVecMapExpr<VT,OP,TF>;
897  return ReturnType( ~sv, op );
898 }
899 //*************************************************************************************************
900 
901 
902 //*************************************************************************************************
919 template< typename VT // Type of the sparse vector
920  , bool TF > // Transpose flag
921 inline decltype(auto) abs( const SparseVector<VT,TF>& sv )
922 {
924 
925  using ReturnType = const SVecMapExpr<VT,Abs,TF>;
926  return ReturnType( ~sv, Abs() );
927 }
928 //*************************************************************************************************
929 
930 
931 //*************************************************************************************************
948 template< typename VT // Type of the sparse vector
949  , bool TF > // Transpose flag
950 inline decltype(auto) floor( const SparseVector<VT,TF>& sv )
951 {
953 
954  using ReturnType = const SVecMapExpr<VT,Floor,TF>;
955  return ReturnType( ~sv, Floor() );
956 }
957 //*************************************************************************************************
958 
959 
960 //*************************************************************************************************
977 template< typename VT // Type of the sparse vector
978  , bool TF > // Transpose flag
979 inline decltype(auto) ceil( const SparseVector<VT,TF>& sv )
980 {
982 
983  using ReturnType = const SVecMapExpr<VT,Ceil,TF>;
984  return ReturnType( ~sv, Ceil() );
985 }
986 //*************************************************************************************************
987 
988 
989 //*************************************************************************************************
1006 template< typename VT // Type of the sparse vector
1007  , bool TF > // Transpose flag
1008 inline decltype(auto) trunc( const SparseVector<VT,TF>& sv )
1009 {
1011 
1012  using ReturnType = const SVecMapExpr<VT,Trunc,TF>;
1013  return ReturnType( ~sv, Trunc() );
1014 }
1015 //*************************************************************************************************
1016 
1017 
1018 //*************************************************************************************************
1035 template< typename VT // Type of the sparse vector
1036  , bool TF > // Transpose flag
1037 inline decltype(auto) round( const SparseVector<VT,TF>& sv )
1038 {
1040 
1041  using ReturnType = const SVecMapExpr<VT,Round,TF>;
1042  return ReturnType( ~sv, Round() );
1043 }
1044 //*************************************************************************************************
1045 
1046 
1047 //*************************************************************************************************
1064 template< typename VT // Type of the sparse vector
1065  , bool TF > // Transpose flag
1066 inline decltype(auto) conj( const SparseVector<VT,TF>& sv )
1067 {
1069 
1070  using ReturnType = const SVecMapExpr<VT,Conj,TF>;
1071  return ReturnType( ~sv, Conj() );
1072 }
1073 //*************************************************************************************************
1074 
1075 
1076 //*************************************************************************************************
1102 template< typename VT // Type of the sparse vector
1103  , bool TF > // Transpose flag
1104 inline decltype(auto) ctrans( const SparseVector<VT,TF>& sv )
1105 {
1107 
1108  return trans( conj( ~sv ) );
1109 }
1110 //*************************************************************************************************
1111 
1112 
1113 //*************************************************************************************************
1130 template< typename VT // Type of the sparse vector
1131  , bool TF > // Transpose flag
1132 inline decltype(auto) real( const SparseVector<VT,TF>& sv )
1133 {
1135 
1136  using ReturnType = const SVecMapExpr<VT,Real,TF>;
1137  return ReturnType( ~sv, Real() );
1138 }
1139 //*************************************************************************************************
1140 
1141 
1142 //*************************************************************************************************
1159 template< typename VT // Type of the sparse vector
1160  , bool TF > // Transpose flag
1161 inline decltype(auto) imag( const SparseVector<VT,TF>& sv )
1162 {
1164 
1165  using ReturnType = const SVecMapExpr<VT,Imag,TF>;
1166  return ReturnType( ~sv, Imag() );
1167 }
1168 //*************************************************************************************************
1169 
1170 
1171 //*************************************************************************************************
1191 template< typename VT // Type of the sparse vector
1192  , bool TF > // Transpose flag
1193 inline decltype(auto) sqrt( const SparseVector<VT,TF>& sv )
1194 {
1196 
1197  using ReturnType = const SVecMapExpr<VT,Sqrt,TF>;
1198  return ReturnType( ~sv, Sqrt() );
1199 }
1200 //*************************************************************************************************
1201 
1202 
1203 //*************************************************************************************************
1223 template< typename VT // Type of the sparse vector
1224  , bool TF > // Transpose flag
1225 inline decltype(auto) invsqrt( const SparseVector<VT,TF>& sv )
1226 {
1228 
1229  using ReturnType = const SVecMapExpr<VT,InvSqrt,TF>;
1230  return ReturnType( ~sv, InvSqrt() );
1231 }
1232 //*************************************************************************************************
1233 
1234 
1235 //*************************************************************************************************
1255 template< typename VT // Type of the sparse vector
1256  , bool TF > // Transpose flag
1257 inline decltype(auto) cbrt( const SparseVector<VT,TF>& sv )
1258 {
1260 
1261  using ReturnType = const SVecMapExpr<VT,Cbrt,TF>;
1262  return ReturnType( ~sv, Cbrt() );
1263 }
1264 //*************************************************************************************************
1265 
1266 
1267 //*************************************************************************************************
1287 template< typename VT // Type of the sparse vector
1288  , bool TF > // Transpose flag
1289 inline decltype(auto) invcbrt( const SparseVector<VT,TF>& sv )
1290 {
1292 
1293  using ReturnType = const SVecMapExpr<VT,InvCbrt,TF>;
1294  return ReturnType( ~sv, InvCbrt() );
1295 }
1296 //*************************************************************************************************
1297 
1298 
1299 //*************************************************************************************************
1318 template< typename VT // Type of the sparse vector
1319  , bool TF // Transpose flag
1320  , typename DT > // Type of the delimiters
1321 inline decltype(auto) clamp( const SparseVector<VT,TF>& sv, const DT& min, const DT& max )
1322 {
1324 
1325  using ReturnType = const SVecMapExpr<VT,Clamp<DT>,TF>;
1326  return ReturnType( ~sv, Clamp<DT>( min, max ) );
1327 }
1328 //*************************************************************************************************
1329 
1330 
1331 //*************************************************************************************************
1349 template< typename VT // Type of the sparse vector
1350  , bool TF // Transpose flag
1351  , typename ET > // Type of the exponent
1352 inline decltype(auto) pow( const SparseVector<VT,TF>& sv, ET exp )
1353 {
1355 
1357 
1358  using ReturnType = const SVecMapExpr<VT,Pow<ET>,TF>;
1359  return ReturnType( ~sv, Pow<ET>( exp ) );
1360 }
1361 //*************************************************************************************************
1362 
1363 
1364 //*************************************************************************************************
1381 template< typename VT // Type of the sparse vector
1382  , bool TF > // Transpose flag
1383 inline decltype(auto) exp( const SparseVector<VT,TF>& sv )
1384 {
1386 
1387  using ReturnType = const SVecMapExpr<VT,Exp,TF>;
1388  return ReturnType( ~sv, Exp() );
1389 }
1390 //*************************************************************************************************
1391 
1392 
1393 //*************************************************************************************************
1410 template< typename VT // Type of the sparse vector
1411  , bool TF > // Transpose flag
1412 inline decltype(auto) exp2( const SparseVector<VT,TF>& sv )
1413 {
1415 
1416  using ReturnType = const SVecMapExpr<VT,Exp2,TF>;
1417  return ReturnType( ~sv, Exp2() );
1418 }
1419 //*************************************************************************************************
1420 
1421 
1422 //*************************************************************************************************
1439 template< typename VT // Type of the sparse vector
1440  , bool TF > // Transpose flag
1441 inline decltype(auto) exp10( const SparseVector<VT,TF>& sv )
1442 {
1444 
1445  using ReturnType = const SVecMapExpr<VT,Exp10,TF>;
1446  return ReturnType( ~sv, Exp10() );
1447 }
1448 //*************************************************************************************************
1449 
1450 
1451 //*************************************************************************************************
1471 template< typename VT // Type of the sparse vector
1472  , bool TF > // Transpose flag
1473 inline decltype(auto) log( const SparseVector<VT,TF>& sv )
1474 {
1476 
1477  using ReturnType = const SVecMapExpr<VT,Log,TF>;
1478  return ReturnType( ~sv, Log() );
1479 }
1480 //*************************************************************************************************
1481 
1482 
1483 //*************************************************************************************************
1503 template< typename VT // Type of the sparse vector
1504  , bool TF > // Transpose flag
1505 inline decltype(auto) log2( const SparseVector<VT,TF>& sv )
1506 {
1508 
1509  using ReturnType = const SVecMapExpr<VT,Log2,TF>;
1510  return ReturnType( ~sv, Log2() );
1511 }
1512 //*************************************************************************************************
1513 
1514 
1515 //*************************************************************************************************
1535 template< typename VT // Type of the sparse vector
1536  , bool TF > // Transpose flag
1537 inline decltype(auto) log10( const SparseVector<VT,TF>& sv )
1538 {
1540 
1541  using ReturnType = const SVecMapExpr<VT,Log10,TF>;
1542  return ReturnType( ~sv, Log10() );
1543 }
1544 //*************************************************************************************************
1545 
1546 
1547 //*************************************************************************************************
1564 template< typename VT // Type of the sparse vector
1565  , bool TF > // Transpose flag
1566 inline decltype(auto) sin( const SparseVector<VT,TF>& sv )
1567 {
1569 
1570  using ReturnType = const SVecMapExpr<VT,Sin,TF>;
1571  return ReturnType( ~sv, Sin() );
1572 }
1573 //*************************************************************************************************
1574 
1575 
1576 //*************************************************************************************************
1596 template< typename VT // Type of the sparse vector
1597  , bool TF > // Transpose flag
1598 inline decltype(auto) asin( const SparseVector<VT,TF>& sv )
1599 {
1601 
1602  using ReturnType = const SVecMapExpr<VT,Asin,TF>;
1603  return ReturnType( ~sv, Asin() );
1604 }
1605 //*************************************************************************************************
1606 
1607 
1608 //*************************************************************************************************
1625 template< typename VT // Type of the sparse vector
1626  , bool TF > // Transpose flag
1627 inline decltype(auto) sinh( const SparseVector<VT,TF>& sv )
1628 {
1630 
1631  using ReturnType = const SVecMapExpr<VT,Sinh,TF>;
1632  return ReturnType( ~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  using ReturnType = const SVecMapExpr<VT,Asinh,TF>;
1661  return ReturnType( ~sv, Asinh() );
1662 }
1663 //*************************************************************************************************
1664 
1665 
1666 //*************************************************************************************************
1683 template< typename VT // Type of the sparse vector
1684  , bool TF > // Transpose flag
1685 inline decltype(auto) cos( const SparseVector<VT,TF>& sv )
1686 {
1688 
1689  using ReturnType = const SVecMapExpr<VT,Cos,TF>;
1690  return ReturnType( ~sv, Cos() );
1691 }
1692 //*************************************************************************************************
1693 
1694 
1695 //*************************************************************************************************
1715 template< typename VT // Type of the sparse vector
1716  , bool TF > // Transpose flag
1717 inline decltype(auto) acos( const SparseVector<VT,TF>& sv )
1718 {
1720 
1721  using ReturnType = const SVecMapExpr<VT,Acos,TF>;
1722  return ReturnType( ~sv, Acos() );
1723 }
1724 //*************************************************************************************************
1725 
1726 
1727 //*************************************************************************************************
1744 template< typename VT // Type of the sparse vector
1745  , bool TF > // Transpose flag
1746 inline decltype(auto) cosh( const SparseVector<VT,TF>& sv )
1747 {
1749 
1750  using ReturnType = const SVecMapExpr<VT,Cosh,TF>;
1751  return ReturnType( ~sv, Cosh() );
1752 }
1753 //*************************************************************************************************
1754 
1755 
1756 //*************************************************************************************************
1776 template< typename VT // Type of the sparse vector
1777  , bool TF > // Transpose flag
1778 inline decltype(auto) acosh( const SparseVector<VT,TF>& sv )
1779 {
1781 
1782  using ReturnType = const SVecMapExpr<VT,Acosh,TF>;
1783  return ReturnType( ~sv, Acosh() );
1784 }
1785 //*************************************************************************************************
1786 
1787 
1788 //*************************************************************************************************
1805 template< typename VT // Type of the sparse vector
1806  , bool TF > // Transpose flag
1807 inline decltype(auto) tan( const SparseVector<VT,TF>& sv )
1808 {
1810 
1811  using ReturnType = const SVecMapExpr<VT,Tan,TF>;
1812  return ReturnType( ~sv, Tan() );
1813 }
1814 //*************************************************************************************************
1815 
1816 
1817 //*************************************************************************************************
1834 template< typename VT // Type of the sparse vector
1835  , bool TF > // Transpose flag
1836 inline decltype(auto) atan( const SparseVector<VT,TF>& sv )
1837 {
1839 
1840  using ReturnType = const SVecMapExpr<VT,Atan,TF>;
1841  return ReturnType( ~sv, Atan() );
1842 }
1843 //*************************************************************************************************
1844 
1845 
1846 //*************************************************************************************************
1866 template< typename VT // Type of the sparse vector
1867  , bool TF > // Transpose flag
1868 inline decltype(auto) tanh( const SparseVector<VT,TF>& sv )
1869 {
1871 
1872  using ReturnType = const SVecMapExpr<VT,Tanh,TF>;
1873  return ReturnType( ~sv, Tanh() );
1874 }
1875 //*************************************************************************************************
1876 
1877 
1878 //*************************************************************************************************
1898 template< typename VT // Type of the sparse vector
1899  , bool TF > // Transpose flag
1900 inline decltype(auto) atanh( const SparseVector<VT,TF>& sv )
1901 {
1903 
1904  using ReturnType = const SVecMapExpr<VT,Atanh,TF>;
1905  return ReturnType( ~sv, Atanh() );
1906 }
1907 //*************************************************************************************************
1908 
1909 
1910 //*************************************************************************************************
1927 template< typename VT // Type of the sparse vector
1928  , bool TF > // Transpose flag
1929 inline decltype(auto) erf( const SparseVector<VT,TF>& sv )
1930 {
1932 
1933  using ReturnType = const SVecMapExpr<VT,Erf,TF>;
1934  return ReturnType( ~sv, Erf() );
1935 }
1936 //*************************************************************************************************
1937 
1938 
1939 //*************************************************************************************************
1956 template< typename VT // Type of the sparse vector
1957  , bool TF > // Transpose flag
1958 inline decltype(auto) erfc( const SparseVector<VT,TF>& sv )
1959 {
1961 
1962  using ReturnType = const SVecMapExpr<VT,Erfc,TF>;
1963  return ReturnType( ~sv, Erfc() );
1964 }
1965 //*************************************************************************************************
1966 
1967 
1968 
1969 
1970 //=================================================================================================
1971 //
1972 // GLOBAL RESTRUCTURING FUNCTIONS
1973 //
1974 //=================================================================================================
1975 
1976 //*************************************************************************************************
1987 template< typename VT // Type of the sparse vector
1988  , bool TF > // Transpose flag
1989 inline decltype(auto) abs( const SVecMapExpr<VT,Abs,TF>& sv )
1990 {
1992 
1993  return sv;
1994 }
1996 //*************************************************************************************************
1997 
1998 
1999 //*************************************************************************************************
2010 template< typename VT // Type of the sparse vector
2011  , bool TF > // Transpose flag
2012 inline decltype(auto) floor( const SVecMapExpr<VT,Floor,TF>& sv )
2013 {
2015 
2016  return sv;
2017 }
2019 //*************************************************************************************************
2020 
2021 
2022 //*************************************************************************************************
2033 template< typename VT // Type of the sparse vector
2034  , bool TF > // Transpose flag
2035 inline decltype(auto) ceil( const SVecMapExpr<VT,Ceil,TF>& sv )
2036 {
2038 
2039  return sv;
2040 }
2042 //*************************************************************************************************
2043 
2044 
2045 //*************************************************************************************************
2056 template< typename VT // Type of the sparse vector
2057  , bool TF > // Transpose flag
2058 inline decltype(auto) trunc( const SVecMapExpr<VT,Trunc,TF>& sv )
2059 {
2061 
2062  return sv;
2063 }
2065 //*************************************************************************************************
2066 
2067 
2068 //*************************************************************************************************
2079 template< typename VT // Type of the sparse vector
2080  , bool TF > // Transpose flag
2081 inline decltype(auto) round( const SVecMapExpr<VT,Round,TF>& sv )
2082 {
2084 
2085  return sv;
2086 }
2088 //*************************************************************************************************
2089 
2090 
2091 //*************************************************************************************************
2109 template< typename VT // Type of the sparse vector
2110  , bool TF > // Transpose flag
2111 inline decltype(auto) conj( const SVecMapExpr<VT,Conj,TF>& sv )
2112 {
2114 
2115  return sv.operand();
2116 }
2118 //*************************************************************************************************
2119 
2120 
2121 //*************************************************************************************************
2139 template< typename VT // Type of the sparse vector
2140  , bool TF > // Transpose flag
2141 inline decltype(auto) conj( const SVecTransExpr<SVecMapExpr<VT,Conj,TF>,!TF>& sv )
2142 {
2144 
2145  using ReturnType = const SVecTransExpr<VT,!TF>;
2146  return ReturnType( sv.operand().operand() );
2147 }
2149 //*************************************************************************************************
2150 
2151 
2152 //*************************************************************************************************
2163 template< typename VT // Type of the sparse vector
2164  , bool TF > // Transpose flag
2165 inline decltype(auto) real( const SVecMapExpr<VT,Real,TF>& sv )
2166 {
2168 
2169  return sv;
2170 }
2172 //*************************************************************************************************
2173 
2174 
2175 
2176 
2177 //=================================================================================================
2178 //
2179 // SIZE SPECIALIZATIONS
2180 //
2181 //=================================================================================================
2182 
2183 //*************************************************************************************************
2185 template< typename VT, typename OP, bool TF >
2186 struct Size< SVecMapExpr<VT,OP,TF> >
2187  : public Size<VT>
2188 {};
2190 //*************************************************************************************************
2191 
2192 } // namespace blaze
2193 
2194 #endif
Header file for the UnderlyingNumeric type trait.
Generic wrapper for the trunc() function.
Definition: Trunc.h:62
ConstIterator(IteratorType it, OP op)
Constructor for the ConstIterator class.
Definition: SVecMapExpr.h:189
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:2033
ConstIterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition: SVecMapExpr.h:401
Header file for auxiliary alias declarations.
Generic wrapper for the ceil() function.
Definition: Ceil.h:62
decltype(auto) exp10(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1696
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SVecMapExpr.h:456
Generic wrapper for the cbrt() function.
Definition: Cbrt.h:62
Header file for basic type definitions.
Header file for the SparseVector base class.
Generic wrapper for the sin() function.
Definition: Sin.h:62
Generic wrapper for the conj() function.
Definition: Conj.h:62
Generic wrapper for the invsqrt() function.
Definition: InvSqrt.h:62
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:164
Header file for the serial shim.
ReturnType_< VT > RN
Return type of the sparse vector expression.
Definition: SVecMapExpr.h:99
decltype(auto) real(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the real part of each single element of dm.
Definition: DMatMapExpr.h:1387
Header file for the IsSame and IsStrictlySame type traits.
decltype(auto) ceil(const DenseMatrix< MT, SO > &dm)
Applies the ceil() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1234
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:231
Header file for the VecMapExpr base class.
Generic wrapper for the acosh() function.
Definition: Acosh.h:62
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:1576
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecMapExpr.h:323
Header file for the And class template.
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1762
Expression object for sparse vector transpositions.The SVecTransExpr class represents the compile tim...
Definition: Forward.h:146
Header file for the Computation base class.
Type relationship analysis.This class tests if the two data types A and B are equal. For this type comparison, the cv-qualifiers of both data types are ignored. If A and B are the same data type (ignoring the cv-qualifiers), then the value member constant is set to true, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to false, Type is FalseType, and the class derives from FalseType.
Definition: IsSame.h:140
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3086
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SVecMapExpr.h:263
UnaryMapTrait_< RT, OP > ResultType
Result type for expression template evaluations.
Definition: SVecMapExpr.h:139
Header file for the RequiresEvaluation type trait.
Iterator over the elements of the sparse vector map expression.
Definition: SVecMapExpr.h:159
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1809
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SVecMapExpr.h:434
decltype(auto) acos(const DenseMatrix< MT, SO > &dm)
Computes the inverse cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1972
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:133
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SVecMapExpr.h:446
decltype(auto) erf(const DenseMatrix< MT, SO > &dm)
Computes the error function for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2184
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:363
const ConstIterator * operator->() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecMapExpr.h:221
Generic wrapper for the abs() function.
Definition: Abs.h:62
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:72
Operation op_
The custom unary operation.
Definition: SVecMapExpr.h:464
ConstIterator_< RemoveReference_< Operand > > IteratorType
Iterator type of the sparse vector expression.
Definition: SVecMapExpr.h:167
If_< IsExpression< VT >, const VT, const VT &> Operand
Composite data type of the sparse vector expression.
Definition: SVecMapExpr.h:150
Generic wrapper for the sqrt() function.
Definition: Sqrt.h:62
Header file for the ValueIndexPair class.
IteratorCategory iterator_category
The iterator category.
Definition: SVecMapExpr.h:176
Header file for the unary map trait.
ResultType_< VT > RT
Result type of the sparse vector expression.
Definition: SVecMapExpr.h:98
decltype(auto) cos(const DenseMatrix< MT, SO > &dm)
Computes the cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1940
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
decltype(auto) ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatMapExpr.h:1359
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SVecMapExpr.h:356
Header file for the If class template.
Generic wrapper for the imag() function.
Definition: Imag.h:59
Generic wrapper for the exp10() function.
Definition: Exp10.h:62
decltype(auto) exp2(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1667
decltype(auto) sinh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1882
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SVecMapExpr.h:274
const Element operator*() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecMapExpr.h:211
decltype(auto) asin(const DenseMatrix< MT, SO > &dm)
Computes the inverse sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1853
decltype(auto) cosh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2001
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:102
ConstIterator & operator++()
Pre-increment operator.
Definition: SVecMapExpr.h:200
decltype(auto) cbrt(const DenseMatrix< MT, SO > &dm)
Computes the cubic root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1512
#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:153
Generic wrapper for the log10() function.
Definition: Log10.h:62
decltype(auto) trunc(const DenseMatrix< MT, SO > &dm)
Applies the trunc() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1263
Header file for the Not class template.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
Header file for all functors.
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
#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:62
Generic wrapper for the asin() function.
Definition: Asin.h:62
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:2091
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:1911
Generic wrapper for the erf() function.
Definition: Erf.h:62
Expression object for the sparse vector map() function.The SVecMapExpr class represents the compile t...
Definition: Forward.h:137
Header file for the exception macros of the math module.
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SVecMapExpr.h:252
Constraint on the data type.
Evaluation of the underlying numeric element type of a given data type.Via this type trait it is poss...
Definition: UnderlyingNumeric.h:81
ConstIterator find(size_t index) const
Searches for a specific vector element.
Definition: SVecMapExpr.h:377
Header file for all forward declarations for expression class templates.
Constraint on the data type.
Generic wrapper for the floor() function.
Definition: Floor.h:62
decltype(auto) exp(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1638
ElementType_< ResultType > ElementType
Resulting element type.
Definition: SVecMapExpr.h:141
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:1176
decltype(auto) log(const DenseMatrix< MT, SO > &dm)
Computes the natural logarithm for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1728
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SVecMapExpr.h:169
decltype(auto) floor(const DenseMatrix< MT, SO > &dm)
Applies the floor() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1205
decltype(auto) pow(const DenseMatrix< MT, SO > &dm, ET exp)
Computes the exponential value for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1607
decltype(auto) round(const DenseMatrix< MT, SO > &dm)
Applies the round() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1292
decltype(auto) tanh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2123
size_t index() const
Access to the current index of the sparse element.
Definition: SVecMapExpr.h:241
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:1147
Header file for run time assertion macros.
Generic wrapper for the pow() function.
Definition: Forward.h:84
Generic wrapper for the atanh() function.
Definition: Atanh.h:62
Generic wrapper for the invcbrt() function.
Definition: InvCbrt.h:62
Generic wrapper for the real() function.
Definition: Real.h:59
Generic wrapper for the asinh() function.
Definition: Asinh.h:62
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:1544
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:154
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
Generic wrapper for the tan() function.
Definition: Tan.h:62
Generic wrapper for the log() function.
Definition: Log.h:62
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:2155
ConstIterator begin() const
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecMapExpr.h:336
#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
Compile time type negation.The Not alias declaration negates the given compile time condition...
Definition: Not.h:70
OP op_
The custom unary operation.
Definition: SVecMapExpr.h:282
Generic wrapper for the erfc() function.
Definition: Erfc.h:62
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:819
ConstIterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition: SVecMapExpr.h:389
Generic wrapper for the cos() function.
Definition: Cos.h:62
#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:412
Header file for the RemoveReference type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
typename T::Iterator Iterator_
Alias declaration for nested Iterator type definitions.The Iterator_ alias declaration provides a con...
Definition: Aliases.h:183
ConstIterator end() const
Returns an iterator just past the last non-zero element of the sparse vector.
Definition: SVecMapExpr.h:346
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3082
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:790
decltype(auto) sin(const DenseMatrix< MT, SO > &dm)
Computes the sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1821
SVecMapExpr(const VT &sv, OP op) noexcept
Constructor for the SVecMapExpr class.
Definition: SVecMapExpr.h:298
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:2213
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:73
typename UnaryMapTrait< T, OP >::Type UnaryMapTrait_
Auxiliary alias declaration for the UnaryMapTrait class template.The UnaryMapTrait_ alias declaration...
Definition: UnaryMapTrait.h:156
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.
Generic wrapper for the acos() function.
Definition: Acos.h:62
decltype(auto) tan(const DenseMatrix< MT, SO > &dm)
Computes the tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2062
size_t nonZeros() const
Returns the number of non-zero elements in the sparse vector.
Definition: SVecMapExpr.h:366
Compile time evaluation of the size of a vector.The Size type trait evaluates the size of the given v...
Definition: Size.h:74
Generic wrapper for the atan() function.
Definition: Atan.h:62
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:130
Generic wrapper for the round() function.
Definition: Round.h:62
decltype(std::declval< OP >()(std::declval< RN >())) ReturnType
Return type for expression template evaluations.
Definition: SVecMapExpr.h:144
Generic wrapper for the sinh() function.
Definition: Sinh.h:62
decltype(auto) log10(const DenseMatrix< MT, SO > &dm)
Computes the common logarithm for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1792
Generic wrapper for the log2() function.
Definition: Log2.h:62
IfTrue_< useAssign, const ResultType, const SVecMapExpr &> CompositeType
Data type for composite expression templates.
Definition: SVecMapExpr.h:147
Operand sv_
Sparse vector of the map expression.
Definition: SVecMapExpr.h:463
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SVecMapExpr.h:140
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:423
decltype(auto) imag(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the imaginary part of each single element of dm.
Definition: DMatMapExpr.h:1416
IteratorType it_
Iterator over the elements of the sparse vector expression.
Definition: SVecMapExpr.h:281
Generic wrapper for the cosh() function.
Definition: Cosh.h:62
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1321
decltype(auto) log2(const DenseMatrix< MT, SO > &dm)
Computes the binary logarithm for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1760
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:1480
Generic wrapper for the tanh() function.
Definition: Tanh.h:62
Operation operation() const
Returns a copy of the custom operation.
Definition: SVecMapExpr.h:422
Generic wrapper for the exp() function.
Definition: Exp.h:62
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecMapExpr.h:310
Header file for the Size type trait.
#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
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:1133