DVecForEachExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DVECFOREACHEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DVECFOREACHEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <utility>
45 #include <blaze/math/Aliases.h>
48 #include <blaze/math/Exception.h>
53 #include <blaze/math/Functors.h>
55 #include <blaze/math/SIMD.h>
67 #include <blaze/system/Inline.h>
68 #include <blaze/util/Assert.h>
70 #include <blaze/util/EnableIf.h>
73 #include <blaze/util/mpl/And.h>
74 #include <blaze/util/mpl/If.h>
75 #include <blaze/util/mpl/Not.h>
76 #include <blaze/util/Template.h>
77 #include <blaze/util/Types.h>
80 
81 
82 namespace blaze {
83 
84 //=================================================================================================
85 //
86 // CLASS DVECFOREACHEXPR
87 //
88 //=================================================================================================
89 
90 //*************************************************************************************************
97 template< typename VT // Type of the dense vector
98  , typename OP // Type of the custom operation
99  , bool TF > // Transpose flag
100 class DVecForEachExpr : public DenseVector< DVecForEachExpr<VT,OP,TF>, TF >
101  , private VecForEachExpr
102  , private Computation
103 {
104  private:
105  //**Type definitions****************************************************************************
106  typedef ResultType_<VT> RT;
108  typedef ReturnType_<VT> RN;
109 
111  BLAZE_CREATE_HAS_DATA_OR_FUNCTION_MEMBER_TYPE_TRAIT( HasSIMDEnabled, simdEnabled );
112 
115  //**********************************************************************************************
116 
117  //**Serial evaluation strategy******************************************************************
119 
125  enum : bool { useAssign = RequiresEvaluation<VT>::value };
126 
128  template< typename VT2 >
130  struct UseAssign {
131  enum : bool { value = useAssign };
132  };
134  //**********************************************************************************************
135 
136  //**Parallel evaluation strategy****************************************************************
138 
144  template< typename VT2 >
145  struct UseSMPAssign {
146  enum : bool { value = ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign };
147  };
149  //**********************************************************************************************
150 
151  //**SIMD support detection**********************************************************************
153  struct UseSIMDEnabledFlag {
155  enum : bool { value = OP::BLAZE_TEMPLATE simdEnabled<ET>() };
156  };
158  //**********************************************************************************************
159 
160  public:
161  //**Type definitions****************************************************************************
166 
168  typedef decltype( std::declval<OP>()( std::declval<RN>() ) ) ReturnType;
169 
171  typedef IfTrue_< useAssign, const ResultType, const DVecForEachExpr& > CompositeType;
172 
174  typedef If_< IsExpression<VT>, const VT, const VT& > Operand;
175 
177  typedef OP Operation;
178  //**********************************************************************************************
179 
180  //**ConstIterator class definition**************************************************************
184  {
185  public:
186  //**Type definitions*************************************************************************
187  typedef std::random_access_iterator_tag IteratorCategory;
188  typedef ElementType ValueType;
189  typedef ElementType* PointerType;
190  typedef ElementType& ReferenceType;
192 
193  // STL iterator requirements
194  typedef IteratorCategory iterator_category;
195  typedef ValueType value_type;
196  typedef PointerType pointer;
197  typedef ReferenceType reference;
198  typedef DifferenceType difference_type;
199 
202  //*******************************************************************************************
203 
204  //**Constructor******************************************************************************
210  explicit inline ConstIterator( IteratorType it, OP op )
211  : it_( it ) // Iterator to the current vector element
212  , op_( op ) // The custom unary operation
213  {}
214  //*******************************************************************************************
215 
216  //**Addition assignment operator*************************************************************
222  inline ConstIterator& operator+=( size_t inc ) {
223  it_ += inc;
224  return *this;
225  }
226  //*******************************************************************************************
227 
228  //**Subtraction assignment operator**********************************************************
234  inline ConstIterator& operator-=( size_t dec ) {
235  it_ -= dec;
236  return *this;
237  }
238  //*******************************************************************************************
239 
240  //**Prefix increment operator****************************************************************
245  inline ConstIterator& operator++() {
246  ++it_;
247  return *this;
248  }
249  //*******************************************************************************************
250 
251  //**Postfix increment operator***************************************************************
256  inline const ConstIterator operator++( int ) {
257  return ConstIterator( it_++ );
258  }
259  //*******************************************************************************************
260 
261  //**Prefix decrement operator****************************************************************
266  inline ConstIterator& operator--() {
267  --it_;
268  return *this;
269  }
270  //*******************************************************************************************
271 
272  //**Postfix decrement operator***************************************************************
277  inline const ConstIterator operator--( int ) {
278  return ConstIterator( it_-- );
279  }
280  //*******************************************************************************************
281 
282  //**Element access operator******************************************************************
287  inline ReturnType operator*() const {
288  return op_( *it_ );
289  }
290  //*******************************************************************************************
291 
292  //**Load function****************************************************************************
297  inline auto load() const noexcept {
298  return op_.load( it_.load() );
299  }
300  //*******************************************************************************************
301 
302  //**Equality operator************************************************************************
308  inline bool operator==( const ConstIterator& rhs ) const {
309  return it_ == rhs.it_;
310  }
311  //*******************************************************************************************
312 
313  //**Inequality operator**********************************************************************
319  inline bool operator!=( const ConstIterator& rhs ) const {
320  return it_ != rhs.it_;
321  }
322  //*******************************************************************************************
323 
324  //**Less-than operator***********************************************************************
330  inline bool operator<( const ConstIterator& rhs ) const {
331  return it_ < rhs.it_;
332  }
333  //*******************************************************************************************
334 
335  //**Greater-than operator********************************************************************
341  inline bool operator>( const ConstIterator& rhs ) const {
342  return it_ > rhs.it_;
343  }
344  //*******************************************************************************************
345 
346  //**Less-or-equal-than operator**************************************************************
352  inline bool operator<=( const ConstIterator& rhs ) const {
353  return it_ <= rhs.it_;
354  }
355  //*******************************************************************************************
356 
357  //**Greater-or-equal-than operator***********************************************************
363  inline bool operator>=( const ConstIterator& rhs ) const {
364  return it_ >= rhs.it_;
365  }
366  //*******************************************************************************************
367 
368  //**Subtraction operator*********************************************************************
374  inline DifferenceType operator-( const ConstIterator& rhs ) const {
375  return it_ - rhs.it_;
376  }
377  //*******************************************************************************************
378 
379  //**Addition operator************************************************************************
386  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
387  return ConstIterator( it.it_ + inc );
388  }
389  //*******************************************************************************************
390 
391  //**Addition operator************************************************************************
398  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
399  return ConstIterator( it.it_ + inc );
400  }
401  //*******************************************************************************************
402 
403  //**Subtraction operator*********************************************************************
410  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
411  return ConstIterator( it.it_ - dec );
412  }
413  //*******************************************************************************************
414 
415  private:
416  //**Member variables*************************************************************************
417  IteratorType it_;
418  OP op_;
419  //*******************************************************************************************
420  };
421  //**********************************************************************************************
422 
423  public:
424  //**Compilation flags***************************************************************************
426  enum : bool { simdEnabled = VT::simdEnabled &&
427  If_< HasSIMDEnabled<OP>, UseSIMDEnabledFlag, HasLoad<OP> >::value };
428 
430  enum : bool { smpAssignable = VT::smpAssignable };
431  //**********************************************************************************************
432 
433  //**SIMD properties*****************************************************************************
435  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
436  //**********************************************************************************************
437 
438  //**Constructor*********************************************************************************
444  explicit inline DVecForEachExpr( const VT& dv, OP op ) noexcept
445  : dv_( dv ) // Dense vector of the for-each expression
446  , op_( op ) // The custom unary operation
447  {}
448  //**********************************************************************************************
449 
450  //**Subscript operator**************************************************************************
456  inline ReturnType operator[]( size_t index ) const {
457  BLAZE_INTERNAL_ASSERT( index < dv_.size(), "Invalid vector access index" );
458  return op_( dv_[index] );
459  }
460  //**********************************************************************************************
461 
462  //**At function*********************************************************************************
469  inline ReturnType at( size_t index ) const {
470  if( index >= dv_.size() ) {
471  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
472  }
473  return (*this)[index];
474  }
475  //**********************************************************************************************
476 
477  //**Load function*******************************************************************************
483  BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
484  BLAZE_INTERNAL_ASSERT( index < dv_.size() , "Invalid vector access index" );
485  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
486  return op_.load( dv_.load( index ) );
487  }
488  //**********************************************************************************************
489 
490  //**Begin function******************************************************************************
495  inline ConstIterator begin() const {
496  return ConstIterator( dv_.begin(), op_ );
497  }
498  //**********************************************************************************************
499 
500  //**End function********************************************************************************
505  inline ConstIterator end() const {
506  return ConstIterator( dv_.end(), op_ );
507  }
508  //**********************************************************************************************
509 
510  //**Size function*******************************************************************************
515  inline size_t size() const noexcept {
516  return dv_.size();
517  }
518  //**********************************************************************************************
519 
520  //**Operand access******************************************************************************
525  inline Operand operand() const noexcept {
526  return dv_;
527  }
528  //**********************************************************************************************
529 
530  //**Operation access****************************************************************************
535  inline Operation operation() const {
536  return op_;
537  }
538  //**********************************************************************************************
539 
540  //**********************************************************************************************
546  template< typename T >
547  inline bool canAlias( const T* alias ) const noexcept {
548  return IsComputation<VT>::value && dv_.canAlias( alias );
549  }
550  //**********************************************************************************************
551 
552  //**********************************************************************************************
558  template< typename T >
559  inline bool isAliased( const T* alias ) const noexcept {
560  return dv_.isAliased( alias );
561  }
562  //**********************************************************************************************
563 
564  //**********************************************************************************************
569  inline bool isAligned() const noexcept {
570  return dv_.isAligned();
571  }
572  //**********************************************************************************************
573 
574  //**********************************************************************************************
579  inline bool canSMPAssign() const noexcept {
580  return dv_.canSMPAssign();
581  }
582  //**********************************************************************************************
583 
584  private:
585  //**Member variables****************************************************************************
588  //**********************************************************************************************
589 
590  //**Assignment to dense vectors*****************************************************************
605  template< typename VT2 > // Type of the target dense vector
606  friend inline EnableIf_< And< UseAssign<VT2>
608  assign( DenseVector<VT2,TF>& lhs, const DVecForEachExpr& rhs )
609  {
611 
612  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
613 
614  assign( ~lhs, rhs.dv_ );
615  assign( ~lhs, forEach( ~lhs, rhs.op_ ) );
616  }
618  //**********************************************************************************************
619 
620  //**Assignment to dense vectors*****************************************************************
635  template< typename VT2 > // Type of the target dense vector
636  friend inline EnableIf_< And< UseAssign<VT2>
638  assign( DenseVector<VT2,TF>& lhs, const DVecForEachExpr& rhs )
639  {
641 
645 
646  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
647 
648  const RT tmp( serial( rhs.dv_ ) );
649  assign( ~lhs, forEach( tmp, rhs.op_ ) );
650  }
652  //**********************************************************************************************
653 
654  //**Assignment to sparse vectors****************************************************************
668  template< typename VT2 > // Type of the target sparse vector
669  friend inline EnableIf_< UseAssign<VT2> >
670  assign( SparseVector<VT2,TF>& lhs, const DVecForEachExpr& rhs )
671  {
673 
677 
678  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
679 
680  const RT tmp( serial( rhs.dv_ ) );
681  assign( ~lhs, forEach( tmp, rhs.op_ ) );
682  }
684  //**********************************************************************************************
685 
686  //**Addition assignment to dense vectors********************************************************
700  template< typename VT2 > // Type of the target dense vector
701  friend inline EnableIf_< UseAssign<VT2> >
702  addAssign( DenseVector<VT2,TF>& lhs, const DVecForEachExpr& rhs )
703  {
705 
709 
710  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
711 
712  const RT tmp( serial( rhs.dv_ ) );
713  addAssign( ~lhs, forEach( tmp, rhs.op_ ) );
714  }
716  //**********************************************************************************************
717 
718  //**Addition assignment to sparse vectors*******************************************************
719  // No special implementation for the addition assignment to sparse vectors.
720  //**********************************************************************************************
721 
722  //**Subtraction assignment to dense vectors*****************************************************
736  template< typename VT2 > // Type of the target dense vector
737  friend inline EnableIf_< UseAssign<VT2> >
738  subAssign( DenseVector<VT2,TF>& lhs, const DVecForEachExpr& rhs )
739  {
741 
745 
746  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
747 
748  const RT tmp( serial( rhs.dv_ ) );
749  subAssign( ~lhs, forEach( tmp, rhs.op_ ) );
750  }
752  //**********************************************************************************************
753 
754  //**Subtraction assignment to sparse vectors****************************************************
755  // No special implementation for the subtraction assignment to sparse vectors.
756  //**********************************************************************************************
757 
758  //**Multiplication assignment to dense vectors**************************************************
772  template< typename VT2 > // Type of the target dense vector
773  friend inline EnableIf_< UseAssign<VT2> >
774  multAssign( DenseVector<VT2,TF>& lhs, const DVecForEachExpr& rhs )
775  {
777 
781 
782  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
783 
784  const RT tmp( serial( rhs.dv_ ) );
785  multAssign( ~lhs, forEach( tmp, rhs.op_ ) );
786  }
788  //**********************************************************************************************
789 
790  //**Multiplication assignment to sparse vectors*************************************************
791  // No special implementation for the multiplication assignment to sparse vectors.
792  //**********************************************************************************************
793 
794  //**Division assignment to dense vectors********************************************************
808  template< typename VT2 > // Type of the target dense vector
809  friend inline EnableIf_< UseAssign<VT2> >
810  divAssign( DenseVector<VT2,TF>& lhs, const DVecForEachExpr& rhs )
811  {
813 
817 
818  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
819 
820  const RT tmp( serial( rhs.dv_ ) );
821  divAssign( ~lhs, forEach( tmp, rhs.op_ ) );
822  }
824  //**********************************************************************************************
825 
826  //**Division assignment to sparse vectors*******************************************************
827  // No special implementation for the division assignment to sparse vectors.
828  //**********************************************************************************************
829 
830  //**SMP assignment to dense vectors*************************************************************
845  template< typename VT2 > // Type of the target dense vector
847  , IsSame< UnderlyingNumeric<VT>, UnderlyingNumeric<VT2> > > >
848  smpAssign( DenseVector<VT2,TF>& lhs, const DVecForEachExpr& rhs )
849  {
851 
852  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
853 
854  smpAssign( ~lhs, rhs.dv_ );
855  smpAssign( ~lhs, rhs.op_( ~lhs ) );
856  }
858  //**********************************************************************************************
859 
860  //**SMP assignment to dense vectors*************************************************************
875  template< typename VT2 > // Type of the target dense vector
877  , Not< IsSame< UnderlyingNumeric<VT>, UnderlyingNumeric<VT2> > > > >
878  smpAssign( DenseVector<VT2,TF>& lhs, const DVecForEachExpr& rhs )
879  {
881 
885 
886  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
887 
888  const RT tmp( rhs.dv_ );
889  smpAssign( ~lhs, forEach( tmp, rhs.op_ ) );
890  }
892  //**********************************************************************************************
893 
894  //**SMP assignment to sparse vectors************************************************************
908  template< typename VT2 > // Type of the target sparse vector
909  friend inline EnableIf_< UseSMPAssign<VT2> >
911  {
913 
917 
918  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
919 
920  const RT tmp( rhs.dv_ );
921  smpAssign( ~lhs, forEach( tmp, rhs.op_ ) );
922  }
924  //**********************************************************************************************
925 
926  //**SMP addition assignment to dense vectors****************************************************
940  template< typename VT2 > // Type of the target dense vector
941  friend inline EnableIf_< UseSMPAssign<VT2> >
943  {
945 
949 
950  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
951 
952  const RT tmp( rhs.dv_ );
953  smpAddAssign( ~lhs, forEach( tmp, rhs.op_ ) );
954  }
956  //**********************************************************************************************
957 
958  //**SMP addition assignment to sparse vectors***************************************************
959  // No special implementation for the SMP addition assignment to sparse vectors.
960  //**********************************************************************************************
961 
962  //**SMP subtraction assignment to dense vectors*************************************************
976  template< typename VT2 > // Type of the target dense vector
977  friend inline EnableIf_< UseSMPAssign<VT2> >
979  {
981 
985 
986  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
987 
988  const RT tmp( rhs.dv_ );
989  smpSubAssign( ~lhs, forEach( tmp, rhs.op_ ) );
990  }
992  //**********************************************************************************************
993 
994  //**SMP subtraction assignment to sparse vectors************************************************
995  // No special implementation for the SMP subtraction assignment to sparse vectors.
996  //**********************************************************************************************
997 
998  //**SMP multiplication assignment to dense vectors**********************************************
1012  template< typename VT2 > // Type of the target dense vector
1013  friend inline EnableIf_< UseSMPAssign<VT2> >
1015  {
1017 
1021 
1022  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
1023 
1024  const RT tmp( rhs.dv_ );
1025  smpMultAssign( ~lhs, forEach( tmp, rhs.op_ ) );
1026  }
1028  //**********************************************************************************************
1029 
1030  //**SMP multiplication assignment to sparse vectors*********************************************
1031  // No special implementation for the SMP multiplication assignment to sparse vectors.
1032  //**********************************************************************************************
1033 
1034  //**SMP division assignment to dense vectors****************************************************
1048  template< typename VT2 > // Type of the target dense vector
1049  friend inline EnableIf_< UseSMPAssign<VT2> >
1051  {
1053 
1057 
1058  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
1059 
1060  const RT tmp( rhs.dv_ );
1061  smpDivAssign( ~lhs, forEach( tmp, rhs.op_ ) );
1062  }
1064  //**********************************************************************************************
1065 
1066  //**SMP division assignment to sparse vectors***************************************************
1067  // No special implementation for the SMP division assignment to sparse vectors.
1068  //**********************************************************************************************
1069 
1070  //**Compile time checks*************************************************************************
1075  //**********************************************************************************************
1076 };
1077 //*************************************************************************************************
1078 
1079 
1080 
1081 
1082 //=================================================================================================
1083 //
1084 // GLOBAL FUNCTIONS
1085 //
1086 //=================================================================================================
1087 
1088 //*************************************************************************************************
1106 template< typename VT // Type of the dense vector
1107  , bool TF // Transpose flag
1108  , typename OP > // Type of the custom operation
1109 inline const DVecForEachExpr<VT,OP,TF> forEach( const DenseVector<VT,TF>& dv, OP op )
1110 {
1112 
1113  return DVecForEachExpr<VT,OP,TF>( ~dv, op );
1114 }
1115 //*************************************************************************************************
1116 
1117 
1118 //*************************************************************************************************
1135 template< typename VT // Type of the dense vector
1136  , bool TF > // Transpose flag
1138 {
1140 
1141  return DVecForEachExpr<VT,Abs,TF>( ~dv, Abs() );
1142 }
1143 //*************************************************************************************************
1144 
1145 
1146 //*************************************************************************************************
1163 template< typename VT // Type of the dense vector
1164  , bool TF > // Transpose flag
1166 {
1168 
1169  return DVecForEachExpr<VT,Floor,TF>( ~dv, Floor() );
1170 }
1171 //*************************************************************************************************
1172 
1173 
1174 //*************************************************************************************************
1191 template< typename VT // Type of the dense vector
1192  , bool TF > // Transpose flag
1194 {
1196 
1197  return DVecForEachExpr<VT,Ceil,TF>( ~dv, Ceil() );
1198 }
1199 //*************************************************************************************************
1200 
1201 
1202 //*************************************************************************************************
1219 template< typename VT // Type of the dense vector
1220  , bool TF > // Transpose flag
1222 {
1224 
1225  return DVecForEachExpr<VT,Trunc,TF>( ~dv, Trunc() );
1226 }
1227 //*************************************************************************************************
1228 
1229 
1230 //*************************************************************************************************
1247 template< typename VT // Type of the dense vector
1248  , bool TF > // Transpose flag
1250 {
1252 
1253  return DVecForEachExpr<VT,Round,TF>( ~dv, Round() );
1254 }
1255 //*************************************************************************************************
1256 
1257 
1258 //*************************************************************************************************
1275 template< typename VT // Type of the dense vector
1276  , bool TF > // Transpose flag
1278 {
1280 
1281  return DVecForEachExpr<VT,Conj,TF>( ~dv, Conj() );
1282 }
1283 //*************************************************************************************************
1284 
1285 
1286 //*************************************************************************************************
1312 template< typename VT // Type of the dense vector
1313  , bool TF > // Transpose flag
1315 {
1317 
1318  return trans( conj( ~dv ) );
1319 }
1320 //*************************************************************************************************
1321 
1322 
1323 //*************************************************************************************************
1340 template< typename VT // Type of the dense vector
1341  , bool TF > // Transpose flag
1343 {
1345 
1346  return DVecForEachExpr<VT,Real,TF>( ~dv, Real() );
1347 }
1348 //*************************************************************************************************
1349 
1350 
1351 //*************************************************************************************************
1368 template< typename VT // Type of the dense vector
1369  , bool TF > // Transpose flag
1371 {
1373 
1374  return DVecForEachExpr<VT,Imag,TF>( ~dv, Imag() );
1375 }
1376 //*************************************************************************************************
1377 
1378 
1379 //*************************************************************************************************
1399 template< typename VT // Type of the dense vector
1400  , bool TF > // Transpose flag
1402 {
1404 
1405  return DVecForEachExpr<VT,Sqrt,TF>( ~dv, Sqrt() );
1406 }
1407 //*************************************************************************************************
1408 
1409 
1410 //*************************************************************************************************
1430 template< typename VT // Type of the dense vector
1431  , bool TF > // Transpose flag
1433 {
1435 
1436  return DVecForEachExpr<VT,InvSqrt,TF>( ~dv, InvSqrt() );
1437 }
1438 //*************************************************************************************************
1439 
1440 
1441 //*************************************************************************************************
1461 template< typename VT // Type of the dense vector
1462  , bool TF > // Transpose flag
1464 {
1466 
1467  return DVecForEachExpr<VT,Cbrt,TF>( ~dv, Cbrt() );
1468 }
1469 //*************************************************************************************************
1470 
1471 
1472 //*************************************************************************************************
1492 template< typename VT // Type of the dense vector
1493  , bool TF > // Transpose flag
1495 {
1497 
1498  return DVecForEachExpr<VT,InvCbrt,TF>( ~dv, InvCbrt() );
1499 }
1500 //*************************************************************************************************
1501 
1502 
1503 //*************************************************************************************************
1522 template< typename VT // Type of the dense vector
1523  , bool TF // Transpose flag
1524  , typename DT > // Type of the delimiters
1525 inline const DVecForEachExpr<VT,Clamp<DT>,TF>
1526  clamp( const DenseVector<VT,TF>& dv, const DT& min, const DT& max )
1527 {
1529 
1530  return DVecForEachExpr<VT,Clamp<DT>,TF>( ~dv, Clamp<DT>( min, max ) );
1531 }
1532 //*************************************************************************************************
1533 
1534 
1535 //*************************************************************************************************
1553 template< typename VT // Type of the dense vector
1554  , bool TF // Transpose flag
1555  , typename ET > // Type of the exponent
1556 inline const DVecForEachExpr<VT,Pow<ET>,TF> pow( const DenseVector<VT,TF>& dv, ET exp )
1557 {
1559 
1561 
1562  return DVecForEachExpr<VT,Pow<ET>,TF>( ~dv, Pow<ET>( exp ) );
1563 }
1564 //*************************************************************************************************
1565 
1566 
1567 //*************************************************************************************************
1584 template< typename VT // Type of the dense vector
1585  , bool TF > // Transpose flag
1587 {
1589 
1590  return DVecForEachExpr<VT,Exp,TF>( ~dv, Exp() );
1591 }
1592 //*************************************************************************************************
1593 
1594 
1595 //*************************************************************************************************
1612 template< typename VT // Type of the dense vector
1613  , bool TF > // Transpose flag
1615 {
1617 
1618  return DVecForEachExpr<VT,Exp2,TF>( ~dv, Exp2() );
1619 }
1620 //*************************************************************************************************
1621 
1622 
1623 //*************************************************************************************************
1640 template< typename VT // Type of the dense vector
1641  , bool TF > // Transpose flag
1643 {
1645 
1646  return DVecForEachExpr<VT,Exp10,TF>( ~dv, Exp10() );
1647 }
1648 //*************************************************************************************************
1649 
1650 
1651 //*************************************************************************************************
1671 template< typename VT // Type of the dense vector
1672  , bool TF > // Transpose flag
1674 {
1676 
1677  return DVecForEachExpr<VT,Log,TF>( ~dv, Log() );
1678 }
1679 //*************************************************************************************************
1680 
1681 
1682 //*************************************************************************************************
1702 template< typename VT // Type of the dense vector
1703  , bool TF > // Transpose flag
1705 {
1707 
1708  return DVecForEachExpr<VT,Log2,TF>( ~dv, Log2() );
1709 }
1710 //*************************************************************************************************
1711 
1712 
1713 //*************************************************************************************************
1733 template< typename VT // Type of the dense vector
1734  , bool TF > // Transpose flag
1736 {
1738 
1739  return DVecForEachExpr<VT,Log10,TF>( ~dv, Log10() );
1740 }
1741 //*************************************************************************************************
1742 
1743 
1744 //*************************************************************************************************
1761 template< typename VT // Type of the dense vector
1762  , bool TF > // Transpose flag
1764 {
1766 
1767  return DVecForEachExpr<VT,Sin,TF>( ~dv, Sin() );
1768 }
1769 //*************************************************************************************************
1770 
1771 
1772 //*************************************************************************************************
1792 template< typename VT // Type of the dense vector
1793  , bool TF > // Transpose flag
1795 {
1797 
1798  return DVecForEachExpr<VT,Asin,TF>( ~dv, Asin() );
1799 }
1800 //*************************************************************************************************
1801 
1802 
1803 //*************************************************************************************************
1820 template< typename VT // Type of the dense vector
1821  , bool TF > // Transpose flag
1823 {
1825 
1826  return DVecForEachExpr<VT,Sinh,TF>( ~dv, Sinh() );
1827 }
1828 //*************************************************************************************************
1829 
1830 
1831 //*************************************************************************************************
1848 template< typename VT // Type of the dense vector
1849  , bool TF > // Transpose flag
1851 {
1853 
1854  return DVecForEachExpr<VT,Asinh,TF>( ~dv, Asinh() );
1855 }
1856 //*************************************************************************************************
1857 
1858 
1859 //*************************************************************************************************
1876 template< typename VT // Type of the dense vector
1877  , bool TF > // Transpose flag
1879 {
1881 
1882  return DVecForEachExpr<VT,Cos,TF>( ~dv, Cos() );
1883 }
1884 //*************************************************************************************************
1885 
1886 
1887 //*************************************************************************************************
1907 template< typename VT // Type of the dense vector
1908  , bool TF > // Transpose flag
1910 {
1912 
1913  return DVecForEachExpr<VT,Acos,TF>( ~dv, Acos() );
1914 }
1915 //*************************************************************************************************
1916 
1917 
1918 //*************************************************************************************************
1935 template< typename VT // Type of the dense vector
1936  , bool TF > // Transpose flag
1938 {
1940 
1941  return DVecForEachExpr<VT,Cosh,TF>( ~dv, Cosh() );
1942 }
1943 //*************************************************************************************************
1944 
1945 
1946 //*************************************************************************************************
1966 template< typename VT // Type of the dense vector
1967  , bool TF > // Transpose flag
1969 {
1971 
1972  return DVecForEachExpr<VT,Acosh,TF>( ~dv, Acosh() );
1973 }
1974 //*************************************************************************************************
1975 
1976 
1977 //*************************************************************************************************
1994 template< typename VT // Type of the dense vector
1995  , bool TF > // Transpose flag
1997 {
1999 
2000  return DVecForEachExpr<VT,Tan,TF>( ~dv, Tan() );
2001 }
2002 //*************************************************************************************************
2003 
2004 
2005 //*************************************************************************************************
2022 template< typename VT // Type of the dense vector
2023  , bool TF > // Transpose flag
2025 {
2027 
2028  return DVecForEachExpr<VT,Atan,TF>( ~dv, Atan() );
2029 }
2030 //*************************************************************************************************
2031 
2032 
2033 //*************************************************************************************************
2053 template< typename VT // Type of the dense vector
2054  , bool TF > // Transpose flag
2056 {
2058 
2059  return DVecForEachExpr<VT,Tanh,TF>( ~dv, Tanh() );
2060 }
2061 //*************************************************************************************************
2062 
2063 
2064 //*************************************************************************************************
2084 template< typename VT // Type of the dense vector
2085  , bool TF > // Transpose flag
2087 {
2089 
2090  return DVecForEachExpr<VT,Atanh,TF>( ~dv, Atanh() );
2091 }
2092 //*************************************************************************************************
2093 
2094 
2095 //*************************************************************************************************
2112 template< typename VT // Type of the dense vector
2113  , bool TF > // Transpose flag
2115 {
2117 
2118  return DVecForEachExpr<VT,Erf,TF>( ~dv, Erf() );
2119 }
2120 //*************************************************************************************************
2121 
2122 
2123 //*************************************************************************************************
2140 template< typename VT // Type of the dense vector
2141  , bool TF > // Transpose flag
2143 {
2145 
2146  return DVecForEachExpr<VT,Erfc,TF>( ~dv, Erfc() );
2147 }
2148 //*************************************************************************************************
2149 
2150 
2151 
2152 
2153 //=================================================================================================
2154 //
2155 // GLOBAL RESTRUCTURING FUNCTIONS
2156 //
2157 //=================================================================================================
2158 
2159 //*************************************************************************************************
2170 template< typename VT // Type of the dense vector
2171  , bool TF > // Transpose flag
2173 {
2175 
2176  return dv;
2177 }
2179 //*************************************************************************************************
2180 
2181 
2182 //*************************************************************************************************
2193 template< typename VT // Type of the dense vector
2194  , bool TF > // Transpose flag
2196 {
2198 
2199  return dv;
2200 }
2202 //*************************************************************************************************
2203 
2204 
2205 //*************************************************************************************************
2216 template< typename VT // Type of the dense vector
2217  , bool TF > // Transpose flag
2219 {
2221 
2222  return dv;
2223 }
2225 //*************************************************************************************************
2226 
2227 
2228 //*************************************************************************************************
2239 template< typename VT // Type of the dense vector
2240  , bool TF > // Transpose flag
2242 {
2244 
2245  return dv;
2246 }
2248 //*************************************************************************************************
2249 
2250 
2251 //*************************************************************************************************
2262 template< typename VT // Type of the dense vector
2263  , bool TF > // Transpose flag
2265 {
2267 
2268  return dv;
2269 }
2271 //*************************************************************************************************
2272 
2273 
2274 //*************************************************************************************************
2292 template< typename VT // Type of the dense vector
2293  , bool TF > // Transpose flag
2295 {
2297 
2298  return dv.operand();
2299 }
2301 //*************************************************************************************************
2302 
2303 
2304 //*************************************************************************************************
2322 template< typename VT // Type of the dense vector
2323  , bool TF > // Transpose flag
2325 {
2327 
2328  return DVecTransExpr<VT,!TF>( dv.operand().operand() );
2329 }
2331 //*************************************************************************************************
2332 
2333 
2334 //*************************************************************************************************
2345 template< typename VT // Type of the dense vector
2346  , bool TF > // Transpose flag
2348 {
2350 
2351  return dv;
2352 }
2354 //*************************************************************************************************
2355 
2356 
2357 
2358 
2359 //=================================================================================================
2360 //
2361 // SIZE SPECIALIZATIONS
2362 //
2363 //=================================================================================================
2364 
2365 //*************************************************************************************************
2367 template< typename VT, typename OP, bool TF >
2368 struct Size< DVecForEachExpr<VT,OP,TF> > : public Size<VT>
2369 {};
2371 //*************************************************************************************************
2372 
2373 
2374 
2375 
2376 //=================================================================================================
2377 //
2378 // ISALIGNED SPECIALIZATIONS
2379 //
2380 //=================================================================================================
2381 
2382 //*************************************************************************************************
2384 template< typename VT, typename OP, bool TF >
2385 struct IsAligned< DVecForEachExpr<VT,OP,TF> >
2386  : public BoolConstant< IsAligned<VT>::value >
2387 {};
2389 //*************************************************************************************************
2390 
2391 
2392 
2393 
2394 //=================================================================================================
2395 //
2396 // ISPADDED SPECIALIZATIONS
2397 //
2398 //=================================================================================================
2399 
2400 //*************************************************************************************************
2402 template< typename VT, typename OP, bool TF >
2403 struct IsPadded< DVecForEachExpr<VT,OP,TF> >
2404  : public BoolConstant< IsPadded<VT>::value >
2405 {};
2407 //*************************************************************************************************
2408 
2409 
2410 
2411 
2412 //=================================================================================================
2413 //
2414 // EXPRESSION TRAIT SPECIALIZATIONS
2415 //
2416 //=================================================================================================
2417 
2418 //*************************************************************************************************
2420 template< typename VT >
2421 struct DVecForEachExprTrait< DVecForEachExpr<VT,Abs,false>, Abs >
2422 {
2423  public:
2424  //**********************************************************************************************
2427  , INVALID_TYPE >;
2428  //**********************************************************************************************
2429 };
2431 //*************************************************************************************************
2432 
2433 
2434 //*************************************************************************************************
2436 template< typename VT >
2437 struct TDVecForEachExprTrait< DVecForEachExpr<VT,Abs,true>, Abs >
2438 {
2439  public:
2440  //**********************************************************************************************
2443  , INVALID_TYPE >;
2444  //**********************************************************************************************
2445 };
2447 //*************************************************************************************************
2448 
2449 
2450 //*************************************************************************************************
2452 template< typename VT >
2453 struct DVecForEachExprTrait< DVecForEachExpr<VT,Floor,false>, Floor >
2454 {
2455  public:
2456  //**********************************************************************************************
2459  , INVALID_TYPE >;
2460  //**********************************************************************************************
2461 };
2463 //*************************************************************************************************
2464 
2465 
2466 //*************************************************************************************************
2468 template< typename VT >
2469 struct TDVecForEachExprTrait< DVecForEachExpr<VT,Floor,true>, Floor >
2470 {
2471  public:
2472  //**********************************************************************************************
2475  , INVALID_TYPE >;
2476  //**********************************************************************************************
2477 };
2479 //*************************************************************************************************
2480 
2481 
2482 //*************************************************************************************************
2484 template< typename VT >
2485 struct DVecForEachExprTrait< DVecForEachExpr<VT,Ceil,false>, Ceil >
2486 {
2487  public:
2488  //**********************************************************************************************
2491  , INVALID_TYPE >;
2492  //**********************************************************************************************
2493 };
2495 //*************************************************************************************************
2496 
2497 
2498 //*************************************************************************************************
2500 template< typename VT >
2501 struct TDVecForEachExprTrait< DVecForEachExpr<VT,Ceil,true>, Ceil >
2502 {
2503  public:
2504  //**********************************************************************************************
2507  , INVALID_TYPE >;
2508  //**********************************************************************************************
2509 };
2511 //*************************************************************************************************
2512 
2513 
2514 //*************************************************************************************************
2516 template< typename VT >
2517 struct DVecForEachExprTrait< DVecForEachExpr<VT,Trunc,false>, Trunc >
2518 {
2519  public:
2520  //**********************************************************************************************
2523  , INVALID_TYPE >;
2524  //**********************************************************************************************
2525 };
2527 //*************************************************************************************************
2528 
2529 
2530 //*************************************************************************************************
2532 template< typename VT >
2533 struct TDVecForEachExprTrait< DVecForEachExpr<VT,Trunc,true>, Trunc >
2534 {
2535  public:
2536  //**********************************************************************************************
2539  , INVALID_TYPE >;
2540  //**********************************************************************************************
2541 };
2543 //*************************************************************************************************
2544 
2545 
2546 //*************************************************************************************************
2548 template< typename VT >
2549 struct DVecForEachExprTrait< DVecForEachExpr<VT,Round,false>, Round >
2550 {
2551  public:
2552  //**********************************************************************************************
2555  , INVALID_TYPE >;
2556  //**********************************************************************************************
2557 };
2559 //*************************************************************************************************
2560 
2561 
2562 //*************************************************************************************************
2564 template< typename VT >
2565 struct TDVecForEachExprTrait< DVecForEachExpr<VT,Round,true>, Round >
2566 {
2567  public:
2568  //**********************************************************************************************
2571  , INVALID_TYPE >;
2572  //**********************************************************************************************
2573 };
2575 //*************************************************************************************************
2576 
2577 
2578 //*************************************************************************************************
2580 template< typename VT >
2581 struct DVecForEachExprTrait< DVecForEachExpr<VT,Conj,false>, Conj >
2582 {
2583  public:
2584  //**********************************************************************************************
2587  , INVALID_TYPE >;
2588  //**********************************************************************************************
2589 };
2591 //*************************************************************************************************
2592 
2593 
2594 //*************************************************************************************************
2596 template< typename VT >
2597 struct TDVecForEachExprTrait< DVecForEachExpr<VT,Conj,true>, Conj >
2598 {
2599  public:
2600  //**********************************************************************************************
2603  , INVALID_TYPE >;
2604  //**********************************************************************************************
2605 };
2607 //*************************************************************************************************
2608 
2609 
2610 //*************************************************************************************************
2612 template< typename VT >
2613 struct DVecForEachExprTrait< DVecTransExpr< DVecForEachExpr<VT,Conj,true>, false >, Conj >
2614 {
2615  public:
2616  //**********************************************************************************************
2619  , INVALID_TYPE >;
2620  //**********************************************************************************************
2621 };
2623 //*************************************************************************************************
2624 
2625 
2626 //*************************************************************************************************
2628 template< typename VT >
2629 struct TDVecForEachExprTrait< DVecTransExpr< DVecForEachExpr<VT,Conj,false>, true >, Conj >
2630 {
2631  public:
2632  //**********************************************************************************************
2635  , INVALID_TYPE >;
2636  //**********************************************************************************************
2637 };
2639 //*************************************************************************************************
2640 
2641 
2642 //*************************************************************************************************
2644 template< typename VT >
2645 struct DVecForEachExprTrait< DVecForEachExpr<VT,Real,false>, Real >
2646 {
2647  public:
2648  //**********************************************************************************************
2651  , INVALID_TYPE >;
2652  //**********************************************************************************************
2653 };
2655 //*************************************************************************************************
2656 
2657 
2658 //*************************************************************************************************
2660 template< typename VT >
2661 struct TDVecForEachExprTrait< DVecForEachExpr<VT,Real,true>, Real >
2662 {
2663  public:
2664  //**********************************************************************************************
2667  , INVALID_TYPE >;
2668  //**********************************************************************************************
2669 };
2671 //*************************************************************************************************
2672 
2673 
2674 //*************************************************************************************************
2676 template< typename VT, typename OP, bool TF, bool AF >
2677 struct SubvectorExprTrait< DVecForEachExpr<VT,OP,TF>, AF >
2678 {
2679  public:
2680  //**********************************************************************************************
2682  //**********************************************************************************************
2683 };
2685 //*************************************************************************************************
2686 
2687 } // namespace blaze
2688 
2689 #endif
Header file for the UnderlyingNumeric type trait.
Generic wrapper for the trunc() function.
Definition: Trunc.h:62
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecForEachExpr.h:505
Pointer difference type of the Blaze library.
Operand operand() const noexcept
Returns the dense vector operand.
Definition: DVecForEachExpr.h:525
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.
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:72
Generic wrapper for the ceil() function.
Definition: Ceil.h:62
DifferenceType difference_type
Difference between two iterators.
Definition: DVecForEachExpr.h:198
BLAZE_CREATE_HAS_DATA_OR_FUNCTION_MEMBER_TYPE_TRAIT(HasSIMDEnabled, simdEnabled)
Definition of the HasSIMDEnabled type trait.
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
Header file for basic type definitions.
Evaluation of the expression type of a dense vector custom operation.Via this type trait it is possib...
Definition: TDVecForEachExprTrait.h:75
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecForEachExpr.h:308
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
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecForEachExpr.h:569
Operand dv_
Dense vector of the for-each expression.
Definition: DVecForEachExpr.h:586
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
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecForEachExpr.h:374
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
DVecForEachExpr(const VT &dv, OP op) noexcept
Constructor for the DVecForEachExpr class.
Definition: DVecForEachExpr.h:444
const CTransExprTrait_< MT > ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatForEachExpr.h:1251
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecForEachExpr.h:297
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
Header file for the IsSame and IsStrictlySame type traits.
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecForEachExpr.h:287
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
Generic wrapper for the clamp() function.
Definition: Clamp.h:60
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecForEachExpr.h:559
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
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecForEachExpr.h:222
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
Header file for the DenseVector base class.
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
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecForEachExpr.h:469
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
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecForEachExpr.h:191
Header file for the RequiresEvaluation type trait.
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
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
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
ElementType * PointerType
Pointer return type.
Definition: DVecForEachExpr.h:189
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecForEachExpr.h:579
IteratorCategory iterator_category
The iterator category.
Definition: DVecForEachExpr.h:194
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
Compile time check for the alignment of data types.This type trait tests whether the given data type ...
Definition: IsAligned.h:87
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecForEachExpr.h:363
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
PointerType pointer
Pointer return type.
Definition: DVecForEachExpr.h:196
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
Iterator over the elements of the dense vector.
Definition: DVecForEachExpr.h:183
OP op_
The custom unary operation.
Definition: DVecForEachExpr.h:418
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecForEachExpr.h:277
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
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for nested template disabiguation.
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
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
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecForEachExpr.h:483
ElementType ValueType
Type of the underlying elements.
Definition: DVecForEachExpr.h:188
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2939
Compile time check for data types with padding.This type trait tests whether the given data type empl...
Definition: IsPadded.h:76
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
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecForEachExpr.h:234
#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
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
Header file for all SIMD functionality.
Base class for all vector for-each expression templates.The VecForEachExpr class serves as a tag for ...
Definition: VecForEachExpr.h:65
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecForEachExpr.h:398
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
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecForEachExpr.h:330
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecForEachExpr.h:256
Header file for the IsAligned type trait.
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
Constraint on the data type.
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
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecForEachExpr.h:245
Header file for the exception macros of the math module.
DVecForEachExpr< VT, OP, TF > This
Type of this DVecForEachExpr instance.
Definition: DVecForEachExpr.h:162
Evaluation of the underlying numeric element type of a given data type.Via this type trait it is poss...
Definition: UnderlyingNumeric.h:81
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecForEachExpr.h:164
Header file for all forward declarations for expression class templates.
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
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
Header file for the IsPadded type trait.
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
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
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecForEachExpr.h:352
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2934
ConstIterator(IteratorType it, OP op)
Constructor for the ConstIterator class.
Definition: DVecForEachExpr.h:210
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
Generic wrapper for the asinh() function.
Definition: Asinh.h:62
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecForEachExpr.h:456
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
ReferenceType reference
Reference return type.
Definition: DVecForEachExpr.h:197
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecForEachExpr.h:410
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
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecForEachExpr.h:547
EnableIf_< IsDenseVector< VT1 > > smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:222
#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
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:296
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecForEachExpr.h:495
#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
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecForEachExpr.h:386
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecForEachExpr.h:341
ElementType_< VT > ET
Element type of the dense vector expression.
Definition: DVecForEachExpr.h:107
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecForEachExpr.h:266
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
Evaluation of the expression type of a dense vector custom operation.Via this type trait it is possib...
Definition: DVecForEachExprTrait.h:75
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecForEachExpr.h:187
Generic wrapper for the erfc() function.
Definition: Erfc.h:62
Header file for the HasMember type traits.
ValueType value_type
Type of the underlying elements.
Definition: DVecForEachExpr.h:195
Header file for the VecForEachExpr base class.
Generic wrapper for the cos() function.
Definition: Cos.h:62
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
If_< IsExpression< VT >, const VT, const VT &> Operand
Composite data type of the dense vector expression.
Definition: DVecForEachExpr.h:174
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecForEachExpr.h:515
ConstIterator_< VT > IteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecForEachExpr.h:201
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
ForEachTrait_< VT, OP > ResultType
Result type for expression template evaluations.
Definition: DVecForEachExpr.h:163
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
Operation op_
The custom unary operation.
Definition: DVecForEachExpr.h:587
ElementType_< ResultType > ElementType
Resulting element type.
Definition: DVecForEachExpr.h:165
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
OP Operation
Data type of the custom unary operation.
Definition: DVecForEachExpr.h:177
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.
Generic wrapper for the acos() function.
Definition: Acos.h:62
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:59
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
Generic wrapper for the sinh() function.
Definition: Sinh.h:62
Header file for the IntegralConstant class template.
Header file for the SubvectorExprTrait class template.
Expression object for dense vector transpositions.The DVecTransExpr class represents the compile time...
Definition: DVecTransExpr.h:97
ReturnType_< VT > RN
Return type of the dense vector expression.
Definition: DVecForEachExpr.h:108
Generic wrapper for the log2() function.
Definition: Log2.h:62
Operation operation() const
Returns a copy of the custom operation.
Definition: DVecForEachExpr.h:535
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
Expression object for the dense vector forEach() function.The DVecForEachExpr class represents the co...
Definition: DVecForEachExpr.h:100
Header file for the CTransExprTrait class template.
Generic wrapper for the cosh() function.
Definition: Cosh.h:62
ResultType_< VT > RT
Result type of the dense vector expression.
Definition: DVecForEachExpr.h:106
typename ForEachExprTrait< T, OP >::Type ForEachExprTrait_
Auxiliary alias declaration for the ForEachExprTrait class template.The ForEachExprTrait_ alias decla...
Definition: ForEachExprTrait.h:144
Generic wrapper for the tanh() function.
Definition: Tanh.h:62
Generic wrapper for the exp() function.
Definition: Exp.h:62
System settings for the inline keywords.
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
IfTrue_< useAssign, const ResultType, const DVecForEachExpr &> CompositeType
Data type for composite expression templates.
Definition: DVecForEachExpr.h:171
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
ElementType & ReferenceType
Reference return type.
Definition: DVecForEachExpr.h:190
Header file for the IsExpression type trait class.
Header file for the function trace functionality.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecForEachExpr.h:319
IteratorType it_
Iterator to the current vector element.
Definition: DVecForEachExpr.h:417