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>
65 #include <blaze/util/Assert.h>
66 #include <blaze/util/EnableIf.h>
68 #include <blaze/util/mpl/And.h>
69 #include <blaze/util/mpl/If.h>
70 #include <blaze/util/mpl/Not.h>
71 #include <blaze/util/Types.h>
75 
76 
77 namespace blaze {
78 
79 //=================================================================================================
80 //
81 // CLASS SVECMAPEXPR
82 //
83 //=================================================================================================
84 
85 //*************************************************************************************************
92 template< typename VT // Type of the sparse vector
93  , typename OP // Type of the custom operation
94  , bool TF > // Transpose flag
95 class SVecMapExpr
96  : public VecMapExpr< SparseVector< SVecMapExpr<VT,OP,TF>, TF > >
97  , private Computation
98 {
99  private:
100  //**Type definitions****************************************************************************
101  using RT = ResultType_<VT>;
102  using RN = ReturnType_<VT>;
103  //**********************************************************************************************
104 
105  //**Serial evaluation strategy******************************************************************
107 
113  enum : bool { useAssign = RequiresEvaluation<VT>::value };
114 
116  template< typename VT2 >
118  struct UseAssign {
119  enum : bool { value = useAssign };
120  };
122  //**********************************************************************************************
123 
124  //**Parallel evaluation strategy****************************************************************
126 
132  template< typename VT2 >
133  struct UseSMPAssign {
134  enum : bool { value = ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign };
135  };
137  //**********************************************************************************************
138 
139  public:
140  //**Type definitions****************************************************************************
145 
147  using ReturnType = decltype( std::declval<OP>()( std::declval<RN>() ) );
148 
151 
153  using Operand = If_< IsExpression<VT>, const VT, const VT& >;
154 
156  using Operation = OP;
157  //**********************************************************************************************
158 
159  //**ConstIterator class definition**************************************************************
163  {
164  public:
165  //**Type definitions*************************************************************************
168 
171 
172  using IteratorCategory = std::forward_iterator_tag;
173  using ValueType = Element;
177 
178  // STL iterator requirements
184  //*******************************************************************************************
185 
186  //**Constructor******************************************************************************
192  inline ConstIterator( IteratorType it, OP op )
193  : it_( it ) // Iterator over the elements of the sparse vector expression
194  , op_( op ) // The custom unary operation
195  {}
196  //*******************************************************************************************
197 
198  //**Prefix increment operator****************************************************************
204  ++it_;
205  return *this;
206  }
207  //*******************************************************************************************
208 
209  //**Element access operator******************************************************************
214  inline const Element operator*() const {
215  return Element( op_( it_->value() ), it_->index() );
216  }
217  //*******************************************************************************************
218 
219  //**Element access operator******************************************************************
224  inline const ConstIterator* operator->() const {
225  return this;
226  }
227  //*******************************************************************************************
228 
229  //**Value function***************************************************************************
234  inline ReturnType value() const {
235  return op_( it_->value() );
236  }
237  //*******************************************************************************************
238 
239  //**Index function***************************************************************************
244  inline size_t index() const {
245  return it_->index();
246  }
247  //*******************************************************************************************
248 
249  //**Equality operator************************************************************************
255  inline bool operator==( const ConstIterator& rhs ) const {
256  return it_ == rhs.it_;
257  }
258  //*******************************************************************************************
259 
260  //**Inequality operator**********************************************************************
266  inline bool operator!=( const ConstIterator& rhs ) const {
267  return it_ != rhs.it_;
268  }
269  //*******************************************************************************************
270 
271  //**Subtraction operator*********************************************************************
277  inline DifferenceType operator-( const ConstIterator& rhs ) const {
278  return it_ - rhs.it_;
279  }
280  //*******************************************************************************************
281 
282  private:
283  //**Member variables*************************************************************************
285  OP op_;
286  //*******************************************************************************************
287  };
288  //**********************************************************************************************
289 
290  //**Compilation flags***************************************************************************
292  enum : bool { smpAssignable = VT::smpAssignable };
293  //**********************************************************************************************
294 
295  //**Constructor*********************************************************************************
301  explicit inline SVecMapExpr( const VT& sv, OP op ) noexcept
302  : sv_( sv ) // Sparse vector of the map expression
303  , op_( op ) // The custom unary operation
304  {}
305  //**********************************************************************************************
306 
307  //**Subscript operator**************************************************************************
313  inline ReturnType operator[]( size_t index ) const {
314  BLAZE_INTERNAL_ASSERT( index < sv_.size(), "Invalid vector access index" );
315  return op_( sv_[index] );
316  }
317  //**********************************************************************************************
318 
319  //**At function*********************************************************************************
326  inline ReturnType at( size_t index ) const {
327  if( index >= sv_.size() ) {
328  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
329  }
330  return (*this)[index];
331  }
332  //**********************************************************************************************
333 
334  //**Begin function******************************************************************************
339  inline ConstIterator begin() const {
340  return ConstIterator( sv_.begin(), op_ );
341  }
342  //**********************************************************************************************
343 
344  //**End function********************************************************************************
349  inline ConstIterator end() const {
350  return ConstIterator( sv_.end(), op_ );
351  }
352  //**********************************************************************************************
353 
354  //**Size function*******************************************************************************
359  inline size_t size() const noexcept {
360  return sv_.size();
361  }
362  //**********************************************************************************************
363 
364  //**NonZeros function***************************************************************************
369  inline size_t nonZeros() const {
370  return sv_.nonZeros();
371  }
372  //**********************************************************************************************
373 
374  //**Find function*******************************************************************************
380  inline ConstIterator find( size_t index ) const {
382  return ConstIterator( sv_.find( index ), op_ );
383  }
384  //**********************************************************************************************
385 
386  //**LowerBound function*************************************************************************
392  inline ConstIterator lowerBound( size_t index ) const {
394  return ConstIterator( sv_.lowerBound( index ), op_ );
395  }
396  //**********************************************************************************************
397 
398  //**UpperBound function*************************************************************************
404  inline ConstIterator upperBound( size_t index ) const {
406  return ConstIterator( sv_.upperBound( index ), op_ );
407  }
408  //**********************************************************************************************
409 
410  //**Operand access******************************************************************************
415  inline Operand operand() const noexcept {
416  return sv_;
417  }
418  //**********************************************************************************************
419 
420  //**Operation access****************************************************************************
425  inline Operation operation() const {
426  return op_;
427  }
428  //**********************************************************************************************
429 
430  //**********************************************************************************************
436  template< typename T >
437  inline bool canAlias( const T* alias ) const noexcept {
438  return sv_.canAlias( alias );
439  }
440  //**********************************************************************************************
441 
442  //**********************************************************************************************
448  template< typename T >
449  inline bool isAliased( const T* alias ) const noexcept {
450  return sv_.isAliased( alias );
451  }
452  //**********************************************************************************************
453 
454  //**********************************************************************************************
459  inline bool canSMPAssign() const noexcept {
460  return sv_.canSMPAssign();
461  }
462  //**********************************************************************************************
463 
464  private:
465  //**Member variables****************************************************************************
468  //**********************************************************************************************
469 
470  //**Assignment to dense vectors*****************************************************************
484  template< typename VT2 > // Type of the target dense vector
485  friend inline EnableIf_< UseAssign<VT2> >
486  assign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
487  {
489 
493 
494  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
495 
496  const RT tmp( serial( rhs.sv_ ) );
497  assign( ~lhs, map( tmp, rhs.op_ ) );
498  }
500  //**********************************************************************************************
501 
502  //**Assignment to sparse vectors****************************************************************
517  template< typename VT2 > // Type of the target sparse vector
518  friend inline EnableIf_< And< UseAssign<VT2>
520  assign( SparseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
521  {
523 
524  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
525 
526  using Iterator = Iterator_<VT2>;
527 
528  assign( ~lhs, rhs.sv_ );
529 
530  const Iterator end( (~lhs).end() );
531  for( Iterator element=(~lhs).begin(); element!=end; ++element ) {
532  element->value() = rhs.op_( element->value() );
533  }
534  }
536  //**********************************************************************************************
537 
538  //**Assignment to sparse vectors****************************************************************
553  template< typename VT2 > // Type of the target sparse vector
554  friend inline EnableIf_< And< UseAssign<VT2>
556  assign( SparseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
557  {
559 
563 
564  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
565 
566  const RT tmp( serial( rhs.sv_ ) );
567  (~lhs).reserve( tmp.nonZeros() );
568  assign( ~lhs, map( tmp, rhs.op_ ) );
569  }
571  //**********************************************************************************************
572 
573  //**Addition assignment to dense vectors********************************************************
587  template< typename VT2 > // Type of the target dense vector
588  friend inline EnableIf_< UseAssign<VT2> >
589  addAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
590  {
592 
596 
597  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
598 
599  const RT tmp( serial( rhs.sv_ ) );
600  addAssign( ~lhs, map( tmp, rhs.op_ ) );
601  }
603  //**********************************************************************************************
604 
605  //**Addition assignment to sparse vectors*******************************************************
606  // No special implementation for the addition assignment to sparse vectors.
607  //**********************************************************************************************
608 
609  //**Subtraction assignment to dense vectors*****************************************************
623  template< typename VT2 > // Type of the target dense vector
624  friend inline EnableIf_< UseAssign<VT2> >
625  subAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
626  {
628 
632 
633  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
634 
635  const RT tmp( serial( rhs.sv_ ) );
636  subAssign( ~lhs, map( tmp, rhs.op_ ) );
637  }
639  //**********************************************************************************************
640 
641  //**Subtraction assignment to sparse vectors****************************************************
642  // No special implementation for the subtraction assignment to sparse vectors.
643  //**********************************************************************************************
644 
645  //**Multiplication assignment to dense vectors**************************************************
659  template< typename VT2 > // Type of the target dense vector
660  friend inline EnableIf_< UseAssign<VT2> >
661  multAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
662  {
664 
668 
669  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
670 
671  const RT tmp( serial( rhs.sv_ ) );
672  multAssign( ~lhs, map( tmp, rhs.op_ ) );
673  }
675  //**********************************************************************************************
676 
677  //**Multiplication assignment to sparse vectors*************************************************
678  // No special implementation for the multiplication assignment to sparse vectors.
679  //**********************************************************************************************
680 
681  //**SMP assignment to dense vectors*************************************************************
695  template< typename VT2 > // Type of the target dense vector
696  friend inline EnableIf_< UseSMPAssign<VT2> >
697  smpAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
698  {
700 
704 
705  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
706 
707  const RT tmp( rhs.sv_ );
708  smpAssign( ~lhs, map( tmp, rhs.op_ ) );
709  }
711  //**********************************************************************************************
712 
713  //**SMP assignment to sparse vectors************************************************************
714  // No special implementation for the SMP assignment to sparse vectors.
715  //**********************************************************************************************
716 
717  //**SMP addition assignment to dense vectors****************************************************
731  template< typename VT2 > // Type of the target dense vector
732  friend inline EnableIf_< UseSMPAssign<VT2> >
733  smpAddAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
734  {
736 
740 
741  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
742 
743  const RT tmp( rhs.sv_ );
744  smpAddAssign( ~lhs, map( tmp, rhs.op_ ) );
745  }
747  //**********************************************************************************************
748 
749  //**SMP addition assignment to sparse vectors***************************************************
750  // No special implementation for the SMP addition assignment to sparse vectors.
751  //**********************************************************************************************
752 
753  //**SMP subtraction assignment to dense vectors*************************************************
767  template< typename VT2 > // Type of the target dense vector
768  friend inline EnableIf_< UseSMPAssign<VT2> >
769  smpSubAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
770  {
772 
776 
777  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
778 
779  const RT tmp( rhs.sv_ );
780  smpSubAssign( ~lhs, map( tmp, rhs.op_ ) );
781  }
783  //**********************************************************************************************
784 
785  //**SMP subtraction assignment to sparse vectors************************************************
786  // No special implementation for the SMP subtraction assignment to sparse vectors.
787  //**********************************************************************************************
788 
789  //**SMP multiplication assignment to dense vectors**********************************************
803  template< typename VT2 > // Type of the target dense vector
804  friend inline EnableIf_< UseSMPAssign<VT2> >
805  smpMultAssign( DenseVector<VT2,TF>& lhs, const SVecMapExpr& rhs )
806  {
808 
812 
813  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
814 
815  const RT tmp( rhs.sv_ );
816  smpMultAssign( ~lhs, map( tmp, rhs.op_ ) );
817  }
819  //**********************************************************************************************
820 
821  //**SMP multiplication assignment to sparse vectors*********************************************
822  // No special implementation for the SMP multiplication assignment to sparse vectors.
823  //**********************************************************************************************
824 
825  //**Compile time checks*************************************************************************
830  //**********************************************************************************************
831 };
832 //*************************************************************************************************
833 
834 
835 
836 
837 //=================================================================================================
838 //
839 // GLOBAL FUNCTIONS
840 //
841 //=================================================================================================
842 
843 //*************************************************************************************************
861 template< typename VT // Type of the sparse vector
862  , bool TF // Transpose flag
863  , typename OP > // Type of the custom operation
864 inline decltype(auto) map( const SparseVector<VT,TF>& sv, OP op )
865 {
867 
868  using ReturnType = const SVecMapExpr<VT,OP,TF>;
869  return ReturnType( ~sv, op );
870 }
871 //*************************************************************************************************
872 
873 
874 //*************************************************************************************************
892 template< typename VT // Type of the sparse vector
893  , bool TF // Transpose flag
894  , typename OP > // Type of the custom operation
895 inline decltype(auto) forEach( const SparseVector<VT,TF>& sv, OP op )
896 {
898 
899  using ReturnType = const SVecMapExpr<VT,OP,TF>;
900  return ReturnType( ~sv, op );
901 }
902 //*************************************************************************************************
903 
904 
905 //*************************************************************************************************
922 template< typename VT // Type of the sparse vector
923  , bool TF > // Transpose flag
924 inline decltype(auto) abs( const SparseVector<VT,TF>& sv )
925 {
927 
928  using ReturnType = const SVecMapExpr<VT,Abs,TF>;
929  return ReturnType( ~sv, Abs() );
930 }
931 //*************************************************************************************************
932 
933 
934 //*************************************************************************************************
951 template< typename VT // Type of the sparse vector
952  , bool TF > // Transpose flag
953 inline decltype(auto) floor( const SparseVector<VT,TF>& sv )
954 {
956 
957  using ReturnType = const SVecMapExpr<VT,Floor,TF>;
958  return ReturnType( ~sv, Floor() );
959 }
960 //*************************************************************************************************
961 
962 
963 //*************************************************************************************************
980 template< typename VT // Type of the sparse vector
981  , bool TF > // Transpose flag
982 inline decltype(auto) ceil( const SparseVector<VT,TF>& sv )
983 {
985 
986  using ReturnType = const SVecMapExpr<VT,Ceil,TF>;
987  return ReturnType( ~sv, Ceil() );
988 }
989 //*************************************************************************************************
990 
991 
992 //*************************************************************************************************
1009 template< typename VT // Type of the sparse vector
1010  , bool TF > // Transpose flag
1011 inline decltype(auto) trunc( const SparseVector<VT,TF>& sv )
1012 {
1014 
1015  using ReturnType = const SVecMapExpr<VT,Trunc,TF>;
1016  return ReturnType( ~sv, Trunc() );
1017 }
1018 //*************************************************************************************************
1019 
1020 
1021 //*************************************************************************************************
1038 template< typename VT // Type of the sparse vector
1039  , bool TF > // Transpose flag
1040 inline decltype(auto) round( const SparseVector<VT,TF>& sv )
1041 {
1043 
1044  using ReturnType = const SVecMapExpr<VT,Round,TF>;
1045  return ReturnType( ~sv, Round() );
1046 }
1047 //*************************************************************************************************
1048 
1049 
1050 //*************************************************************************************************
1067 template< typename VT // Type of the sparse vector
1068  , bool TF > // Transpose flag
1069 inline decltype(auto) conj( const SparseVector<VT,TF>& sv )
1070 {
1072 
1073  using ReturnType = const SVecMapExpr<VT,Conj,TF>;
1074  return ReturnType( ~sv, Conj() );
1075 }
1076 //*************************************************************************************************
1077 
1078 
1079 //*************************************************************************************************
1105 template< typename VT // Type of the sparse vector
1106  , bool TF > // Transpose flag
1107 inline decltype(auto) ctrans( const SparseVector<VT,TF>& sv )
1108 {
1110 
1111  return trans( conj( ~sv ) );
1112 }
1113 //*************************************************************************************************
1114 
1115 
1116 //*************************************************************************************************
1133 template< typename VT // Type of the sparse vector
1134  , bool TF > // Transpose flag
1135 inline decltype(auto) real( const SparseVector<VT,TF>& sv )
1136 {
1138 
1139  using ReturnType = const SVecMapExpr<VT,Real,TF>;
1140  return ReturnType( ~sv, Real() );
1141 }
1142 //*************************************************************************************************
1143 
1144 
1145 //*************************************************************************************************
1162 template< typename VT // Type of the sparse vector
1163  , bool TF > // Transpose flag
1164 inline decltype(auto) imag( const SparseVector<VT,TF>& sv )
1165 {
1167 
1168  using ReturnType = const SVecMapExpr<VT,Imag,TF>;
1169  return ReturnType( ~sv, Imag() );
1170 }
1171 //*************************************************************************************************
1172 
1173 
1174 //*************************************************************************************************
1194 template< typename VT // Type of the sparse vector
1195  , bool TF > // Transpose flag
1196 inline decltype(auto) sqrt( const SparseVector<VT,TF>& sv )
1197 {
1199 
1200  using ReturnType = const SVecMapExpr<VT,Sqrt,TF>;
1201  return ReturnType( ~sv, Sqrt() );
1202 }
1203 //*************************************************************************************************
1204 
1205 
1206 //*************************************************************************************************
1226 template< typename VT // Type of the sparse vector
1227  , bool TF > // Transpose flag
1228 inline decltype(auto) invsqrt( const SparseVector<VT,TF>& sv )
1229 {
1231 
1232  using ReturnType = const SVecMapExpr<VT,InvSqrt,TF>;
1233  return ReturnType( ~sv, InvSqrt() );
1234 }
1235 //*************************************************************************************************
1236 
1237 
1238 //*************************************************************************************************
1258 template< typename VT // Type of the sparse vector
1259  , bool TF > // Transpose flag
1260 inline decltype(auto) cbrt( const SparseVector<VT,TF>& sv )
1261 {
1263 
1264  using ReturnType = const SVecMapExpr<VT,Cbrt,TF>;
1265  return ReturnType( ~sv, Cbrt() );
1266 }
1267 //*************************************************************************************************
1268 
1269 
1270 //*************************************************************************************************
1290 template< typename VT // Type of the sparse vector
1291  , bool TF > // Transpose flag
1292 inline decltype(auto) invcbrt( const SparseVector<VT,TF>& sv )
1293 {
1295 
1296  using ReturnType = const SVecMapExpr<VT,InvCbrt,TF>;
1297  return ReturnType( ~sv, InvCbrt() );
1298 }
1299 //*************************************************************************************************
1300 
1301 
1302 //*************************************************************************************************
1321 template< typename VT // Type of the sparse vector
1322  , bool TF // Transpose flag
1323  , typename DT > // Type of the delimiters
1324 inline decltype(auto) clamp( const SparseVector<VT,TF>& sv, const DT& min, const DT& max )
1325 {
1327 
1328  using ReturnType = const SVecMapExpr<VT,Clamp<DT>,TF>;
1329  return ReturnType( ~sv, Clamp<DT>( min, max ) );
1330 }
1331 //*************************************************************************************************
1332 
1333 
1334 //*************************************************************************************************
1352 template< typename VT // Type of the sparse vector
1353  , bool TF // Transpose flag
1354  , typename ST // Type of the scalar exponent
1355  , typename = EnableIf_< IsNumeric<ST> > >
1356 inline decltype(auto) pow( const SparseVector<VT,TF>& sv, ST exp )
1357 {
1359 
1360  using ScalarType = MultTrait_< UnderlyingBuiltin_<VT>, ST >;
1362  return ReturnType( ~sv, UnaryPow<ScalarType>( exp ) );
1363 }
1364 //*************************************************************************************************
1365 
1366 
1367 //*************************************************************************************************
1384 template< typename VT // Type of the sparse vector
1385  , bool TF > // Transpose flag
1386 inline decltype(auto) exp( const SparseVector<VT,TF>& sv )
1387 {
1389 
1390  using ReturnType = const SVecMapExpr<VT,Exp,TF>;
1391  return ReturnType( ~sv, Exp() );
1392 }
1393 //*************************************************************************************************
1394 
1395 
1396 //*************************************************************************************************
1413 template< typename VT // Type of the sparse vector
1414  , bool TF > // Transpose flag
1415 inline decltype(auto) exp2( const SparseVector<VT,TF>& sv )
1416 {
1418 
1419  using ReturnType = const SVecMapExpr<VT,Exp2,TF>;
1420  return ReturnType( ~sv, Exp2() );
1421 }
1422 //*************************************************************************************************
1423 
1424 
1425 //*************************************************************************************************
1442 template< typename VT // Type of the sparse vector
1443  , bool TF > // Transpose flag
1444 inline decltype(auto) exp10( const SparseVector<VT,TF>& sv )
1445 {
1447 
1448  using ReturnType = const SVecMapExpr<VT,Exp10,TF>;
1449  return ReturnType( ~sv, Exp10() );
1450 }
1451 //*************************************************************************************************
1452 
1453 
1454 //*************************************************************************************************
1474 template< typename VT // Type of the sparse vector
1475  , bool TF > // Transpose flag
1476 inline decltype(auto) log( const SparseVector<VT,TF>& sv )
1477 {
1479 
1480  using ReturnType = const SVecMapExpr<VT,Log,TF>;
1481  return ReturnType( ~sv, Log() );
1482 }
1483 //*************************************************************************************************
1484 
1485 
1486 //*************************************************************************************************
1506 template< typename VT // Type of the sparse vector
1507  , bool TF > // Transpose flag
1508 inline decltype(auto) log2( const SparseVector<VT,TF>& sv )
1509 {
1511 
1512  using ReturnType = const SVecMapExpr<VT,Log2,TF>;
1513  return ReturnType( ~sv, Log2() );
1514 }
1515 //*************************************************************************************************
1516 
1517 
1518 //*************************************************************************************************
1538 template< typename VT // Type of the sparse vector
1539  , bool TF > // Transpose flag
1540 inline decltype(auto) log10( const SparseVector<VT,TF>& sv )
1541 {
1543 
1544  using ReturnType = const SVecMapExpr<VT,Log10,TF>;
1545  return ReturnType( ~sv, Log10() );
1546 }
1547 //*************************************************************************************************
1548 
1549 
1550 //*************************************************************************************************
1567 template< typename VT // Type of the sparse vector
1568  , bool TF > // Transpose flag
1569 inline decltype(auto) sin( const SparseVector<VT,TF>& sv )
1570 {
1572 
1573  using ReturnType = const SVecMapExpr<VT,Sin,TF>;
1574  return ReturnType( ~sv, Sin() );
1575 }
1576 //*************************************************************************************************
1577 
1578 
1579 //*************************************************************************************************
1599 template< typename VT // Type of the sparse vector
1600  , bool TF > // Transpose flag
1601 inline decltype(auto) asin( const SparseVector<VT,TF>& sv )
1602 {
1604 
1605  using ReturnType = const SVecMapExpr<VT,Asin,TF>;
1606  return ReturnType( ~sv, Asin() );
1607 }
1608 //*************************************************************************************************
1609 
1610 
1611 //*************************************************************************************************
1628 template< typename VT // Type of the sparse vector
1629  , bool TF > // Transpose flag
1630 inline decltype(auto) sinh( const SparseVector<VT,TF>& sv )
1631 {
1633 
1634  using ReturnType = const SVecMapExpr<VT,Sinh,TF>;
1635  return ReturnType( ~sv, Sinh() );
1636 }
1637 //*************************************************************************************************
1638 
1639 
1640 //*************************************************************************************************
1657 template< typename VT // Type of the sparse vector
1658  , bool TF > // Transpose flag
1659 inline decltype(auto) asinh( const SparseVector<VT,TF>& sv )
1660 {
1662 
1663  using ReturnType = const SVecMapExpr<VT,Asinh,TF>;
1664  return ReturnType( ~sv, Asinh() );
1665 }
1666 //*************************************************************************************************
1667 
1668 
1669 //*************************************************************************************************
1686 template< typename VT // Type of the sparse vector
1687  , bool TF > // Transpose flag
1688 inline decltype(auto) cos( const SparseVector<VT,TF>& sv )
1689 {
1691 
1692  using ReturnType = const SVecMapExpr<VT,Cos,TF>;
1693  return ReturnType( ~sv, Cos() );
1694 }
1695 //*************************************************************************************************
1696 
1697 
1698 //*************************************************************************************************
1718 template< typename VT // Type of the sparse vector
1719  , bool TF > // Transpose flag
1720 inline decltype(auto) acos( const SparseVector<VT,TF>& sv )
1721 {
1723 
1724  using ReturnType = const SVecMapExpr<VT,Acos,TF>;
1725  return ReturnType( ~sv, Acos() );
1726 }
1727 //*************************************************************************************************
1728 
1729 
1730 //*************************************************************************************************
1747 template< typename VT // Type of the sparse vector
1748  , bool TF > // Transpose flag
1749 inline decltype(auto) cosh( const SparseVector<VT,TF>& sv )
1750 {
1752 
1753  using ReturnType = const SVecMapExpr<VT,Cosh,TF>;
1754  return ReturnType( ~sv, Cosh() );
1755 }
1756 //*************************************************************************************************
1757 
1758 
1759 //*************************************************************************************************
1779 template< typename VT // Type of the sparse vector
1780  , bool TF > // Transpose flag
1781 inline decltype(auto) acosh( const SparseVector<VT,TF>& sv )
1782 {
1784 
1785  using ReturnType = const SVecMapExpr<VT,Acosh,TF>;
1786  return ReturnType( ~sv, Acosh() );
1787 }
1788 //*************************************************************************************************
1789 
1790 
1791 //*************************************************************************************************
1808 template< typename VT // Type of the sparse vector
1809  , bool TF > // Transpose flag
1810 inline decltype(auto) tan( const SparseVector<VT,TF>& sv )
1811 {
1813 
1814  using ReturnType = const SVecMapExpr<VT,Tan,TF>;
1815  return ReturnType( ~sv, Tan() );
1816 }
1817 //*************************************************************************************************
1818 
1819 
1820 //*************************************************************************************************
1837 template< typename VT // Type of the sparse vector
1838  , bool TF > // Transpose flag
1839 inline decltype(auto) atan( const SparseVector<VT,TF>& sv )
1840 {
1842 
1843  using ReturnType = const SVecMapExpr<VT,Atan,TF>;
1844  return ReturnType( ~sv, Atan() );
1845 }
1846 //*************************************************************************************************
1847 
1848 
1849 //*************************************************************************************************
1869 template< typename VT // Type of the sparse vector
1870  , bool TF > // Transpose flag
1871 inline decltype(auto) tanh( const SparseVector<VT,TF>& sv )
1872 {
1874 
1875  using ReturnType = const SVecMapExpr<VT,Tanh,TF>;
1876  return ReturnType( ~sv, Tanh() );
1877 }
1878 //*************************************************************************************************
1879 
1880 
1881 //*************************************************************************************************
1901 template< typename VT // Type of the sparse vector
1902  , bool TF > // Transpose flag
1903 inline decltype(auto) atanh( const SparseVector<VT,TF>& sv )
1904 {
1906 
1907  using ReturnType = const SVecMapExpr<VT,Atanh,TF>;
1908  return ReturnType( ~sv, Atanh() );
1909 }
1910 //*************************************************************************************************
1911 
1912 
1913 //*************************************************************************************************
1930 template< typename VT // Type of the sparse vector
1931  , bool TF > // Transpose flag
1932 inline decltype(auto) erf( const SparseVector<VT,TF>& sv )
1933 {
1935 
1936  using ReturnType = const SVecMapExpr<VT,Erf,TF>;
1937  return ReturnType( ~sv, Erf() );
1938 }
1939 //*************************************************************************************************
1940 
1941 
1942 //*************************************************************************************************
1959 template< typename VT // Type of the sparse vector
1960  , bool TF > // Transpose flag
1961 inline decltype(auto) erfc( const SparseVector<VT,TF>& sv )
1962 {
1964 
1965  using ReturnType = const SVecMapExpr<VT,Erfc,TF>;
1966  return ReturnType( ~sv, Erfc() );
1967 }
1968 //*************************************************************************************************
1969 
1970 
1971 
1972 
1973 //=================================================================================================
1974 //
1975 // GLOBAL RESTRUCTURING FUNCTIONS
1976 //
1977 //=================================================================================================
1978 
1979 //*************************************************************************************************
1990 template< typename VT // Type of the sparse vector
1991  , bool TF > // Transpose flag
1992 inline decltype(auto) abs( const SVecMapExpr<VT,Abs,TF>& sv )
1993 {
1995 
1996  return sv;
1997 }
1999 //*************************************************************************************************
2000 
2001 
2002 //*************************************************************************************************
2013 template< typename VT // Type of the sparse vector
2014  , bool TF > // Transpose flag
2015 inline decltype(auto) floor( const SVecMapExpr<VT,Floor,TF>& sv )
2016 {
2018 
2019  return sv;
2020 }
2022 //*************************************************************************************************
2023 
2024 
2025 //*************************************************************************************************
2036 template< typename VT // Type of the sparse vector
2037  , bool TF > // Transpose flag
2038 inline decltype(auto) ceil( const SVecMapExpr<VT,Ceil,TF>& sv )
2039 {
2041 
2042  return sv;
2043 }
2045 //*************************************************************************************************
2046 
2047 
2048 //*************************************************************************************************
2059 template< typename VT // Type of the sparse vector
2060  , bool TF > // Transpose flag
2061 inline decltype(auto) trunc( const SVecMapExpr<VT,Trunc,TF>& sv )
2062 {
2064 
2065  return sv;
2066 }
2068 //*************************************************************************************************
2069 
2070 
2071 //*************************************************************************************************
2082 template< typename VT // Type of the sparse vector
2083  , bool TF > // Transpose flag
2084 inline decltype(auto) round( const SVecMapExpr<VT,Round,TF>& sv )
2085 {
2087 
2088  return sv;
2089 }
2091 //*************************************************************************************************
2092 
2093 
2094 //*************************************************************************************************
2112 template< typename VT // Type of the sparse vector
2113  , bool TF > // Transpose flag
2114 inline decltype(auto) conj( const SVecMapExpr<VT,Conj,TF>& sv )
2115 {
2117 
2118  return sv.operand();
2119 }
2121 //*************************************************************************************************
2122 
2123 
2124 //*************************************************************************************************
2142 template< typename VT // Type of the sparse vector
2143  , bool TF > // Transpose flag
2144 inline decltype(auto) conj( const SVecTransExpr<SVecMapExpr<VT,Conj,TF>,!TF>& sv )
2145 {
2147 
2148  using ReturnType = const SVecTransExpr<VT,!TF>;
2149  return ReturnType( sv.operand().operand() );
2150 }
2152 //*************************************************************************************************
2153 
2154 
2155 //*************************************************************************************************
2166 template< typename VT // Type of the sparse vector
2167  , bool TF > // Transpose flag
2168 inline decltype(auto) real( const SVecMapExpr<VT,Real,TF>& sv )
2169 {
2171 
2172  return sv;
2173 }
2175 //*************************************************************************************************
2176 
2177 
2178 
2179 
2180 //=================================================================================================
2181 //
2182 // SIZE SPECIALIZATIONS
2183 //
2184 //=================================================================================================
2185 
2186 //*************************************************************************************************
2188 template< typename VT, typename OP, bool TF >
2189 struct Size< SVecMapExpr<VT,OP,TF>, 0UL >
2190  : public Size<VT,0UL>
2191 {};
2193 //*************************************************************************************************
2194 
2195 } // namespace blaze
2196 
2197 #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:192
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:404
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:459
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:102
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:234
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:1267
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:326
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:1903
Generic wrapper for the pow() function with fixed exponent.
Definition: Forward.h:119
Expression object for sparse vector transpositions.The SVecTransExpr class represents the compile tim...
Definition: Forward.h:146
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:291
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:3084
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SVecMapExpr.h:266
UnaryMapTrait_< RT, OP > ResultType
Result type for expression template evaluations.
Definition: SVecMapExpr.h:142
Header file for the RequiresEvaluation type trait.
Iterator over the elements of the sparse vector map expression.
Definition: SVecMapExpr.h:162
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:1950
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SVecMapExpr.h:437
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:449
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:224
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:71
Operation op_
The custom unary operation.
Definition: SVecMapExpr.h:467
ConstIterator_< RemoveReference_< Operand > > IteratorType
Iterator type of the sparse vector expression.
Definition: SVecMapExpr.h:170
If_< IsExpression< VT >, const VT, const VT &> Operand
Composite data type of the sparse vector expression.
Definition: SVecMapExpr.h:153
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:179
Header file for the multiplication trait.
Header file for the unary map trait.
ResultType_< VT > RT
Result type of the sparse vector expression.
Definition: SVecMapExpr.h:101
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:58
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:359
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:277
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:214
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:203
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:156
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:3085
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: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: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:255
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:380
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:144
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:172
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:1205
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:244
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 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
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:339
#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:285
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:816
ConstIterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition: SVecMapExpr.h:392
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:415
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:349
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
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:789
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:301
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:134
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:369
Compile time evaluation of the size of vectors and matrices.The Size type trait evaluates the size of...
Definition: Size.h:80
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:147
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:150
Operand sv_
Sparse vector of the map expression.
Definition: SVecMapExpr.h:466
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SVecMapExpr.h:143
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:284
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:425
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:313
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:1134