SVecForEachExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SVECFOREACHEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SVECFOREACHEXPR_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>
66 #include <blaze/util/Assert.h>
68 #include <blaze/util/EnableIf.h>
70 #include <blaze/util/mpl/And.h>
71 #include <blaze/util/mpl/If.h>
72 #include <blaze/util/mpl/Not.h>
73 #include <blaze/util/Types.h>
76 
77 
78 namespace blaze {
79 
80 //=================================================================================================
81 //
82 // CLASS SVECFOREACHEXPR
83 //
84 //=================================================================================================
85 
86 //*************************************************************************************************
93 template< typename VT // Type of the sparse vector
94  , typename OP // Type of the custom operation
95  , bool TF > // Transpose flag
96 class SVecForEachExpr : public SparseVector< SVecForEachExpr<VT,OP,TF>, TF >
97  , private VecForEachExpr
98  , private Computation
99 {
100  private:
101  //**Type definitions****************************************************************************
102  typedef ResultType_<VT> RT;
103  typedef ReturnType_<VT> RN;
104  //**********************************************************************************************
105 
106  //**Serial evaluation strategy******************************************************************
108 
114  enum : bool { useAssign = RequiresEvaluation<VT>::value };
115 
117  template< typename VT2 >
119  struct UseAssign {
120  enum : bool { value = useAssign };
121  };
123  //**********************************************************************************************
124 
125  //**Parallel evaluation strategy****************************************************************
127 
133  template< typename VT2 >
134  struct UseSMPAssign {
135  enum : bool { value = ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign };
136  };
138  //**********************************************************************************************
139 
140  public:
141  //**Type definitions****************************************************************************
146 
148  typedef decltype( std::declval<OP>()( std::declval<RN>() ) ) ReturnType;
149 
151  typedef IfTrue_< useAssign, const ResultType, const SVecForEachExpr& > CompositeType;
152 
154  typedef If_< IsExpression<VT>, const VT, const VT& > Operand;
155 
157  typedef OP Operation;
158  //**********************************************************************************************
159 
160  //**ConstIterator class definition**************************************************************
164  {
165  public:
166  //**Type definitions*************************************************************************
169 
172 
173  typedef std::forward_iterator_tag IteratorCategory;
174  typedef Element ValueType;
175  typedef ValueType* PointerType;
176  typedef ValueType& ReferenceType;
178 
179  // STL iterator requirements
180  typedef IteratorCategory iterator_category;
181  typedef ValueType value_type;
182  typedef PointerType pointer;
183  typedef ReferenceType reference;
184  typedef DifferenceType difference_type;
185  //*******************************************************************************************
186 
187  //**Constructor******************************************************************************
193  inline ConstIterator( IteratorType it, OP op )
194  : it_( it ) // Iterator over the elements of the sparse vector expression
195  , op_( op ) // The custom unary operation
196  {}
197  //*******************************************************************************************
198 
199  //**Prefix increment operator****************************************************************
204  inline ConstIterator& operator++() {
205  ++it_;
206  return *this;
207  }
208  //*******************************************************************************************
209 
210  //**Element access operator******************************************************************
215  inline const Element operator*() const {
216  return Element( op_( it_->value() ), it_->index() );
217  }
218  //*******************************************************************************************
219 
220  //**Element access operator******************************************************************
225  inline const ConstIterator* operator->() const {
226  return this;
227  }
228  //*******************************************************************************************
229 
230  //**Value function***************************************************************************
235  inline ReturnType value() const {
236  return op_( it_->value() );
237  }
238  //*******************************************************************************************
239 
240  //**Index function***************************************************************************
245  inline size_t index() const {
246  return it_->index();
247  }
248  //*******************************************************************************************
249 
250  //**Equality operator************************************************************************
256  inline bool operator==( const ConstIterator& rhs ) const {
257  return it_ == rhs.it_;
258  }
259  //*******************************************************************************************
260 
261  //**Inequality operator**********************************************************************
267  inline bool operator!=( const ConstIterator& rhs ) const {
268  return it_ != rhs.it_;
269  }
270  //*******************************************************************************************
271 
272  //**Subtraction operator*********************************************************************
278  inline DifferenceType operator-( const ConstIterator& rhs ) const {
279  return it_ - rhs.it_;
280  }
281  //*******************************************************************************************
282 
283  private:
284  //**Member variables*************************************************************************
285  IteratorType it_;
286  OP op_;
287  //*******************************************************************************************
288  };
289  //**********************************************************************************************
290 
291  //**Compilation flags***************************************************************************
293  enum : bool { smpAssignable = VT::smpAssignable };
294  //**********************************************************************************************
295 
296  //**Constructor*********************************************************************************
302  explicit inline SVecForEachExpr( const VT& sv, OP op ) noexcept
303  : sv_( sv ) // Sparse vector of the for-each expression
304  , op_( op ) // The custom unary operation
305  {}
306  //**********************************************************************************************
307 
308  //**Subscript operator**************************************************************************
314  inline ReturnType operator[]( size_t index ) const {
315  BLAZE_INTERNAL_ASSERT( index < sv_.size(), "Invalid vector access index" );
316  return op_( sv_[index] );
317  }
318  //**********************************************************************************************
319 
320  //**At function*********************************************************************************
327  inline ReturnType at( size_t index ) const {
328  if( index >= sv_.size() ) {
329  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
330  }
331  return (*this)[index];
332  }
333  //**********************************************************************************************
334 
335  //**Begin function******************************************************************************
340  inline ConstIterator begin() const {
341  return ConstIterator( sv_.begin(), op_ );
342  }
343  //**********************************************************************************************
344 
345  //**End function********************************************************************************
350  inline ConstIterator end() const {
351  return ConstIterator( sv_.end(), op_ );
352  }
353  //**********************************************************************************************
354 
355  //**Size function*******************************************************************************
360  inline size_t size() const noexcept {
361  return sv_.size();
362  }
363  //**********************************************************************************************
364 
365  //**NonZeros function***************************************************************************
370  inline size_t nonZeros() const {
371  return sv_.nonZeros();
372  }
373  //**********************************************************************************************
374 
375  //**Find function*******************************************************************************
381  inline ConstIterator find( size_t index ) const {
383  return ConstIterator( sv_.find( index ), op_ );
384  }
385  //**********************************************************************************************
386 
387  //**LowerBound function*************************************************************************
393  inline ConstIterator lowerBound( size_t index ) const {
395  return ConstIterator( sv_.lowerBound( index ), op_ );
396  }
397  //**********************************************************************************************
398 
399  //**UpperBound function*************************************************************************
405  inline ConstIterator upperBound( size_t index ) const {
407  return ConstIterator( sv_.upperBound( index ), op_ );
408  }
409  //**********************************************************************************************
410 
411  //**Operand access******************************************************************************
416  inline Operand operand() const noexcept {
417  return sv_;
418  }
419  //**********************************************************************************************
420 
421  //**Operation access****************************************************************************
426  inline Operation operation() const {
427  return op_;
428  }
429  //**********************************************************************************************
430 
431  //**********************************************************************************************
437  template< typename T >
438  inline bool canAlias( const T* alias ) const noexcept {
439  return sv_.canAlias( alias );
440  }
441  //**********************************************************************************************
442 
443  //**********************************************************************************************
449  template< typename T >
450  inline bool isAliased( const T* alias ) const noexcept {
451  return sv_.isAliased( alias );
452  }
453  //**********************************************************************************************
454 
455  //**********************************************************************************************
460  inline bool canSMPAssign() const noexcept {
461  return sv_.canSMPAssign();
462  }
463  //**********************************************************************************************
464 
465  private:
466  //**Member variables****************************************************************************
469  //**********************************************************************************************
470 
471  //**Assignment to dense vectors*****************************************************************
485  template< typename VT2 > // Type of the target dense vector
486  friend inline EnableIf_< UseAssign<VT2> >
487  assign( DenseVector<VT2,TF>& lhs, const SVecForEachExpr& rhs )
488  {
490 
494 
495  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
496 
497  const RT tmp( serial( rhs.sv_ ) );
498  assign( ~lhs, forEach( tmp, rhs.op_ ) );
499  }
501  //**********************************************************************************************
502 
503  //**Assignment to sparse vectors****************************************************************
518  template< typename VT2 > // Type of the target sparse vector
519  friend inline EnableIf_< And< UseAssign<VT2>
521  assign( SparseVector<VT2,TF>& lhs, const SVecForEachExpr& rhs )
522  {
524 
525  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
526 
527  typedef Iterator_<VT2> Iterator;
528 
529  assign( ~lhs, rhs.sv_ );
530 
531  const Iterator end( (~lhs).end() );
532  for( Iterator element=(~lhs).begin(); element!=end; ++element ) {
533  element->value() = rhs.op_( element->value() );
534  }
535  }
537  //**********************************************************************************************
538 
539  //**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 SVecForEachExpr& 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, forEach( 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 SVecForEachExpr& 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, forEach( 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 SVecForEachExpr& 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, forEach( 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 SVecForEachExpr& 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, forEach( 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 SVecForEachExpr& 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, forEach( 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> >
734  {
736 
740 
741  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
742 
743  const RT tmp( rhs.sv_ );
744  smpAddAssign( ~lhs, forEach( 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> >
770  {
772 
776 
777  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
778 
779  const RT tmp( rhs.sv_ );
780  smpSubAssign( ~lhs, forEach( 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> >
806  {
808 
812 
813  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
814 
815  const RT tmp( rhs.sv_ );
816  smpMultAssign( ~lhs, forEach( 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 const SVecForEachExpr<VT,OP,TF> forEach( const SparseVector<VT,TF>& sv, OP op )
865 {
867 
868  return SVecForEachExpr<VT,OP,TF>( ~sv, op );
869 }
870 //*************************************************************************************************
871 
872 
873 //*************************************************************************************************
890 template< typename VT // Type of the sparse vector
891  , bool TF > // Transpose flag
893 {
895 
896  return SVecForEachExpr<VT,Abs,TF>( ~sv, Abs() );
897 }
898 //*************************************************************************************************
899 
900 
901 //*************************************************************************************************
918 template< typename VT // Type of the sparse vector
919  , bool TF > // Transpose flag
921 {
923 
924  return SVecForEachExpr<VT,Floor,TF>( ~sv, Floor() );
925 }
926 //*************************************************************************************************
927 
928 
929 //*************************************************************************************************
946 template< typename VT // Type of the sparse vector
947  , bool TF > // Transpose flag
949 {
951 
952  return SVecForEachExpr<VT,Ceil,TF>( ~sv, Ceil() );
953 }
954 //*************************************************************************************************
955 
956 
957 //*************************************************************************************************
974 template< typename VT // Type of the sparse vector
975  , bool TF > // Transpose flag
977 {
979 
980  return SVecForEachExpr<VT,Trunc,TF>( ~sv, Trunc() );
981 }
982 //*************************************************************************************************
983 
984 
985 //*************************************************************************************************
1002 template< typename VT // Type of the sparse vector
1003  , bool TF > // Transpose flag
1005 {
1007 
1008  return SVecForEachExpr<VT,Round,TF>( ~sv, Round() );
1009 }
1010 //*************************************************************************************************
1011 
1012 
1013 //*************************************************************************************************
1030 template< typename VT // Type of the sparse vector
1031  , bool TF > // Transpose flag
1033 {
1035 
1036  return SVecForEachExpr<VT,Conj,TF>( ~sv, Conj() );
1037 }
1038 //*************************************************************************************************
1039 
1040 
1041 //*************************************************************************************************
1067 template< typename VT // Type of the sparse vector
1068  , bool TF > // Transpose flag
1070 {
1072 
1073  return trans( conj( ~sv ) );
1074 }
1075 //*************************************************************************************************
1076 
1077 
1078 //*************************************************************************************************
1095 template< typename VT // Type of the sparse vector
1096  , bool TF > // Transpose flag
1098 {
1100 
1101  return SVecForEachExpr<VT,Real,TF>( ~sv, Real() );
1102 }
1103 //*************************************************************************************************
1104 
1105 
1106 //*************************************************************************************************
1123 template< typename VT // Type of the sparse vector
1124  , bool TF > // Transpose flag
1126 {
1128 
1129  return SVecForEachExpr<VT,Imag,TF>( ~sv, Imag() );
1130 }
1131 //*************************************************************************************************
1132 
1133 
1134 //*************************************************************************************************
1154 template< typename VT // Type of the sparse vector
1155  , bool TF > // Transpose flag
1157 {
1159 
1160  return SVecForEachExpr<VT,Sqrt,TF>( ~sv, Sqrt() );
1161 }
1162 //*************************************************************************************************
1163 
1164 
1165 //*************************************************************************************************
1185 template< typename VT // Type of the sparse vector
1186  , bool TF > // Transpose flag
1188 {
1190 
1191  return SVecForEachExpr<VT,InvSqrt,TF>( ~sv, InvSqrt() );
1192 }
1193 //*************************************************************************************************
1194 
1195 
1196 //*************************************************************************************************
1216 template< typename VT // Type of the sparse vector
1217  , bool TF > // Transpose flag
1219 {
1221 
1222  return SVecForEachExpr<VT,Cbrt,TF>( ~sv, Cbrt() );
1223 }
1224 //*************************************************************************************************
1225 
1226 
1227 //*************************************************************************************************
1247 template< typename VT // Type of the sparse vector
1248  , bool TF > // Transpose flag
1250 {
1252 
1253  return SVecForEachExpr<VT,InvCbrt,TF>( ~sv, InvCbrt() );
1254 }
1255 //*************************************************************************************************
1256 
1257 
1258 //*************************************************************************************************
1277 template< typename VT // Type of the sparse vector
1278  , bool TF // Transpose flag
1279  , typename DT > // Type of the delimiters
1280 inline const SVecForEachExpr<VT,Clamp<DT>,TF>
1281  clamp( const SparseVector<VT,TF>& sv, const DT& min, const DT& max )
1282 {
1284 
1285  return SVecForEachExpr<VT,Clamp<DT>,TF>( ~sv, Clamp<DT>( min, max ) );
1286 }
1287 //*************************************************************************************************
1288 
1289 
1290 //*************************************************************************************************
1308 template< typename VT // Type of the sparse vector
1309  , bool TF // Transpose flag
1310  , typename ET > // Type of the exponent
1311 inline const SVecForEachExpr<VT,Pow<ET>,TF> pow( const SparseVector<VT,TF>& sv, ET exp )
1312 {
1314 
1316 
1317  return SVecForEachExpr<VT,Pow<ET>,TF>( ~sv, Pow<ET>( exp ) );
1318 }
1319 //*************************************************************************************************
1320 
1321 
1322 //*************************************************************************************************
1339 template< typename VT // Type of the sparse vector
1340  , bool TF > // Transpose flag
1342 {
1344 
1345  return SVecForEachExpr<VT,Exp,TF>( ~sv, Exp() );
1346 }
1347 //*************************************************************************************************
1348 
1349 
1350 //*************************************************************************************************
1367 template< typename VT // Type of the sparse vector
1368  , bool TF > // Transpose flag
1370 {
1372 
1373  return SVecForEachExpr<VT,Exp2,TF>( ~sv, Exp2() );
1374 }
1375 //*************************************************************************************************
1376 
1377 
1378 //*************************************************************************************************
1395 template< typename VT // Type of the sparse vector
1396  , bool TF > // Transpose flag
1398 {
1400 
1401  return SVecForEachExpr<VT,Exp10,TF>( ~sv, Exp10() );
1402 }
1403 //*************************************************************************************************
1404 
1405 
1406 //*************************************************************************************************
1426 template< typename VT // Type of the sparse vector
1427  , bool TF > // Transpose flag
1429 {
1431 
1432  return SVecForEachExpr<VT,Log,TF>( ~sv, Log() );
1433 }
1434 //*************************************************************************************************
1435 
1436 
1437 //*************************************************************************************************
1457 template< typename VT // Type of the sparse vector
1458  , bool TF > // Transpose flag
1460 {
1462 
1463  return SVecForEachExpr<VT,Log2,TF>( ~sv, Log2() );
1464 }
1465 //*************************************************************************************************
1466 
1467 
1468 //*************************************************************************************************
1488 template< typename VT // Type of the sparse vector
1489  , bool TF > // Transpose flag
1491 {
1493 
1494  return SVecForEachExpr<VT,Log10,TF>( ~sv, Log10() );
1495 }
1496 //*************************************************************************************************
1497 
1498 
1499 //*************************************************************************************************
1516 template< typename VT // Type of the sparse vector
1517  , bool TF > // Transpose flag
1519 {
1521 
1522  return SVecForEachExpr<VT,Sin,TF>( ~sv, Sin() );
1523 }
1524 //*************************************************************************************************
1525 
1526 
1527 //*************************************************************************************************
1547 template< typename VT // Type of the sparse vector
1548  , bool TF > // Transpose flag
1550 {
1552 
1553  return SVecForEachExpr<VT,Asin,TF>( ~sv, Asin() );
1554 }
1555 //*************************************************************************************************
1556 
1557 
1558 //*************************************************************************************************
1575 template< typename VT // Type of the sparse vector
1576  , bool TF > // Transpose flag
1578 {
1580 
1581  return SVecForEachExpr<VT,Sinh,TF>( ~sv, Sinh() );
1582 }
1583 //*************************************************************************************************
1584 
1585 
1586 //*************************************************************************************************
1603 template< typename VT // Type of the sparse vector
1604  , bool TF > // Transpose flag
1606 {
1608 
1609  return SVecForEachExpr<VT,Asinh,TF>( ~sv, Asinh() );
1610 }
1611 //*************************************************************************************************
1612 
1613 
1614 //*************************************************************************************************
1631 template< typename VT // Type of the sparse vector
1632  , bool TF > // Transpose flag
1634 {
1636 
1637  return SVecForEachExpr<VT,Cos,TF>( ~sv, Cos() );
1638 }
1639 //*************************************************************************************************
1640 
1641 
1642 //*************************************************************************************************
1662 template< typename VT // Type of the sparse vector
1663  , bool TF > // Transpose flag
1665 {
1667 
1668  return SVecForEachExpr<VT,Acos,TF>( ~sv, Acos() );
1669 }
1670 //*************************************************************************************************
1671 
1672 
1673 //*************************************************************************************************
1690 template< typename VT // Type of the sparse vector
1691  , bool TF > // Transpose flag
1693 {
1695 
1696  return SVecForEachExpr<VT,Cosh,TF>( ~sv, Cosh() );
1697 }
1698 //*************************************************************************************************
1699 
1700 
1701 //*************************************************************************************************
1721 template< typename VT // Type of the sparse vector
1722  , bool TF > // Transpose flag
1724 {
1726 
1727  return SVecForEachExpr<VT,Acosh,TF>( ~sv, Acosh() );
1728 }
1729 //*************************************************************************************************
1730 
1731 
1732 //*************************************************************************************************
1749 template< typename VT // Type of the sparse vector
1750  , bool TF > // Transpose flag
1752 {
1754 
1755  return SVecForEachExpr<VT,Tan,TF>( ~sv, Tan() );
1756 }
1757 //*************************************************************************************************
1758 
1759 
1760 //*************************************************************************************************
1777 template< typename VT // Type of the sparse vector
1778  , bool TF > // Transpose flag
1780 {
1782 
1783  return SVecForEachExpr<VT,Atan,TF>( ~sv, Atan() );
1784 }
1785 //*************************************************************************************************
1786 
1787 
1788 //*************************************************************************************************
1808 template< typename VT // Type of the sparse vector
1809  , bool TF > // Transpose flag
1811 {
1813 
1814  return SVecForEachExpr<VT,Tanh,TF>( ~sv, Tanh() );
1815 }
1816 //*************************************************************************************************
1817 
1818 
1819 //*************************************************************************************************
1839 template< typename VT // Type of the sparse vector
1840  , bool TF > // Transpose flag
1842 {
1844 
1845  return SVecForEachExpr<VT,Atanh,TF>( ~sv, Atanh() );
1846 }
1847 //*************************************************************************************************
1848 
1849 
1850 //*************************************************************************************************
1867 template< typename VT // Type of the sparse vector
1868  , bool TF > // Transpose flag
1870 {
1872 
1873  return SVecForEachExpr<VT,Erf,TF>( ~sv, Erf() );
1874 }
1875 //*************************************************************************************************
1876 
1877 
1878 //*************************************************************************************************
1895 template< typename VT // Type of the sparse vector
1896  , bool TF > // Transpose flag
1898 {
1900 
1901  return SVecForEachExpr<VT,Erfc,TF>( ~sv, Erfc() );
1902 }
1903 //*************************************************************************************************
1904 
1905 
1906 
1907 
1908 //=================================================================================================
1909 //
1910 // GLOBAL RESTRUCTURING FUNCTIONS
1911 //
1912 //=================================================================================================
1913 
1914 //*************************************************************************************************
1925 template< typename VT // Type of the sparse vector
1926  , bool TF > // Transpose flag
1928 {
1930 
1931  return sv;
1932 }
1934 //*************************************************************************************************
1935 
1936 
1937 //*************************************************************************************************
1948 template< typename VT // Type of the sparse vector
1949  , bool TF > // Transpose flag
1951 {
1953 
1954  return sv;
1955 }
1957 //*************************************************************************************************
1958 
1959 
1960 //*************************************************************************************************
1971 template< typename VT // Type of the sparse vector
1972  , bool TF > // Transpose flag
1974 {
1976 
1977  return sv;
1978 }
1980 //*************************************************************************************************
1981 
1982 
1983 //*************************************************************************************************
1994 template< typename VT // Type of the sparse vector
1995  , bool TF > // Transpose flag
1997 {
1999 
2000  return sv;
2001 }
2003 //*************************************************************************************************
2004 
2005 
2006 //*************************************************************************************************
2017 template< typename VT // Type of the sparse vector
2018  , bool TF > // Transpose flag
2020 {
2022 
2023  return sv;
2024 }
2026 //*************************************************************************************************
2027 
2028 
2029 //*************************************************************************************************
2047 template< typename VT // Type of the sparse vector
2048  , bool TF > // Transpose flag
2050 {
2052 
2053  return sv.operand();
2054 }
2056 //*************************************************************************************************
2057 
2058 
2059 //*************************************************************************************************
2077 template< typename VT // Type of the sparse vector
2078  , bool TF > // Transpose flag
2080 {
2082 
2083  return SVecTransExpr<VT,!TF>( sv.operand().operand() );
2084 }
2086 //*************************************************************************************************
2087 
2088 
2089 //*************************************************************************************************
2100 template< typename VT // Type of the sparse vector
2101  , bool TF > // Transpose flag
2103 {
2105 
2106  return sv;
2107 }
2109 //*************************************************************************************************
2110 
2111 
2112 
2113 
2114 //=================================================================================================
2115 //
2116 // SIZE SPECIALIZATIONS
2117 //
2118 //=================================================================================================
2119 
2120 //*************************************************************************************************
2122 template< typename VT, typename OP, bool TF >
2123 struct Size< SVecForEachExpr<VT,OP,TF> > : public Size<VT>
2124 {};
2126 //*************************************************************************************************
2127 
2128 
2129 
2130 
2131 //=================================================================================================
2132 //
2133 // EXPRESSION TRAIT SPECIALIZATIONS
2134 //
2135 //=================================================================================================
2136 
2137 //*************************************************************************************************
2139 template< typename VT >
2140 struct SVecForEachExprTrait< SVecForEachExpr<VT,Abs,false>, Abs >
2141 {
2142  public:
2143  //**********************************************************************************************
2146  , INVALID_TYPE >;
2147  //**********************************************************************************************
2148 };
2150 //*************************************************************************************************
2151 
2152 
2153 //*************************************************************************************************
2155 template< typename VT >
2156 struct TSVecForEachExprTrait< SVecForEachExpr<VT,Abs,true>, Abs >
2157 {
2158  public:
2159  //**********************************************************************************************
2162  , INVALID_TYPE >;
2163  //**********************************************************************************************
2164 };
2166 //*************************************************************************************************
2167 
2168 
2169 //*************************************************************************************************
2171 template< typename VT >
2172 struct SVecForEachExprTrait< SVecForEachExpr<VT,Floor,false>, Floor >
2173 {
2174  public:
2175  //**********************************************************************************************
2178  , INVALID_TYPE >;
2179  //**********************************************************************************************
2180 };
2182 //*************************************************************************************************
2183 
2184 
2185 //*************************************************************************************************
2187 template< typename VT >
2188 struct TSVecForEachExprTrait< SVecForEachExpr<VT,Floor,true>, Floor >
2189 {
2190  public:
2191  //**********************************************************************************************
2194  , INVALID_TYPE >;
2195  //**********************************************************************************************
2196 };
2198 //*************************************************************************************************
2199 
2200 
2201 //*************************************************************************************************
2203 template< typename VT >
2204 struct SVecForEachExprTrait< SVecForEachExpr<VT,Ceil,false>, Ceil >
2205 {
2206  public:
2207  //**********************************************************************************************
2210  , INVALID_TYPE >;
2211  //**********************************************************************************************
2212 };
2214 //*************************************************************************************************
2215 
2216 
2217 //*************************************************************************************************
2219 template< typename VT >
2220 struct TSVecForEachExprTrait< SVecForEachExpr<VT,Ceil,true>, Ceil >
2221 {
2222  public:
2223  //**********************************************************************************************
2226  , INVALID_TYPE >;
2227  //**********************************************************************************************
2228 };
2230 //*************************************************************************************************
2231 
2232 
2233 //*************************************************************************************************
2235 template< typename VT >
2236 struct SVecForEachExprTrait< SVecForEachExpr<VT,Trunc,false>, Trunc >
2237 {
2238  public:
2239  //**********************************************************************************************
2242  , INVALID_TYPE >;
2243  //**********************************************************************************************
2244 };
2246 //*************************************************************************************************
2247 
2248 
2249 //*************************************************************************************************
2251 template< typename VT >
2252 struct TSVecForEachExprTrait< SVecForEachExpr<VT,Trunc,true>, Trunc >
2253 {
2254  public:
2255  //**********************************************************************************************
2258  , INVALID_TYPE >;
2259  //**********************************************************************************************
2260 };
2262 //*************************************************************************************************
2263 
2264 
2265 //*************************************************************************************************
2267 template< typename VT >
2268 struct SVecForEachExprTrait< SVecForEachExpr<VT,Round,false>, Round >
2269 {
2270  public:
2271  //**********************************************************************************************
2274  , INVALID_TYPE >;
2275  //**********************************************************************************************
2276 };
2278 //*************************************************************************************************
2279 
2280 
2281 //*************************************************************************************************
2283 template< typename VT >
2284 struct TSVecForEachExprTrait< SVecForEachExpr<VT,Round,true>, Round >
2285 {
2286  public:
2287  //**********************************************************************************************
2290  , INVALID_TYPE >;
2291  //**********************************************************************************************
2292 };
2294 //*************************************************************************************************
2295 
2296 
2297 //*************************************************************************************************
2299 template< typename VT >
2300 struct SVecForEachExprTrait< SVecForEachExpr<VT,Conj,false>, Conj >
2301 {
2302  public:
2303  //**********************************************************************************************
2306  , INVALID_TYPE >;
2307  //**********************************************************************************************
2308 };
2310 //*************************************************************************************************
2311 
2312 
2313 //*************************************************************************************************
2315 template< typename VT >
2316 struct TSVecForEachExprTrait< SVecForEachExpr<VT,Conj,true>, Conj >
2317 {
2318  public:
2319  //**********************************************************************************************
2322  , INVALID_TYPE >;
2323  //**********************************************************************************************
2324 };
2326 //*************************************************************************************************
2327 
2328 
2329 //*************************************************************************************************
2331 template< typename VT >
2332 struct SVecForEachExprTrait< SVecTransExpr< SVecForEachExpr<VT,Conj,true>, false >, Conj >
2333 {
2334  public:
2335  //**********************************************************************************************
2338  , INVALID_TYPE >;
2339  //**********************************************************************************************
2340 };
2342 //*************************************************************************************************
2343 
2344 
2345 //*************************************************************************************************
2347 template< typename VT >
2348 struct TSVecForEachExprTrait< SVecTransExpr< SVecForEachExpr<VT,Conj,false>, true >, Conj >
2349 {
2350  public:
2351  //**********************************************************************************************
2354  , INVALID_TYPE >;
2355  //**********************************************************************************************
2356 };
2358 //*************************************************************************************************
2359 
2360 
2361 //*************************************************************************************************
2363 template< typename VT >
2364 struct SVecForEachExprTrait< SVecForEachExpr<VT,Real,false>, Real >
2365 {
2366  public:
2367  //**********************************************************************************************
2370  , INVALID_TYPE >;
2371  //**********************************************************************************************
2372 };
2374 //*************************************************************************************************
2375 
2376 
2377 //*************************************************************************************************
2379 template< typename VT >
2380 struct TSVecForEachExprTrait< SVecForEachExpr<VT,Real,true>, Real >
2381 {
2382  public:
2383  //**********************************************************************************************
2386  , INVALID_TYPE >;
2387  //**********************************************************************************************
2388 };
2390 //*************************************************************************************************
2391 
2392 
2393 //*************************************************************************************************
2395 template< typename VT, typename OP, bool TF, bool AF >
2396 struct SubvectorExprTrait< SVecForEachExpr<VT,OP,TF>, AF >
2397 {
2398  public:
2399  //**********************************************************************************************
2401  //**********************************************************************************************
2402 };
2404 //*************************************************************************************************
2405 
2406 } // namespace blaze
2407 
2408 #endif
ReferenceType reference
Reference return type.
Definition: SVecForEachExpr.h:183
Header file for the UnderlyingNumeric type trait.
Generic wrapper for the trunc() function.
Definition: Trunc.h:62
const ConstIterator * operator->() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecForEachExpr.h:225
Pointer difference type of the Blaze library.
ElementType_< ResultType > ElementType
Resulting element type.
Definition: SVecForEachExpr.h:145
Compile time check for row vector types.This type trait tests whether or not the given template argum...
Definition: IsRowVector.h:80
const DMatForEachExpr< MT, Conj, SO > conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatForEachExpr.h:1214
Header file for auxiliary alias declarations.
ConstIterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition: SVecForEachExpr.h:393
Generic wrapper for the ceil() function.
Definition: Ceil.h:62
const DMatForEachExpr< MT, Log, SO > log(const DenseMatrix< MT, SO > &dm)
Computes the natural logarithm for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1610
const DMatForEachExpr< MT, Sin, SO > sin(const DenseMatrix< MT, SO > &dm)
Computes the sine for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1700
Evaluation of the expression type type of a subvector operation.Via this type trait it is possible to...
Definition: SubvectorExprTrait.h:79
Generic wrapper for the cbrt() function.
Definition: Cbrt.h:62
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SVecForEachExpr.h:450
ConstIterator begin() const
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecForEachExpr.h:340
Header file for basic type definitions.
Header file for the SparseVector base class.
IteratorCategory iterator_category
The iterator category.
Definition: SVecForEachExpr.h:180
const DMatForEachExpr< MT, Log10, SO > log10(const DenseMatrix< MT, SO > &dm)
Computes the common logarithm for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1672
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:160
Header file for the serial shim.
const DMatForEachExpr< MT, Tanh, SO > tanh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic tangent for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1992
const CTransExprTrait_< MT > ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatForEachExpr.h:1251
Header file for the IsSame and IsStrictlySame type traits.
Header file for the ForEachExprTrait class template.
const DMatForEachExpr< MT, Cos, SO > cos(const DenseMatrix< MT, SO > &dm)
Computes the cosine for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1815
ValueType * PointerType
Pointer return type.
Definition: SVecForEachExpr.h:175
Generic wrapper for the clamp() function.
Definition: Clamp.h:60
const DMatForEachExpr< MT, Atan, SO > atan(const DenseMatrix< MT, SO > &dm)
Computes the inverse tangent for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1961
Generic wrapper for the acosh() function.
Definition: Acosh.h:62
const DMatForEachExpr< MT, Imag, SO > imag(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the imaginary part of each single element of dm.
Definition: DMatForEachExpr.h:1307
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
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:1755
const Element operator*() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecForEachExpr.h:215
Evaluation of the expression type of a sparse vector for-each operation.Via this type trait it is pos...
Definition: SVecForEachExprTrait.h:75
ForEachTrait_< VT, OP > ResultType
Result type for expression template evaluations.
Definition: SVecForEachExpr.h:143
Expression object for sparse vector transpositions.The SVecTransExpr class represents the compile tim...
Definition: Forward.h:136
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
const DMatForEachExpr< MT, Sinh, SO > sinh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic sine for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1759
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:138
Header file for the RequiresEvaluation type trait.
ReturnType value() const
Access to the current value of the sparse element.
Definition: SVecForEachExpr.h:235
ResultType_< VT > RT
Result type of the sparse vector expression.
Definition: SVecForEachExpr.h:102
const DMatForEachExpr< MT, Exp10, SO > exp10(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1579
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SVecForEachExpr.h:256
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1802
IteratorType it_
Iterator over the elements of the sparse vector expression.
Definition: SVecForEachExpr.h:285
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:129
ConstIterator_< RemoveReference_< Operand > > IteratorType
Iterator type of the sparse vector expression.
Definition: SVecForEachExpr.h:171
const DMatForEachExpr< MT, Exp, SO > exp(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1523
Constraint on the data type.
const DMatForEachExpr< MT, Trunc, SO > trunc(const DenseMatrix< MT, SO > &dm)
Applies the trunc() function to each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1158
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:343
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
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
typename ForEachTrait< T, OP >::Type ForEachTrait_
Auxiliary alias declaration for the ForEachTrait class template.The ForEachTrait_ alias declaration p...
Definition: ForEachTrait.h:146
const DMatForEachExpr< MT, Acosh, SO > acosh(const DenseMatrix< MT, SO > &dm)
Computes the inverse hyperbolic cosine for each single element of the dense matrix dm...
Definition: DMatForEachExpr.h:1905
Generic wrapper for the sqrt() function.
Definition: Sqrt.h:62
Header file for the ValueIndexPair class.
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SVecForEachExpr.h:144
typename CTransExprTrait< T >::Type CTransExprTrait_
Auxiliary alias declaration for the CTransExprTrait class template.The CTransExprTrait_ alias declara...
Definition: CTransExprTrait.h:143
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
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
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SVecForEachExpr.h:177
const DMatForEachExpr< MT, Abs, SO > abs(const DenseMatrix< MT, SO > &dm)
Applies the abs() function to each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1074
ConstIterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition: SVecForEachExpr.h:405
size_t nonZeros() const
Returns the number of non-zero elements in the sparse vector.
Definition: SVecForEachExpr.h:370
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2939
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:98
Evaluation of the expression type of a sparse vector for-each operation.Via this type trait it is pos...
Definition: TSVecForEachExprTrait.h:75
#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
size_t index() const
Access to the current index of the sparse element.
Definition: SVecForEachExpr.h:245
const DMatForEachExpr< MT, OP, SO > forEach(const DenseMatrix< MT, SO > &dm, OP op)
Evaluates the given custom operation on each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1046
Generic wrapper for the log10() function.
Definition: Log10.h:62
Header file for the Not class template.
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
const DMatForEachExpr< MT, InvCbrt, SO > invcbrt(const DenseMatrix< MT, SO > &dm)
Computes the inverse cubic root of each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1431
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.
const DMatForEachExpr< MT, Floor, SO > floor(const DenseMatrix< MT, SO > &dm)
Applies the floor() function to each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1102
const DMatForEachExpr< MT, Erf, SO > erf(const DenseMatrix< MT, SO > &dm)
Computes the error function for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:2051
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:60
const DMatForEachExpr< MT, Tan, SO > tan(const DenseMatrix< MT, SO > &dm)
Computes the tangent for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1933
Generic wrapper for the erf() function.
Definition: Erf.h:62
Compile time check for column vector types.This type trait tests whether or not the given template ar...
Definition: IsColumnVector.h:80
const DMatForEachExpr< MT, Round, SO > round(const DenseMatrix< MT, SO > &dm)
Applies the round() function to each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1186
const DMatForEachExpr< MT, Pow< ET >, SO > pow(const DenseMatrix< MT, SO > &dm, ET exp)
Computes the exponential value for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1493
Header file for the exception macros of the math module.
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecForEachExpr.h:327
ConstIterator & operator++()
Pre-increment operator.
Definition: SVecForEachExpr.h:204
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
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
const DMatForEachExpr< MT, Cosh, SO > cosh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic cosine for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1874
const DMatForEachExpr< MT, Exp2, SO > exp2(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1551
const DMatForEachExpr< MT, Sqrt, SO > sqrt(const DenseMatrix< MT, SO > &dm)
Computes the square root of each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1338
If_< IsExpression< VT >, const VT, const VT &> Operand
Composite data type of the sparse vector expression.
Definition: SVecForEachExpr.h:154
Header file for the EnableIf class template.
const DMatForEachExpr< MT, Real, SO > real(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the real part of each single element of dm.
Definition: DMatForEachExpr.h:1279
const DMatForEachExpr< MT, Atanh, SO > atanh(const DenseMatrix< MT, SO > &dm)
Computes the inverse hyperbolic tangent for each single element of the dense matrix dm...
Definition: DMatForEachExpr.h:2023
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SVecForEachExpr.h:360
const DMatForEachExpr< MT, Acos, SO > acos(const DenseMatrix< MT, SO > &dm)
Computes the inverse cosine for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1846
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2934
DifferenceType difference_type
Difference between two iterators.
Definition: SVecForEachExpr.h:184
Operand operand() const noexcept
Returns the sparse vector operand.
Definition: SVecForEachExpr.h:416
Header file for run time assertion macros.
const DMatForEachExpr< MT, InvSqrt, SO > invsqrt(const DenseMatrix< MT, SO > &dm)
Computes the inverse square root of each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1369
Generic wrapper for the pow() function.
Definition: Forward.h:80
const DMatForEachExpr< MT, Cbrt, SO > cbrt(const DenseMatrix< MT, SO > &dm)
Computes the cubic root of each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1400
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
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SVecForEachExpr.h:278
Generic wrapper for the asinh() function.
Definition: Asinh.h:62
Operand sv_
Sparse vector of the for-each expression.
Definition: SVecForEachExpr.h:467
const DMatForEachExpr< MT, Asin, SO > asin(const DenseMatrix< MT, SO > &dm)
Computes the inverse sine for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1731
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:160
#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
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:93
Compile time type negation.The Not class template negates the given compile time condition. In case the given condition would evaluate to true, the nested member enumeration is set to false and vice versa:
Definition: Not.h:70
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2938
ValueType & ReferenceType
Reference return type.
Definition: SVecForEachExpr.h:176
const DMatForEachExpr< MT, Clamp< DT >, SO > 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: DMatForEachExpr.h:1463
ValueIndexPair< ElementType > Element
Element type of the sparse vector expression.
Definition: SVecForEachExpr.h:168
Generic wrapper for the erfc() function.
Definition: Erfc.h:62
Header file for the VecForEachExpr base class.
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
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecForEachExpr.h:314
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:223
SVecForEachExpr< VT, OP, TF > This
Type of this SVecForEachExpr instance.
Definition: SVecForEachExpr.h:142
typename T::Iterator Iterator_
Alias declaration for nested Iterator type definitions.The Iterator_ alias declaration provides a con...
Definition: Aliases.h:183
PointerType pointer
Pointer return type.
Definition: SVecForEachExpr.h:182
Element ValueType
Type of the underlying pointers.
Definition: SVecForEachExpr.h:174
const DMatForEachExpr< MT, Erfc, SO > erfc(const DenseMatrix< MT, SO > &dm)
Computes the complementary error function for each single element of the dense matrix dm...
Definition: DMatForEachExpr.h:2079
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
Iterator over the elements of the sparse vector for-each expression.
Definition: SVecForEachExpr.h:163
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:73
ConstIterator(IteratorType it, OP op)
Constructor for the ConstIterator class.
Definition: SVecForEachExpr.h:193
ReturnType_< VT > RN
Return type of the sparse vector expression.
Definition: SVecForEachExpr.h:103
const DMatForEachExpr< MT, Log2, SO > log2(const DenseMatrix< MT, SO > &dm)
Computes the binary logarithm for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1641
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:733
Header file for the IsComputation type trait class.
Operation op_
The custom unary operation.
Definition: SVecForEachExpr.h:468
Generic wrapper for the acos() function.
Definition: Acos.h:62
OP op_
The custom unary operation.
Definition: SVecForEachExpr.h:286
Header file for the for-each trait.
Compile time evaluation of the size of a vector.The Size type trait evaluates the size of the given v...
Definition: Size.h:75
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:120
Generic wrapper for the round() function.
Definition: Round.h:62
const DMatForEachExpr< MT, Asinh, SO > asinh(const DenseMatrix< MT, SO > &dm)
Computes the inverse hyperbolic sine for each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1787
SVecForEachExpr(const VT &sv, OP op) noexcept
Constructor for the SVecForEachExpr class.
Definition: SVecForEachExpr.h:302
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SVecForEachExpr.h:267
Generic wrapper for the sinh() function.
Definition: Sinh.h:62
Header file for the SubvectorExprTrait class template.
Expression object for the sparse vector forEach() function.The SVecForEachExpr class represents the c...
Definition: Forward.h:127
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SVecForEachExpr.h:460
Generic wrapper for the log2() function.
Definition: Log2.h:62
ConstIterator find(size_t index) const
Searches for a specific vector element.
Definition: SVecForEachExpr.h:381
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SVecForEachExpr.h:438
Header file for the CTransExprTrait class template.
Generic wrapper for the cosh() function.
Definition: Cosh.h:62
typename ForEachExprTrait< T, OP >::Type ForEachExprTrait_
Auxiliary alias declaration for the ForEachExprTrait class template.The ForEachExprTrait_ alias decla...
Definition: ForEachExprTrait.h:144
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SVecForEachExpr.h:173
Generic wrapper for the tanh() function.
Definition: Tanh.h:62
Operation operation() const
Returns a copy of the custom operation.
Definition: SVecForEachExpr.h:426
Generic wrapper for the exp() function.
Definition: Exp.h:62
OP Operation
Data type of the custom unary operation.
Definition: SVecForEachExpr.h:157
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
IfTrue_< useAssign, const ResultType, const SVecForEachExpr &> CompositeType
Data type for composite expression templates.
Definition: SVecForEachExpr.h:151
#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
typename T::Operand Operand_
Alias declaration for nested Operand type definitions.The Operand_ alias declaration provides a conve...
Definition: Aliases.h:223
Compile time check whether the given type is an expression template.This type trait class tests wheth...
Definition: IsExpression.h:71
const DMatForEachExpr< MT, Ceil, SO > ceil(const DenseMatrix< MT, SO > &dm)
Applies the ceil() function to each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1130
ValueType value_type
Type of the underlying pointers.
Definition: SVecForEachExpr.h:181
Header file for the IsExpression type trait class.
Header file for the function trace functionality.
ConstIterator end() const
Returns an iterator just past the last non-zero element of the sparse vector.
Definition: SVecForEachExpr.h:350