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 
676  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<RT> );
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 
708  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<RT> );
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 
744  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<RT> );
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 
780  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<RT> );
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 
816  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<RT> );
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
846  friend inline EnableIf_< And< UseSMPAssign<VT2>
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
876  friend inline EnableIf_< And< UseSMPAssign<VT2>
877  , Not< IsSame< UnderlyingNumeric<VT>, UnderlyingNumeric<VT2> > > > >
878  smpAssign( DenseVector<VT2,TF>& lhs, const DVecForEachExpr& rhs )
879  {
881 
884  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<RT> );
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> >
910  smpAssign( SparseVector<VT2,TF>& lhs, const DVecForEachExpr& rhs )
911  {
913 
916  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<RT> );
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> >
942  smpAddAssign( DenseVector<VT2,TF>& lhs, const DVecForEachExpr& rhs )
943  {
945 
948  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<RT> );
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> >
978  smpSubAssign( DenseVector<VT2,TF>& lhs, const DVecForEachExpr& rhs )
979  {
981 
984  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<RT> );
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> >
1014  smpMultAssign( DenseVector<VT2,TF>& lhs, const DVecForEachExpr& rhs )
1015  {
1017 
1020  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<RT> );
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> >
1050  smpDivAssign( DenseVector<VT2,TF>& lhs, const DVecForEachExpr& rhs )
1051  {
1053 
1056  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<RT> );
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,Conj,TF>( ~dv, Conj() );
1226 }
1227 //*************************************************************************************************
1228 
1229 
1230 //*************************************************************************************************
1256 template< typename VT // Type of the dense vector
1257  , bool TF > // Transpose flag
1259 {
1261 
1262  return trans( conj( ~dv ) );
1263 }
1264 //*************************************************************************************************
1265 
1266 
1267 //*************************************************************************************************
1284 template< typename VT // Type of the dense vector
1285  , bool TF > // Transpose flag
1287 {
1289 
1290  return DVecForEachExpr<VT,Real,TF>( ~dv, Real() );
1291 }
1292 //*************************************************************************************************
1293 
1294 
1295 //*************************************************************************************************
1312 template< typename VT // Type of the dense vector
1313  , bool TF > // Transpose flag
1315 {
1317 
1318  return DVecForEachExpr<VT,Imag,TF>( ~dv, Imag() );
1319 }
1320 //*************************************************************************************************
1321 
1322 
1323 //*************************************************************************************************
1343 template< typename VT // Type of the dense vector
1344  , bool TF > // Transpose flag
1346 {
1348 
1349  return DVecForEachExpr<VT,Sqrt,TF>( ~dv, Sqrt() );
1350 }
1351 //*************************************************************************************************
1352 
1353 
1354 //*************************************************************************************************
1374 template< typename VT // Type of the dense vector
1375  , bool TF > // Transpose flag
1377 {
1379 
1380  return DVecForEachExpr<VT,InvSqrt,TF>( ~dv, InvSqrt() );
1381 }
1382 //*************************************************************************************************
1383 
1384 
1385 //*************************************************************************************************
1405 template< typename VT // Type of the dense vector
1406  , bool TF > // Transpose flag
1408 {
1410 
1411  return DVecForEachExpr<VT,Cbrt,TF>( ~dv, Cbrt() );
1412 }
1413 //*************************************************************************************************
1414 
1415 
1416 //*************************************************************************************************
1436 template< typename VT // Type of the dense vector
1437  , bool TF > // Transpose flag
1439 {
1441 
1442  return DVecForEachExpr<VT,InvCbrt,TF>( ~dv, InvCbrt() );
1443 }
1444 //*************************************************************************************************
1445 
1446 
1447 //*************************************************************************************************
1466 template< typename VT // Type of the dense vector
1467  , bool TF // Transpose flag
1468  , typename DT > // Type of the delimiters
1469 inline const DVecForEachExpr<VT,Clip<DT>,TF>
1470  clip( const DenseVector<VT,TF>& dv, const DT& min, const DT& max )
1471 {
1473 
1474  return DVecForEachExpr<VT,Clip<DT>,TF>( ~dv, Clip<DT>( min, max ) );
1475 }
1476 //*************************************************************************************************
1477 
1478 
1479 //*************************************************************************************************
1497 template< typename VT // Type of the dense vector
1498  , bool TF // Transpose flag
1499  , typename ET > // Type of the exponent
1500 inline const DVecForEachExpr<VT,Pow<ET>,TF> pow( const DenseVector<VT,TF>& dv, ET exp )
1501 {
1503 
1505 
1506  return DVecForEachExpr<VT,Pow<ET>,TF>( ~dv, Pow<ET>( exp ) );
1507 }
1508 //*************************************************************************************************
1509 
1510 
1511 //*************************************************************************************************
1528 template< typename VT // Type of the dense vector
1529  , bool TF > // Transpose flag
1531 {
1533 
1534  return DVecForEachExpr<VT,Exp,TF>( ~dv, Exp() );
1535 }
1536 //*************************************************************************************************
1537 
1538 
1539 //*************************************************************************************************
1559 template< typename VT // Type of the dense vector
1560  , bool TF > // Transpose flag
1562 {
1564 
1565  return DVecForEachExpr<VT,Log,TF>( ~dv, Log() );
1566 }
1567 //*************************************************************************************************
1568 
1569 
1570 //*************************************************************************************************
1590 template< typename VT // Type of the dense vector
1591  , bool TF > // Transpose flag
1593 {
1595 
1596  return DVecForEachExpr<VT,Log10,TF>( ~dv, Log10() );
1597 }
1598 //*************************************************************************************************
1599 
1600 
1601 //*************************************************************************************************
1618 template< typename VT // Type of the dense vector
1619  , bool TF > // Transpose flag
1621 {
1623 
1624  return DVecForEachExpr<VT,Sin,TF>( ~dv, Sin() );
1625 }
1626 //*************************************************************************************************
1627 
1628 
1629 //*************************************************************************************************
1649 template< typename VT // Type of the dense vector
1650  , bool TF > // Transpose flag
1652 {
1654 
1655  return DVecForEachExpr<VT,Asin,TF>( ~dv, Asin() );
1656 }
1657 //*************************************************************************************************
1658 
1659 
1660 //*************************************************************************************************
1677 template< typename VT // Type of the dense vector
1678  , bool TF > // Transpose flag
1680 {
1682 
1683  return DVecForEachExpr<VT,Sinh,TF>( ~dv, Sinh() );
1684 }
1685 //*************************************************************************************************
1686 
1687 
1688 //*************************************************************************************************
1705 template< typename VT // Type of the dense vector
1706  , bool TF > // Transpose flag
1708 {
1710 
1711  return DVecForEachExpr<VT,Asinh,TF>( ~dv, Asinh() );
1712 }
1713 //*************************************************************************************************
1714 
1715 
1716 //*************************************************************************************************
1733 template< typename VT // Type of the dense vector
1734  , bool TF > // Transpose flag
1736 {
1738 
1739  return DVecForEachExpr<VT,Cos,TF>( ~dv, Cos() );
1740 }
1741 //*************************************************************************************************
1742 
1743 
1744 //*************************************************************************************************
1764 template< typename VT // Type of the dense vector
1765  , bool TF > // Transpose flag
1767 {
1769 
1770  return DVecForEachExpr<VT,Acos,TF>( ~dv, Acos() );
1771 }
1772 //*************************************************************************************************
1773 
1774 
1775 //*************************************************************************************************
1792 template< typename VT // Type of the dense vector
1793  , bool TF > // Transpose flag
1795 {
1797 
1798  return DVecForEachExpr<VT,Cosh,TF>( ~dv, Cosh() );
1799 }
1800 //*************************************************************************************************
1801 
1802 
1803 //*************************************************************************************************
1823 template< typename VT // Type of the dense vector
1824  , bool TF > // Transpose flag
1826 {
1828 
1829  return DVecForEachExpr<VT,Acosh,TF>( ~dv, Acosh() );
1830 }
1831 //*************************************************************************************************
1832 
1833 
1834 //*************************************************************************************************
1851 template< typename VT // Type of the dense vector
1852  , bool TF > // Transpose flag
1854 {
1856 
1857  return DVecForEachExpr<VT,Tan,TF>( ~dv, Tan() );
1858 }
1859 //*************************************************************************************************
1860 
1861 
1862 //*************************************************************************************************
1879 template< typename VT // Type of the dense vector
1880  , bool TF > // Transpose flag
1882 {
1884 
1885  return DVecForEachExpr<VT,Atan,TF>( ~dv, Atan() );
1886 }
1887 //*************************************************************************************************
1888 
1889 
1890 //*************************************************************************************************
1910 template< typename VT // Type of the dense vector
1911  , bool TF > // Transpose flag
1913 {
1915 
1916  return DVecForEachExpr<VT,Tanh,TF>( ~dv, Tanh() );
1917 }
1918 //*************************************************************************************************
1919 
1920 
1921 //*************************************************************************************************
1941 template< typename VT // Type of the dense vector
1942  , bool TF > // Transpose flag
1944 {
1946 
1947  return DVecForEachExpr<VT,Atanh,TF>( ~dv, Atanh() );
1948 }
1949 //*************************************************************************************************
1950 
1951 
1952 //*************************************************************************************************
1969 template< typename VT // Type of the dense vector
1970  , bool TF > // Transpose flag
1972 {
1974 
1975  return DVecForEachExpr<VT,Erf,TF>( ~dv, Erf() );
1976 }
1977 //*************************************************************************************************
1978 
1979 
1980 //*************************************************************************************************
1997 template< typename VT // Type of the dense vector
1998  , bool TF > // Transpose flag
2000 {
2002 
2003  return DVecForEachExpr<VT,Erfc,TF>( ~dv, Erfc() );
2004 }
2005 //*************************************************************************************************
2006 
2007 
2008 
2009 
2010 //=================================================================================================
2011 //
2012 // GLOBAL RESTRUCTURING FUNCTIONS
2013 //
2014 //=================================================================================================
2015 
2016 //*************************************************************************************************
2027 template< typename VT // Type of the dense vector
2028  , bool TF > // Transpose flag
2029 inline const DVecForEachExpr<VT,Abs,TF>& abs( const DVecForEachExpr<VT,Abs,TF>& dv )
2030 {
2032 
2033  return dv;
2034 }
2036 //*************************************************************************************************
2037 
2038 
2039 //*************************************************************************************************
2050 template< typename VT // Type of the dense vector
2051  , bool TF > // Transpose flag
2052 inline const DVecForEachExpr<VT,Floor,TF>& floor( const DVecForEachExpr<VT,Floor,TF>& dv )
2053 {
2055 
2056  return dv;
2057 }
2059 //*************************************************************************************************
2060 
2061 
2062 //*************************************************************************************************
2073 template< typename VT // Type of the dense vector
2074  , bool TF > // Transpose flag
2075 inline const DVecForEachExpr<VT,Ceil,TF>& ceil( const DVecForEachExpr<VT,Ceil,TF>& dv )
2076 {
2078 
2079  return dv;
2080 }
2082 //*************************************************************************************************
2083 
2084 
2085 //*************************************************************************************************
2103 template< typename VT // Type of the dense vector
2104  , bool TF > // Transpose flag
2105 inline typename DVecForEachExpr<VT,Conj,TF>::Operand conj( const DVecForEachExpr<VT,Conj,TF>& dv )
2106 {
2108 
2109  return dv.operand();
2110 }
2112 //*************************************************************************************************
2113 
2114 
2115 //*************************************************************************************************
2133 template< typename VT // Type of the dense vector
2134  , bool TF > // Transpose flag
2135 inline const DVecTransExpr<VT,!TF> conj( const DVecTransExpr<DVecForEachExpr<VT,Conj,TF>,!TF>& dv )
2136 {
2138 
2139  return DVecTransExpr<VT,!TF>( dv.operand().operand() );
2140 }
2142 //*************************************************************************************************
2143 
2144 
2145 //*************************************************************************************************
2156 template< typename VT // Type of the dense vector
2157  , bool TF > // Transpose flag
2158 inline const DVecForEachExpr<VT,Real,TF>& real( const DVecForEachExpr<VT,Real,TF>& dv )
2159 {
2161 
2162  return dv;
2163 }
2165 //*************************************************************************************************
2166 
2167 
2168 
2169 
2170 //=================================================================================================
2171 //
2172 // SIZE SPECIALIZATIONS
2173 //
2174 //=================================================================================================
2175 
2176 //*************************************************************************************************
2178 template< typename VT, typename OP, bool TF >
2179 struct Size< DVecForEachExpr<VT,OP,TF> > : public Size<VT>
2180 {};
2182 //*************************************************************************************************
2183 
2184 
2185 
2186 
2187 //=================================================================================================
2188 //
2189 // ISALIGNED SPECIALIZATIONS
2190 //
2191 //=================================================================================================
2192 
2193 //*************************************************************************************************
2195 template< typename VT, typename OP, bool TF >
2196 struct IsAligned< DVecForEachExpr<VT,OP,TF> >
2197  : public BoolConstant< IsAligned<VT>::value >
2198 {};
2200 //*************************************************************************************************
2201 
2202 
2203 
2204 
2205 //=================================================================================================
2206 //
2207 // ISPADDED SPECIALIZATIONS
2208 //
2209 //=================================================================================================
2210 
2211 //*************************************************************************************************
2213 template< typename VT, typename OP, bool TF >
2214 struct IsPadded< DVecForEachExpr<VT,OP,TF> >
2215  : public BoolConstant< IsPadded<VT>::value >
2216 {};
2218 //*************************************************************************************************
2219 
2220 
2221 
2222 
2223 //=================================================================================================
2224 //
2225 // EXPRESSION TRAIT SPECIALIZATIONS
2226 //
2227 //=================================================================================================
2228 
2229 //*************************************************************************************************
2231 template< typename VT >
2232 struct DVecForEachExprTrait< DVecForEachExpr<VT,Abs,false>, Abs >
2233 {
2234  public:
2235  //**********************************************************************************************
2236  using Type = If_< And< IsDenseVector<VT>, IsColumnVector<VT> >
2237  , DVecForEachExpr<VT,Abs,false>
2238  , INVALID_TYPE >;
2239  //**********************************************************************************************
2240 };
2242 //*************************************************************************************************
2243 
2244 
2245 //*************************************************************************************************
2247 template< typename VT >
2248 struct TDVecForEachExprTrait< DVecForEachExpr<VT,Abs,true>, Abs >
2249 {
2250  public:
2251  //**********************************************************************************************
2252  using Type = If_< And< IsDenseVector<VT>, IsRowVector<VT> >
2253  , DVecForEachExpr<VT,Abs,true>
2254  , INVALID_TYPE >;
2255  //**********************************************************************************************
2256 };
2258 //*************************************************************************************************
2259 
2260 
2261 //*************************************************************************************************
2263 template< typename VT >
2264 struct DVecForEachExprTrait< DVecForEachExpr<VT,Floor,false>, Floor >
2265 {
2266  public:
2267  //**********************************************************************************************
2268  using Type = If_< And< IsDenseVector<VT>, IsColumnVector<VT> >
2269  , DVecForEachExpr<VT,Floor,false>
2270  , INVALID_TYPE >;
2271  //**********************************************************************************************
2272 };
2274 //*************************************************************************************************
2275 
2276 
2277 //*************************************************************************************************
2279 template< typename VT >
2280 struct TDVecForEachExprTrait< DVecForEachExpr<VT,Floor,true>, Floor >
2281 {
2282  public:
2283  //**********************************************************************************************
2284  using Type = If_< And< IsDenseVector<VT>, IsRowVector<VT> >
2285  , DVecForEachExpr<VT,Floor,true>
2286  , INVALID_TYPE >;
2287  //**********************************************************************************************
2288 };
2290 //*************************************************************************************************
2291 
2292 
2293 //*************************************************************************************************
2295 template< typename VT >
2296 struct DVecForEachExprTrait< DVecForEachExpr<VT,Ceil,false>, Ceil >
2297 {
2298  public:
2299  //**********************************************************************************************
2300  using Type = If_< And< IsDenseVector<VT>, IsColumnVector<VT> >
2301  , DVecForEachExpr<VT,Ceil,false>
2302  , INVALID_TYPE >;
2303  //**********************************************************************************************
2304 };
2306 //*************************************************************************************************
2307 
2308 
2309 //*************************************************************************************************
2311 template< typename VT >
2312 struct TDVecForEachExprTrait< DVecForEachExpr<VT,Ceil,true>, Ceil >
2313 {
2314  public:
2315  //**********************************************************************************************
2316  using Type = If_< And< IsDenseVector<VT>, IsRowVector<VT> >
2317  , DVecForEachExpr<VT,Ceil,true>
2318  , INVALID_TYPE >;
2319  //**********************************************************************************************
2320 };
2322 //*************************************************************************************************
2323 
2324 
2325 //*************************************************************************************************
2327 template< typename VT >
2328 struct DVecForEachExprTrait< DVecForEachExpr<VT,Conj,false>, Conj >
2329 {
2330  public:
2331  //**********************************************************************************************
2332  using Type = If_< And< IsDenseVector<VT>, IsColumnVector<VT> >
2333  , Operand_< DVecForEachExpr<VT,Conj,false> >
2334  , INVALID_TYPE >;
2335  //**********************************************************************************************
2336 };
2338 //*************************************************************************************************
2339 
2340 
2341 //*************************************************************************************************
2343 template< typename VT >
2344 struct TDVecForEachExprTrait< DVecForEachExpr<VT,Conj,true>, Conj >
2345 {
2346  public:
2347  //**********************************************************************************************
2348  using Type = If_< And< IsDenseVector<VT>, IsRowVector<VT> >
2349  , Operand_< DVecForEachExpr<VT,Conj,true> >
2350  , INVALID_TYPE >;
2351  //**********************************************************************************************
2352 };
2354 //*************************************************************************************************
2355 
2356 
2357 //*************************************************************************************************
2359 template< typename VT >
2360 struct DVecForEachExprTrait< DVecTransExpr< DVecForEachExpr<VT,Conj,true>, false >, Conj >
2361 {
2362  public:
2363  //**********************************************************************************************
2364  using Type = If_< And< IsDenseVector<VT>, IsRowVector<VT> >
2365  , DVecTransExpr<VT,false>
2366  , INVALID_TYPE >;
2367  //**********************************************************************************************
2368 };
2370 //*************************************************************************************************
2371 
2372 
2373 //*************************************************************************************************
2375 template< typename VT >
2376 struct TDVecForEachExprTrait< DVecTransExpr< DVecForEachExpr<VT,Conj,false>, true >, Conj >
2377 {
2378  public:
2379  //**********************************************************************************************
2380  using Type = If_< And< IsDenseVector<VT>, IsColumnVector<VT> >
2381  , DVecTransExpr<VT,true>
2382  , INVALID_TYPE >;
2383  //**********************************************************************************************
2384 };
2386 //*************************************************************************************************
2387 
2388 
2389 //*************************************************************************************************
2391 template< typename VT >
2392 struct DVecForEachExprTrait< DVecForEachExpr<VT,Real,false>, Real >
2393 {
2394  public:
2395  //**********************************************************************************************
2396  using Type = If_< And< IsDenseVector<VT>, IsColumnVector<VT> >
2397  , DVecForEachExpr<VT,Real,false>
2398  , INVALID_TYPE >;
2399  //**********************************************************************************************
2400 };
2402 //*************************************************************************************************
2403 
2404 
2405 //*************************************************************************************************
2407 template< typename VT >
2408 struct TDVecForEachExprTrait< DVecForEachExpr<VT,Real,true>, Real >
2409 {
2410  public:
2411  //**********************************************************************************************
2412  using Type = If_< And< IsDenseVector<VT>, IsRowVector<VT> >
2413  , DVecForEachExpr<VT,Real,true>
2414  , INVALID_TYPE >;
2415  //**********************************************************************************************
2416 };
2418 //*************************************************************************************************
2419 
2420 
2421 //*************************************************************************************************
2423 template< typename VT, typename OP, bool TF, bool AF >
2424 struct SubvectorExprTrait< DVecForEachExpr<VT,OP,TF>, AF >
2425 {
2426  public:
2427  //**********************************************************************************************
2428  using Type = ForEachExprTrait_< SubvectorExprTrait_<const VT,AF>, OP >;
2429  //**********************************************************************************************
2430 };
2432 //*************************************************************************************************
2433 
2434 } // namespace blaze
2435 
2436 #endif
Header file for the UnderlyingNumeric type trait.
Pointer difference type of the Blaze library.
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:1158
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:1498
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:1557
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecForEachExpr.h:287
Generic wrapper for the cbrt() function.
Definition: Cbrt.h:62
Header file for basic type definitions.
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:1529
Generic wrapper for the sin() function.
Definition: Sin.h:62
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
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:1849
DVecForEachExpr(const VT &dv, OP op) noexcept
Constructor for the DVecForEachExpr class.
Definition: DVecForEachExpr.h:444
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecForEachExpr.h:505
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
const CTransExprTrait_< MT > ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatForEachExpr.h:1195
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:1672
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:1818
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:1251
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecForEachExpr.h:515
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
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecForEachExpr.h:569
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:1669
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:723
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:1616
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.
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:1716
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
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecForEachExpr.h:483
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:1467
Constraint on the data type.
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
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:1762
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
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
ElementType ValueType
Type of the underlying elements.
Definition: DVecForEachExpr.h:188
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
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:1375
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecForEachExpr.h:256
Header file for the IsAligned type trait.
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:1908
#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:1790
Generic wrapper for the erf() function.
Definition: Erf.h:62
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:1437
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecForEachExpr.h:579
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecForEachExpr.h:245
Header file for the exception macros of the math module.
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecForEachExpr.h:352
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:1731
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:1282
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:1223
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecForEachExpr.h:547
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:1880
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecForEachExpr.h:559
Generic wrapper for the clip() function.
Definition: Clip.h:60
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:1703
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecForEachExpr.h:308
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2642
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:1313
Generic wrapper for the pow() function.
Definition: Forward.h:72
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:1344
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
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecForEachExpr.h:374
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:1588
ReferenceType reference
Reference return type.
Definition: DVecForEachExpr.h:197
Operand operand() const noexcept
Returns the dense vector operand.
Definition: DVecForEachExpr.h:525
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
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
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
ElementType_< VT > ET
Element type of the dense vector expression.
Definition: DVecForEachExpr.h:107
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecForEachExpr.h:266
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
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecForEachExpr.h:469
Header file for the VecForEachExpr base class.
Generic wrapper for the cos() function.
Definition: Cos.h:62
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecForEachExpr.h:456
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecForEachExpr.h:341
const DMatForEachExpr< MT, Clip< DT >, SO > clip(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:1407
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
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:1936
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
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:950
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.
Generic wrapper for the atan() function.
Definition: Atan.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:157
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:1644
Generic wrapper for the sinh() function.
Definition: Sinh.h:62
Header file for the IntegralConstant class template.
Header file for the SubvectorExprTrait class template.
ReturnType_< VT > RN
Return type of the dense vector expression.
Definition: DVecForEachExpr.h:108
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
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecForEachExpr.h:330
Header file for the CTransExprTrait class template.
Generic wrapper for the cosh() function.
Definition: Cosh.h:62
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecForEachExpr.h:319
ResultType_< VT > RT
Result type of the dense vector expression.
Definition: DVecForEachExpr.h:106
Generic wrapper for the tanh() function.
Definition: Tanh.h:62
Generic wrapper for the exp() function.
Definition: Exp.h:62
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecForEachExpr.h:363
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
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
Operation operation() const
Returns a copy of the custom operation.
Definition: DVecForEachExpr.h:535
Header file for the IsExpression type trait class.
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecForEachExpr.h:297
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecForEachExpr.h:495
Header file for the FunctionTrace class.
IteratorType it_
Iterator to the current vector element.
Definition: DVecForEachExpr.h:417