Blaze  3.6
DVecMapExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DVECMAPEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DVECMAPEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <utility>
45 #include <blaze/math/Aliases.h>
49 #include <blaze/math/Exception.h>
54 #include <blaze/math/Functors.h>
56 #include <blaze/math/SIMD.h>
73 #include <blaze/system/Inline.h>
74 #include <blaze/util/Assert.h>
75 #include <blaze/util/EnableIf.h>
78 #include <blaze/util/mpl/If.h>
79 #include <blaze/util/Types.h>
82 
83 
84 namespace blaze {
85 
86 //=================================================================================================
87 //
88 // CLASS DVECMAPEXPR
89 //
90 //=================================================================================================
91 
92 //*************************************************************************************************
99 template< typename VT // Type of the dense vector
100  , typename OP // Type of the custom operation
101  , bool TF > // Transpose flag
103  : public VecMapExpr< DenseVector< DVecMapExpr<VT,OP,TF>, TF > >
104  , private Computation
105 {
106  private:
107  //**Type definitions****************************************************************************
111  //**********************************************************************************************
112 
113  //**Serial evaluation strategy******************************************************************
115 
121  static constexpr bool useAssign = ( IsComputation_v<VT> && RequiresEvaluation_v<VT> );
122 
124  template< typename VT2 >
126  static constexpr bool UseAssign_v = useAssign;
128  //**********************************************************************************************
129 
130  //**Parallel evaluation strategy****************************************************************
132 
138  template< typename VT2 >
139  static constexpr bool UseSMPAssign_v =
140  ( ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign );
142  //**********************************************************************************************
143 
144  public:
145  //**Type definitions****************************************************************************
151 
153  using ReturnType = decltype( std::declval<OP>()( std::declval<RN>() ) );
154 
157 
159  using Operand = If_t< IsExpression_v<VT>, const VT, const VT& >;
160 
162  using Operation = OP;
163  //**********************************************************************************************
164 
165  //**ConstIterator class definition**************************************************************
169  {
170  public:
171  //**Type definitions*************************************************************************
172  using IteratorCategory = std::random_access_iterator_tag;
177 
178  // STL iterator requirements
184 
187  //*******************************************************************************************
188 
189  //**Constructor******************************************************************************
195  explicit inline BLAZE_DEVICE_CALLABLE ConstIterator( IteratorType it, OP op )
196  : it_( it ) // Iterator to the current vector element
197  , op_( op ) // The custom unary operation
198  {}
199  //*******************************************************************************************
200 
201  //**Addition assignment operator*************************************************************
208  it_ += inc;
209  return *this;
210  }
211  //*******************************************************************************************
212 
213  //**Subtraction assignment operator**********************************************************
220  it_ -= dec;
221  return *this;
222  }
223  //*******************************************************************************************
224 
225  //**Prefix increment operator****************************************************************
231  ++it_;
232  return *this;
233  }
234  //*******************************************************************************************
235 
236  //**Postfix increment operator***************************************************************
242  return ConstIterator( it_++, op_ );
243  }
244  //*******************************************************************************************
245 
246  //**Prefix decrement operator****************************************************************
252  --it_;
253  return *this;
254  }
255  //*******************************************************************************************
256 
257  //**Postfix decrement operator***************************************************************
263  return ConstIterator( it_--, op_ );
264  }
265  //*******************************************************************************************
266 
267  //**Element access operator******************************************************************
273  return op_( *it_ );
274  }
275  //*******************************************************************************************
276 
277  //**Load function****************************************************************************
282  inline auto load() const noexcept {
283  return op_.load( it_.load() );
284  }
285  //*******************************************************************************************
286 
287  //**Equality operator************************************************************************
293  inline BLAZE_DEVICE_CALLABLE bool operator==( const ConstIterator& rhs ) const {
294  return it_ == rhs.it_;
295  }
296  //*******************************************************************************************
297 
298  //**Inequality operator**********************************************************************
304  inline BLAZE_DEVICE_CALLABLE bool operator!=( const ConstIterator& rhs ) const {
305  return it_ != rhs.it_;
306  }
307  //*******************************************************************************************
308 
309  //**Less-than operator***********************************************************************
315  inline BLAZE_DEVICE_CALLABLE bool operator<( const ConstIterator& rhs ) const {
316  return it_ < rhs.it_;
317  }
318  //*******************************************************************************************
319 
320  //**Greater-than operator********************************************************************
326  inline BLAZE_DEVICE_CALLABLE bool operator>( const ConstIterator& rhs ) const {
327  return it_ > rhs.it_;
328  }
329  //*******************************************************************************************
330 
331  //**Less-or-equal-than operator**************************************************************
337  inline BLAZE_DEVICE_CALLABLE bool operator<=( const ConstIterator& rhs ) const {
338  return it_ <= rhs.it_;
339  }
340  //*******************************************************************************************
341 
342  //**Greater-or-equal-than operator***********************************************************
348  inline BLAZE_DEVICE_CALLABLE bool operator>=( const ConstIterator& rhs ) const {
349  return it_ >= rhs.it_;
350  }
351  //*******************************************************************************************
352 
353  //**Subtraction operator*********************************************************************
360  return it_ - rhs.it_;
361  }
362  //*******************************************************************************************
363 
364  //**Addition operator************************************************************************
371  friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
372  return ConstIterator( it.it_ + inc, it.op_ );
373  }
374  //*******************************************************************************************
375 
376  //**Addition operator************************************************************************
383  friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
384  return ConstIterator( it.it_ + inc, it.op_ );
385  }
386  //*******************************************************************************************
387 
388  //**Subtraction operator*********************************************************************
395  friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
396  return ConstIterator( it.it_ - dec, it.op_ );
397  }
398  //*******************************************************************************************
399 
400  private:
401  //**Member variables*************************************************************************
403  OP op_;
404  //*******************************************************************************************
405  };
406  //**********************************************************************************************
407 
408  public:
409  //**Compilation flags***************************************************************************
411  static constexpr bool simdEnabled =
412  ( VT::simdEnabled &&
413  If_t< HasSIMDEnabled_v<OP>, GetSIMDEnabled<OP,ET>, HasLoad<OP> >::value );
414 
416  static constexpr bool smpAssignable = VT::smpAssignable;
417  //**********************************************************************************************
418 
419  //**SIMD properties*****************************************************************************
421  static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
422  //**********************************************************************************************
423 
424  //**Constructor*********************************************************************************
430  explicit inline DVecMapExpr( const VT& dv, OP op ) noexcept
431  : dv_( dv ) // Dense vector of the map expression
432  , op_( op ) // The custom unary operation
433  {}
434  //**********************************************************************************************
435 
436  //**Subscript operator**************************************************************************
442  inline ReturnType operator[]( size_t index ) const {
443  BLAZE_INTERNAL_ASSERT( index < dv_.size(), "Invalid vector access index" );
444  return op_( dv_[index] );
445  }
446  //**********************************************************************************************
447 
448  //**At function*********************************************************************************
455  inline ReturnType at( size_t index ) const {
456  if( index >= dv_.size() ) {
457  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
458  }
459  return (*this)[index];
460  }
461  //**********************************************************************************************
462 
463  //**Load function*******************************************************************************
469  BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
470  BLAZE_INTERNAL_ASSERT( index < dv_.size() , "Invalid vector access index" );
471  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
472  return op_.load( dv_.load( index ) );
473  }
474  //**********************************************************************************************
475 
476  //**Begin function******************************************************************************
481  inline ConstIterator begin() const {
482  return ConstIterator( dv_.begin(), op_ );
483  }
484  //**********************************************************************************************
485 
486  //**End function********************************************************************************
491  inline ConstIterator end() const {
492  return ConstIterator( dv_.end(), op_ );
493  }
494  //**********************************************************************************************
495 
496  //**Size function*******************************************************************************
501  inline size_t size() const noexcept {
502  return dv_.size();
503  }
504  //**********************************************************************************************
505 
506  //**Operand access******************************************************************************
511  inline Operand operand() const noexcept {
512  return dv_;
513  }
514  //**********************************************************************************************
515 
516  //**Operation access****************************************************************************
521  inline Operation operation() const {
522  return op_;
523  }
524  //**********************************************************************************************
525 
526  //**********************************************************************************************
532  template< typename T >
533  inline bool canAlias( const T* alias ) const noexcept {
534  return IsExpression_v<VT> && dv_.canAlias( alias );
535  }
536  //**********************************************************************************************
537 
538  //**********************************************************************************************
544  template< typename T >
545  inline bool isAliased( const T* alias ) const noexcept {
546  return dv_.isAliased( alias );
547  }
548  //**********************************************************************************************
549 
550  //**********************************************************************************************
555  inline bool isAligned() const noexcept {
556  return dv_.isAligned();
557  }
558  //**********************************************************************************************
559 
560  //**********************************************************************************************
565  inline bool canSMPAssign() const noexcept {
566  return dv_.canSMPAssign();
567  }
568  //**********************************************************************************************
569 
570  private:
571  //**Member variables****************************************************************************
574  //**********************************************************************************************
575 
576  //**Assignment to dense vectors*****************************************************************
591  template< typename VT2 > // Type of the target dense vector
592  friend inline auto assign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
594  IsSame_v< UnderlyingNumeric_t<VT>, UnderlyingNumeric_t<VT2> > >
595  {
597 
598  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
599 
600  assign( ~lhs, rhs.dv_ );
601  assign( ~lhs, map( ~lhs, rhs.op_ ) );
602  }
604  //**********************************************************************************************
605 
606  //**Assignment to dense vectors*****************************************************************
621  template< typename VT2 > // Type of the target dense vector
622  friend inline auto assign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
624  !IsSame_v< UnderlyingNumeric_t<VT>, UnderlyingNumeric_t<VT2> > >
625  {
627 
631 
632  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
633 
634  const RT tmp( serial( rhs.dv_ ) );
635  assign( ~lhs, map( tmp, rhs.op_ ) );
636  }
638  //**********************************************************************************************
639 
640  //**Assignment to sparse vectors****************************************************************
654  template< typename VT2 > // Type of the target sparse vector
655  friend inline auto assign( SparseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
656  -> EnableIf_t< UseAssign_v<VT2> >
657  {
659 
663 
664  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
665 
666  const RT tmp( serial( rhs.dv_ ) );
667  assign( ~lhs, map( tmp, rhs.op_ ) );
668  }
670  //**********************************************************************************************
671 
672  //**Addition assignment to dense vectors********************************************************
686  template< typename VT2 > // Type of the target dense vector
687  friend inline auto addAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
688  -> EnableIf_t< UseAssign_v<VT2> >
689  {
691 
695 
696  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
697 
698  const RT tmp( serial( rhs.dv_ ) );
699  addAssign( ~lhs, map( tmp, rhs.op_ ) );
700  }
702  //**********************************************************************************************
703 
704  //**Addition assignment to sparse vectors*******************************************************
705  // No special implementation for the addition assignment to sparse vectors.
706  //**********************************************************************************************
707 
708  //**Subtraction assignment to dense vectors*****************************************************
722  template< typename VT2 > // Type of the target dense vector
723  friend inline auto subAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
724  -> EnableIf_t< UseAssign_v<VT2> >
725  {
727 
731 
732  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
733 
734  const RT tmp( serial( rhs.dv_ ) );
735  subAssign( ~lhs, map( tmp, rhs.op_ ) );
736  }
738  //**********************************************************************************************
739 
740  //**Subtraction assignment to sparse vectors****************************************************
741  // No special implementation for the subtraction assignment to sparse vectors.
742  //**********************************************************************************************
743 
744  //**Multiplication assignment to dense vectors**************************************************
758  template< typename VT2 > // Type of the target dense vector
759  friend inline auto multAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
760  -> EnableIf_t< UseAssign_v<VT2> >
761  {
763 
767 
768  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
769 
770  const RT tmp( serial( rhs.dv_ ) );
771  multAssign( ~lhs, map( tmp, rhs.op_ ) );
772  }
774  //**********************************************************************************************
775 
776  //**Multiplication assignment to sparse vectors*************************************************
777  // No special implementation for the multiplication assignment to sparse vectors.
778  //**********************************************************************************************
779 
780  //**Division assignment to dense vectors********************************************************
794  template< typename VT2 > // Type of the target dense vector
795  friend inline auto divAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
796  -> EnableIf_t< UseAssign_v<VT2> >
797  {
799 
803 
804  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
805 
806  const RT tmp( serial( rhs.dv_ ) );
807  divAssign( ~lhs, map( tmp, rhs.op_ ) );
808  }
810  //**********************************************************************************************
811 
812  //**Division assignment to sparse vectors*******************************************************
813  // No special implementation for the division assignment to sparse vectors.
814  //**********************************************************************************************
815 
816  //**SMP assignment to dense vectors*************************************************************
831  template< typename VT2 > // Type of the target dense vector
832  friend inline auto smpAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
833  -> EnableIf_t< UseSMPAssign_v<VT2> &&
834  IsSame_v< UnderlyingNumeric_t<VT>, UnderlyingNumeric_t<VT2> > >
835  {
837 
838  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
839 
840  smpAssign( ~lhs, rhs.dv_ );
841  smpAssign( ~lhs, map( ~lhs, rhs.op_ ) );
842  }
844  //**********************************************************************************************
845 
846  //**SMP assignment to dense vectors*************************************************************
861  template< typename VT2 > // Type of the target dense vector
862  friend inline auto smpAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
863  -> EnableIf_t< UseSMPAssign_v<VT2> &&
864  !IsSame_v< UnderlyingNumeric_t<VT>, UnderlyingNumeric_t<VT2> > >
865  {
867 
871 
872  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
873 
874  const RT tmp( rhs.dv_ );
875  smpAssign( ~lhs, map( tmp, rhs.op_ ) );
876  }
878  //**********************************************************************************************
879 
880  //**SMP assignment to sparse vectors************************************************************
894  template< typename VT2 > // Type of the target sparse vector
895  friend inline auto smpAssign( SparseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
896  -> EnableIf_t< UseSMPAssign_v<VT2> >
897  {
899 
903 
904  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
905 
906  const RT tmp( rhs.dv_ );
907  smpAssign( ~lhs, map( tmp, rhs.op_ ) );
908  }
910  //**********************************************************************************************
911 
912  //**SMP addition assignment to dense vectors****************************************************
926  template< typename VT2 > // Type of the target dense vector
927  friend inline auto smpAddAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
928  -> EnableIf_t< UseSMPAssign_v<VT2> >
929  {
931 
935 
936  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
937 
938  const RT tmp( rhs.dv_ );
939  smpAddAssign( ~lhs, map( tmp, rhs.op_ ) );
940  }
942  //**********************************************************************************************
943 
944  //**SMP addition assignment to sparse vectors***************************************************
945  // No special implementation for the SMP addition assignment to sparse vectors.
946  //**********************************************************************************************
947 
948  //**SMP subtraction assignment to dense vectors*************************************************
962  template< typename VT2 > // Type of the target dense vector
963  friend inline auto smpSubAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
964  -> EnableIf_t< UseSMPAssign_v<VT2> >
965  {
967 
971 
972  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
973 
974  const RT tmp( rhs.dv_ );
975  smpSubAssign( ~lhs, map( tmp, rhs.op_ ) );
976  }
978  //**********************************************************************************************
979 
980  //**SMP subtraction assignment to sparse vectors************************************************
981  // No special implementation for the SMP subtraction assignment to sparse vectors.
982  //**********************************************************************************************
983 
984  //**SMP multiplication assignment to dense vectors**********************************************
998  template< typename VT2 > // Type of the target dense vector
999  friend inline auto smpMultAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
1000  -> EnableIf_t< UseSMPAssign_v<VT2> >
1001  {
1003 
1007 
1008  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
1009 
1010  const RT tmp( rhs.dv_ );
1011  smpMultAssign( ~lhs, map( tmp, rhs.op_ ) );
1012  }
1014  //**********************************************************************************************
1015 
1016  //**SMP multiplication assignment to sparse vectors*********************************************
1017  // No special implementation for the SMP multiplication assignment to sparse vectors.
1018  //**********************************************************************************************
1019 
1020  //**SMP division assignment to dense vectors****************************************************
1034  template< typename VT2 > // Type of the target dense vector
1035  friend inline auto smpDivAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
1036  -> EnableIf_t< UseSMPAssign_v<VT2> >
1037  {
1039 
1043 
1044  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
1045 
1046  const RT tmp( rhs.dv_ );
1047  smpDivAssign( ~lhs, map( tmp, rhs.op_ ) );
1048  }
1050  //**********************************************************************************************
1051 
1052  //**SMP division assignment to sparse vectors***************************************************
1053  // No special implementation for the SMP division assignment to sparse vectors.
1054  //**********************************************************************************************
1055 
1056  //**Compile time checks*************************************************************************
1061  //**********************************************************************************************
1062 };
1063 //*************************************************************************************************
1064 
1065 
1066 
1067 
1068 //=================================================================================================
1069 //
1070 // GLOBAL FUNCTIONS
1071 //
1072 //=================================================================================================
1073 
1074 //*************************************************************************************************
1092 template< typename VT // Type of the dense vector
1093  , bool TF // Transpose flag
1094  , typename OP > // Type of the custom operation
1095 inline decltype(auto) map( const DenseVector<VT,TF>& dv, OP op )
1096 {
1098 
1099  using ReturnType = const DVecMapExpr<VT,OP,TF>;
1100  return ReturnType( ~dv, op );
1101 }
1102 //*************************************************************************************************
1103 
1104 
1105 //*************************************************************************************************
1123 template< typename VT // Type of the dense vector
1124  , bool TF // Transpose flag
1125  , typename OP > // Type of the custom operation
1126 inline decltype(auto) forEach( const DenseVector<VT,TF>& dv, OP op )
1127 {
1129 
1130  return map( ~dv, op );
1131 }
1132 //*************************************************************************************************
1133 
1134 
1135 //*************************************************************************************************
1152 template< typename VT // Type of the dense vector
1153  , bool TF > // Transpose flag
1154 inline decltype(auto) abs( const DenseVector<VT,TF>& dv )
1155 {
1157 
1158  return map( ~dv, Abs() );
1159 }
1160 //*************************************************************************************************
1161 
1162 
1163 //*************************************************************************************************
1180 template< typename VT // Type of the dense vector
1181  , bool TF > // Transpose flag
1182 inline decltype(auto) sign( const DenseVector<VT,TF>& dv )
1183 {
1185 
1186  return map( ~dv, Sign() );
1187 }
1188 //*************************************************************************************************
1189 
1190 
1191 //*************************************************************************************************
1208 template< typename VT // Type of the dense vector
1209  , bool TF > // Transpose flag
1210 inline decltype(auto) floor( const DenseVector<VT,TF>& dv )
1211 {
1213 
1214  return map( ~dv, Floor() );
1215 }
1216 //*************************************************************************************************
1217 
1218 
1219 //*************************************************************************************************
1236 template< typename VT // Type of the dense vector
1237  , bool TF > // Transpose flag
1238 inline decltype(auto) ceil( const DenseVector<VT,TF>& dv )
1239 {
1241 
1242  return map( ~dv, Ceil() );
1243 }
1244 //*************************************************************************************************
1245 
1246 
1247 //*************************************************************************************************
1264 template< typename VT // Type of the dense vector
1265  , bool TF > // Transpose flag
1266 inline decltype(auto) trunc( const DenseVector<VT,TF>& dv )
1267 {
1269 
1270  return map( ~dv, Trunc() );
1271 }
1272 //*************************************************************************************************
1273 
1274 
1275 //*************************************************************************************************
1292 template< typename VT // Type of the dense vector
1293  , bool TF > // Transpose flag
1294 inline decltype(auto) round( const DenseVector<VT,TF>& dv )
1295 {
1297 
1298  return map( ~dv, Round() );
1299 }
1300 //*************************************************************************************************
1301 
1302 
1303 //*************************************************************************************************
1320 template< typename VT // Type of the dense vector
1321  , bool TF > // Transpose flag
1322 inline decltype(auto) conj( const DenseVector<VT,TF>& dv )
1323 {
1325 
1326  return map( ~dv, Conj() );
1327 }
1328 //*************************************************************************************************
1329 
1330 
1331 //*************************************************************************************************
1357 template< typename VT // Type of the dense vector
1358  , bool TF > // Transpose flag
1359 inline decltype(auto) ctrans( const DenseVector<VT,TF>& dv )
1360 {
1362 
1363  return trans( conj( ~dv ) );
1364 }
1365 //*************************************************************************************************
1366 
1367 
1368 //*************************************************************************************************
1385 template< typename VT // Type of the dense vector
1386  , bool TF > // Transpose flag
1387 inline decltype(auto) real( const DenseVector<VT,TF>& dv )
1388 {
1390 
1391  return map( ~dv, Real() );
1392 }
1393 //*************************************************************************************************
1394 
1395 
1396 //*************************************************************************************************
1413 template< typename VT // Type of the dense vector
1414  , bool TF > // Transpose flag
1415 inline decltype(auto) imag( const DenseVector<VT,TF>& dv )
1416 {
1418 
1419  return map( ~dv, Imag() );
1420 }
1421 //*************************************************************************************************
1422 
1423 
1424 //*************************************************************************************************
1444 template< typename VT // Type of the dense vector
1445  , bool TF > // Transpose flag
1446 inline decltype(auto) sqrt( const DenseVector<VT,TF>& dv )
1447 {
1449 
1450  return map( ~dv, Sqrt() );
1451 }
1452 //*************************************************************************************************
1453 
1454 
1455 //*************************************************************************************************
1475 template< typename VT // Type of the dense vector
1476  , bool TF > // Transpose flag
1477 inline decltype(auto) invsqrt( const DenseVector<VT,TF>& dv )
1478 {
1480 
1481  return map( ~dv, InvSqrt() );
1482 }
1483 //*************************************************************************************************
1484 
1485 
1486 //*************************************************************************************************
1506 template< typename VT // Type of the dense vector
1507  , bool TF > // Transpose flag
1508 inline decltype(auto) cbrt( const DenseVector<VT,TF>& dv )
1509 {
1511 
1512  return map( ~dv, Cbrt() );
1513 }
1514 //*************************************************************************************************
1515 
1516 
1517 //*************************************************************************************************
1537 template< typename VT // Type of the dense vector
1538  , bool TF > // Transpose flag
1539 inline decltype(auto) invcbrt( const DenseVector<VT,TF>& dv )
1540 {
1542 
1543  return map( ~dv, InvCbrt() );
1544 }
1545 //*************************************************************************************************
1546 
1547 
1548 //*************************************************************************************************
1567 template< typename VT // Type of the dense vector
1568  , bool TF // Transpose flag
1569  , typename DT > // Type of the delimiters
1570 inline decltype(auto) clamp( const DenseVector<VT,TF>& dv, const DT& min, const DT& max )
1571 {
1573 
1574  return map( ~dv, Clamp<DT>( min, max ) );
1575 }
1576 //*************************************************************************************************
1577 
1578 
1579 //*************************************************************************************************
1597 template< typename VT // Type of the dense vector
1598  , bool TF // Transpose flag
1599  , typename ST // Type of the scalar exponent
1600  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
1601 inline decltype(auto) pow( const DenseVector<VT,TF>& dv, ST exp )
1602 {
1604 
1605  using ScalarType = MultTrait_t< UnderlyingBuiltin_t<VT>, ST >;
1606  return map( ~dv, blaze::bind2nd( Pow(), ScalarType( exp ) ) );
1607 }
1608 //*************************************************************************************************
1609 
1610 
1611 //*************************************************************************************************
1628 template< typename VT // Type of the dense vector
1629  , bool TF > // Transpose flag
1630 inline decltype(auto) exp( const DenseVector<VT,TF>& dv )
1631 {
1633 
1634  return map( ~dv, Exp() );
1635 }
1636 //*************************************************************************************************
1637 
1638 
1639 //*************************************************************************************************
1656 template< typename VT // Type of the dense vector
1657  , bool TF > // Transpose flag
1658 inline decltype(auto) exp2( const DenseVector<VT,TF>& dv )
1659 {
1661 
1662  return map( ~dv, Exp2() );
1663 }
1664 //*************************************************************************************************
1665 
1666 
1667 //*************************************************************************************************
1684 template< typename VT // Type of the dense vector
1685  , bool TF > // Transpose flag
1686 inline decltype(auto) exp10( const DenseVector<VT,TF>& dv )
1687 {
1689 
1690  return map( ~dv, Exp10() );
1691 }
1692 //*************************************************************************************************
1693 
1694 
1695 //*************************************************************************************************
1715 template< typename VT // Type of the dense vector
1716  , bool TF > // Transpose flag
1717 inline decltype(auto) log( const DenseVector<VT,TF>& dv )
1718 {
1720 
1721  return map( ~dv, Log() );
1722 }
1723 //*************************************************************************************************
1724 
1725 
1726 //*************************************************************************************************
1746 template< typename VT // Type of the dense vector
1747  , bool TF > // Transpose flag
1748 inline decltype(auto) log2( const DenseVector<VT,TF>& dv )
1749 {
1751 
1752  return map( ~dv, Log2() );
1753 }
1754 //*************************************************************************************************
1755 
1756 
1757 //*************************************************************************************************
1777 template< typename VT // Type of the dense vector
1778  , bool TF > // Transpose flag
1779 inline decltype(auto) log10( const DenseVector<VT,TF>& dv )
1780 {
1782 
1783  return map( ~dv, Log10() );
1784 }
1785 //*************************************************************************************************
1786 
1787 
1788 //*************************************************************************************************
1805 template< typename VT // Type of the dense vector
1806  , bool TF > // Transpose flag
1807 inline decltype(auto) sin( const DenseVector<VT,TF>& dv )
1808 {
1810 
1811  return map( ~dv, Sin() );
1812 }
1813 //*************************************************************************************************
1814 
1815 
1816 //*************************************************************************************************
1836 template< typename VT // Type of the dense vector
1837  , bool TF > // Transpose flag
1838 inline decltype(auto) asin( const DenseVector<VT,TF>& dv )
1839 {
1841 
1842  return map( ~dv, Asin() );
1843 }
1844 //*************************************************************************************************
1845 
1846 
1847 //*************************************************************************************************
1864 template< typename VT // Type of the dense vector
1865  , bool TF > // Transpose flag
1866 inline decltype(auto) sinh( const DenseVector<VT,TF>& dv )
1867 {
1869 
1870  return map( ~dv, Sinh() );
1871 }
1872 //*************************************************************************************************
1873 
1874 
1875 //*************************************************************************************************
1892 template< typename VT // Type of the dense vector
1893  , bool TF > // Transpose flag
1894 inline decltype(auto) asinh( const DenseVector<VT,TF>& dv )
1895 {
1897 
1898  return map( ~dv, Asinh() );
1899 }
1900 //*************************************************************************************************
1901 
1902 
1903 //*************************************************************************************************
1920 template< typename VT // Type of the dense vector
1921  , bool TF > // Transpose flag
1922 inline decltype(auto) cos( const DenseVector<VT,TF>& dv )
1923 {
1925 
1926  return map( ~dv, Cos() );
1927 }
1928 //*************************************************************************************************
1929 
1930 
1931 //*************************************************************************************************
1951 template< typename VT // Type of the dense vector
1952  , bool TF > // Transpose flag
1953 inline decltype(auto) acos( const DenseVector<VT,TF>& dv )
1954 {
1956 
1957  return map( ~dv, Acos() );
1958 }
1959 //*************************************************************************************************
1960 
1961 
1962 //*************************************************************************************************
1979 template< typename VT // Type of the dense vector
1980  , bool TF > // Transpose flag
1981 inline decltype(auto) cosh( const DenseVector<VT,TF>& dv )
1982 {
1984 
1985  return map( ~dv, Cosh() );
1986 }
1987 //*************************************************************************************************
1988 
1989 
1990 //*************************************************************************************************
2010 template< typename VT // Type of the dense vector
2011  , bool TF > // Transpose flag
2012 inline decltype(auto) acosh( const DenseVector<VT,TF>& dv )
2013 {
2015 
2016  return map( ~dv, Acosh() );
2017 }
2018 //*************************************************************************************************
2019 
2020 
2021 //*************************************************************************************************
2038 template< typename VT // Type of the dense vector
2039  , bool TF > // Transpose flag
2040 inline decltype(auto) tan( const DenseVector<VT,TF>& dv )
2041 {
2043 
2044  return map( ~dv, Tan() );
2045 }
2046 //*************************************************************************************************
2047 
2048 
2049 //*************************************************************************************************
2066 template< typename VT // Type of the dense vector
2067  , bool TF > // Transpose flag
2068 inline decltype(auto) atan( const DenseVector<VT,TF>& dv )
2069 {
2071 
2072  return map( ~dv, Atan() );
2073 }
2074 //*************************************************************************************************
2075 
2076 
2077 //*************************************************************************************************
2097 template< typename VT // Type of the dense vector
2098  , bool TF > // Transpose flag
2099 inline decltype(auto) tanh( const DenseVector<VT,TF>& dv )
2100 {
2102 
2103  return map( ~dv, Tanh() );
2104 }
2105 //*************************************************************************************************
2106 
2107 
2108 //*************************************************************************************************
2128 template< typename VT // Type of the dense vector
2129  , bool TF > // Transpose flag
2130 inline decltype(auto) atanh( const DenseVector<VT,TF>& dv )
2131 {
2133 
2134  return map( ~dv, Atanh() );
2135 }
2136 //*************************************************************************************************
2137 
2138 
2139 //*************************************************************************************************
2156 template< typename VT // Type of the dense vector
2157  , bool TF > // Transpose flag
2158 inline decltype(auto) erf( const DenseVector<VT,TF>& dv )
2159 {
2161 
2162  return map( ~dv, Erf() );
2163 }
2164 //*************************************************************************************************
2165 
2166 
2167 //*************************************************************************************************
2184 template< typename VT // Type of the dense vector
2185  , bool TF > // Transpose flag
2186 inline decltype(auto) erfc( const DenseVector<VT,TF>& dv )
2187 {
2189 
2190  return map( ~dv, Erfc() );
2191 }
2192 //*************************************************************************************************
2193 
2194 
2195 
2196 
2197 //=================================================================================================
2198 //
2199 // GLOBAL RESTRUCTURING FUNCTIONS
2200 //
2201 //=================================================================================================
2202 
2203 //*************************************************************************************************
2214 template< typename VT // Type of the dense vector
2215  , bool TF > // Transpose flag
2216 inline decltype(auto) abs( const DVecMapExpr<VT,Abs,TF>& dv )
2217 {
2219 
2220  return dv;
2221 }
2223 //*************************************************************************************************
2224 
2225 
2226 //*************************************************************************************************
2237 template< typename VT // Type of the dense vector
2238  , bool TF > // Transpose flag
2239 inline decltype(auto) sign( const DVecMapExpr<VT,Sign,TF>& dv )
2240 {
2242 
2243  return dv;
2244 }
2246 //*************************************************************************************************
2247 
2248 
2249 //*************************************************************************************************
2260 template< typename VT // Type of the dense vector
2261  , bool TF > // Transpose flag
2262 inline decltype(auto) floor( const DVecMapExpr<VT,Floor,TF>& dv )
2263 {
2265 
2266  return dv;
2267 }
2269 //*************************************************************************************************
2270 
2271 
2272 //*************************************************************************************************
2283 template< typename VT // Type of the dense vector
2284  , bool TF > // Transpose flag
2285 inline decltype(auto) ceil( const DVecMapExpr<VT,Ceil,TF>& dv )
2286 {
2288 
2289  return dv;
2290 }
2292 //*************************************************************************************************
2293 
2294 
2295 //*************************************************************************************************
2306 template< typename VT // Type of the dense vector
2307  , bool TF > // Transpose flag
2308 inline decltype(auto) trunc( const DVecMapExpr<VT,Trunc,TF>& dv )
2309 {
2311 
2312  return dv;
2313 }
2315 //*************************************************************************************************
2316 
2317 
2318 //*************************************************************************************************
2329 template< typename VT // Type of the dense vector
2330  , bool TF > // Transpose flag
2331 inline decltype(auto) round( const DVecMapExpr<VT,Round,TF>& dv )
2332 {
2334 
2335  return dv;
2336 }
2338 //*************************************************************************************************
2339 
2340 
2341 //*************************************************************************************************
2359 template< typename VT // Type of the dense vector
2360  , bool TF > // Transpose flag
2361 inline decltype(auto) conj( const DVecMapExpr<VT,Conj,TF>& dv )
2362 {
2364 
2365  return dv.operand();
2366 }
2368 //*************************************************************************************************
2369 
2370 
2371 //*************************************************************************************************
2389 template< typename VT // Type of the dense vector
2390  , bool TF > // Transpose flag
2391 inline decltype(auto) conj( const DVecTransExpr<DVecMapExpr<VT,Conj,TF>,!TF>& dv )
2392 {
2394 
2395  return trans( dv.operand().operand() );
2396 }
2398 //*************************************************************************************************
2399 
2400 
2401 //*************************************************************************************************
2412 template< typename VT // Type of the dense vector
2413  , bool TF > // Transpose flag
2414 inline decltype(auto) real( const DVecMapExpr<VT,Real,TF>& dv )
2415 {
2417 
2418  return dv;
2419 }
2421 //*************************************************************************************************
2422 
2423 
2424 
2425 
2426 //=================================================================================================
2427 //
2428 // GLOBAL ARITHMETIC OPERATORS
2429 //
2430 //=================================================================================================
2431 
2432 //*************************************************************************************************
2455 template< typename VT // Type of the left-hand side dense vector
2456  , bool TF // Transpose flag of the left-hand side dense vector
2457  , typename ST // Type of the right-hand side scalar
2458  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
2459 inline decltype(auto) operator+( const DenseVector<VT,TF>& vec, ST scalar )
2460 {
2462 
2463  using ScalarType = AddTrait_t< UnderlyingBuiltin_t<VT>, ST >;
2464  return map( ~vec, blaze::bind2nd( Add{}, ScalarType( scalar ) ) );
2465 }
2466 //*************************************************************************************************
2467 
2468 
2469 //*************************************************************************************************
2492 template< typename ST // Type of the left-hand side scalar
2493  , typename VT // Type of the right-hand side dense vector
2494  , bool TF // Transpose flag of the right-hand side dense vector
2495  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
2496 inline decltype(auto) operator+( ST scalar, const DenseVector<VT,TF>& vec )
2497 {
2499 
2500  using ScalarType = AddTrait_t< ST, UnderlyingBuiltin_t<VT> >;
2501  return map( ~vec, blaze::bind1st( Add{}, ScalarType( scalar ) ) );
2502 }
2503 //*************************************************************************************************
2504 
2505 
2506 //*************************************************************************************************
2529 template< typename VT // Type of the left-hand side dense vector
2530  , bool TF // Transpose flag of the left-hand side dense vector
2531  , typename ST // Type of the right-hand side scalar
2532  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
2533 inline decltype(auto) operator-( const DenseVector<VT,TF>& vec, ST scalar )
2534 {
2536 
2537  using ScalarType = SubTrait_t< UnderlyingBuiltin_t<VT>, ST >;
2538  return map( ~vec, blaze::bind2nd( Sub{}, ScalarType( scalar ) ) );
2539 }
2540 //*************************************************************************************************
2541 
2542 
2543 //*************************************************************************************************
2566 template< typename ST // Type of the left-hand side scalar
2567  , typename VT // Type of the right-hand side dense vector
2568  , bool TF // Transpose flag of the right-hand side dense vector
2569  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
2570 inline decltype(auto) operator-( ST scalar, const DenseVector<VT,TF>& vec )
2571 {
2573 
2574  using ScalarType = SubTrait_t< ST, UnderlyingBuiltin_t<VT> >;
2575  return map( ~vec, blaze::bind1st( Sub{}, ScalarType( scalar ) ) );
2576 }
2577 //*************************************************************************************************
2578 
2579 
2580 //*************************************************************************************************
2603 template< typename ST // Type of the left-hand side scalar
2604  , typename VT // Type of the right-hand side dense vector
2605  , bool TF // Transpose flag of the right-hand side dense vector
2606  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
2607 inline decltype(auto) operator/( ST scalar, const DenseVector<VT,TF>& vec )
2608 {
2610 
2611  using ScalarType = DivTrait_t< UnderlyingBuiltin_t<VT>, ST >;
2612  return map( ~vec, blaze::bind1st( Div{}, ScalarType( scalar ) ) );
2613 }
2614 //*************************************************************************************************
2615 
2616 
2617 //*************************************************************************************************
2633 template< typename VT // Type of the dense vector
2634  , bool TF > // Transpose flag
2635 inline decltype(auto) operator<<( const DenseVector<VT,TF>& vec, int count )
2636 {
2638 
2639  return map( ~vec, ShiftLI( count ) );
2640 }
2641 //*************************************************************************************************
2642 
2643 
2644 //*************************************************************************************************
2660 template< typename VT // Type of the dense vector
2661  , bool TF > // Transpose flag
2662 inline decltype(auto) operator>>( const DenseVector<VT,TF>& vec, int count )
2663 {
2665 
2666  return map( ~vec, ShiftRI( count ) );
2667 }
2668 //*************************************************************************************************
2669 
2670 
2671 //*************************************************************************************************
2687 template< typename VT // Type of the left-hand side dense vector
2688  , bool TF // Transpose flag
2689  , typename ST // Type of the right-hand side scalar
2690  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
2691 inline decltype(auto) operator&( const DenseVector<VT,TF>& vec, ST scalar )
2692 {
2694 
2695  return map( ~vec, blaze::bind2nd( Bitand{}, scalar ) );
2696 }
2697 //*************************************************************************************************
2698 
2699 
2700 //*************************************************************************************************
2716 template< typename VT // Type of the left-hand side dense vector
2717  , bool TF // Transpose flag
2718  , typename ST // Type of the right-hand side scalar
2719  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
2720 inline decltype(auto) operator|( const DenseVector<VT,TF>& vec, ST scalar )
2721 {
2723 
2724  return map( ~vec, blaze::bind2nd( Bitor{}, scalar ) );
2725 }
2726 //*************************************************************************************************
2727 
2728 
2729 //*************************************************************************************************
2745 template< typename VT // Type of the left-hand side dense vector
2746  , bool TF // Transpose flag
2747  , typename ST // Type of the right-hand side scalar
2748  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
2749 inline decltype(auto) operator^( const DenseVector<VT,TF>& vec, ST scalar )
2750 {
2752 
2753  return map( ~vec, blaze::bind2nd( Bitxor{}, scalar ) );
2754 }
2755 //*************************************************************************************************
2756 
2757 
2758 
2759 
2760 //=================================================================================================
2761 //
2762 // GLOBAL LOGICAL OPERATORS
2763 //
2764 //=================================================================================================
2765 
2766 //*************************************************************************************************
2781 template< typename VT // Type of the dense vector
2782  , bool TF > // Transpose flag
2783 inline decltype(auto) operator!( const DenseVector<VT,TF>& vec )
2784 {
2786 
2787  return map( ~vec, Not{} );
2788 }
2789 //*************************************************************************************************
2790 
2791 
2792 
2793 
2794 //=================================================================================================
2795 //
2796 // ISALIGNED SPECIALIZATIONS
2797 //
2798 //=================================================================================================
2799 
2800 //*************************************************************************************************
2802 template< typename VT, typename OP, bool TF >
2803 struct IsAligned< DVecMapExpr<VT,OP,TF> >
2804  : public IsAligned<VT>
2805 {};
2807 //*************************************************************************************************
2808 
2809 
2810 
2811 
2812 //=================================================================================================
2813 //
2814 // ISPADDED SPECIALIZATIONS
2815 //
2816 //=================================================================================================
2817 
2818 //*************************************************************************************************
2820 template< typename VT, typename OP, bool TF >
2821 struct IsPadded< DVecMapExpr<VT,OP,TF> >
2822  : public BoolConstant< IsPadded_v<VT> && IsPaddingEnabled_v<OP> >
2823 {};
2825 //*************************************************************************************************
2826 
2827 } // namespace blaze
2828 
2829 #endif
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecMapExpr.h:469
Header file for the UnderlyingNumeric type trait.
Generic wrapper for the trunc() function.
Definition: Trunc.h:81
Header file for the IsPaddingEnabled type trait.
ElementType * PointerType
Pointer return type.
Definition: DVecMapExpr.h:174
Pointer difference type of the Blaze library.
decltype(auto) acosh(const DenseMatrix< MT, SO > &dm)
Computes the inverse hyperbolic cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2014
Header file for auxiliary alias declarations.
Generic wrapper for the ceil() function.
Definition: Ceil.h:81
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition: DVecMapExpr.h:230
decltype(auto) exp10(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1688
typename SubTrait< T1, T2 >::Type SubTrait_t
Auxiliary alias declaration for the SubTrait class template.The SubTrait_t alias declaration provides...
Definition: SubTrait.h:238
OP op_
The custom unary operation.
Definition: DVecMapExpr.h:403
Generic wrapper for the cbrt() function.
Definition: Cbrt.h:81
Header file for the subtraction trait.
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecMapExpr.h:545
Header file for the HasLoad type trait.
Header file for basic type definitions.
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias template for the If class template.The If_t alias template provides a convenient shor...
Definition: If.h:109
Generic wrapper for the uniform left-shift operation.
Definition: ShiftLI.h:76
Generic wrapper for the sin() function.
Definition: Sin.h:79
Generic wrapper for the conj() function.
Definition: Conj.h:83
Generic wrapper for the invsqrt() function.
Definition: InvSqrt.h:69
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecMapExpr.h:219
Header file for the serial shim.
decltype(auto) real(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the real part of each single element of dm.
Definition: DMatMapExpr.h:1389
Generic wrapper for the bitwise OR ('|') operator.
Definition: Bitor.h:80
Generic wrapper for the division operator.
Definition: Div.h:79
typename DivTrait< T1, T2 >::Type DivTrait_t
Auxiliary alias declaration for the DivTrait class template.The DivTrait_t alias declaration provides...
Definition: DivTrait.h:239
typename MapTrait< Args... >::Type MapTrait_t
Auxiliary alias declaration for the MapTrait class template.The MapTrait_t alias declaration provides...
Definition: MapTrait.h:160
BLAZE_DEVICE_CALLABLE bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecMapExpr.h:348
ElementType_t< VT > ET
Element type of the dense vector expression.
Definition: DVecMapExpr.h:109
Header file for the IsSame and IsStrictlySame type traits.
decltype(auto) ceil(const DenseMatrix< MT, SO > &dm)
Applies the ceil() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1240
Generic wrapper for the clamp() function.
Definition: Clamp.h:61
decltype(auto) pow(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise exponential value for the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1271
Header file for the VecMapExpr base class.
Generic wrapper for the acosh() function.
Definition: Acosh.h:69
ElementType & ReferenceType
Reference return type.
Definition: DVecMapExpr.h:175
decltype(auto) clamp(const DenseMatrix< MT, SO > &dm, const DT &min, const DT &max)
Restricts each single element of the dense matrix dm to the range .
Definition: DMatMapExpr.h:1572
BLAZE_DEVICE_CALLABLE bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecMapExpr.h:337
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecMapExpr.h:172
Header file for the DenseVector base class.
Generic wrapper for the addition operator.
Definition: Add.h:83
Operation op_
The custom unary operation.
Definition: DVecMapExpr.h:573
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DVecMapExpr.h:150
decltype(auto) sign(const DenseMatrix< MT, SO > &dm)
Applies the sign() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1184
DVecMapExpr(const VT &dv, OP op) noexcept
Constructor for the DVecMapExpr class.
Definition: DVecMapExpr.h:430
Generic wrapper for the subtraction operator.
Definition: Sub.h:83
Header file for the Computation base class.
Header file for the RequiresEvaluation type trait.
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
If_t< useAssign, const ResultType, const DVecMapExpr & > CompositeType
Data type for composite expression templates.
Definition: DVecMapExpr.h:156
decltype(auto) acos(const DenseMatrix< MT, SO > &dm)
Computes the inverse cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1955
IteratorCategory iterator_category
The iterator category.
Definition: DVecMapExpr.h:179
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
auto smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:220
decltype(auto) erf(const DenseMatrix< MT, SO > &dm)
Computes the error function for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2160
ConstIterator_t< VT > IteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecMapExpr.h:186
PointerType pointer
Pointer return type.
Definition: DVecMapExpr.h:181
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
Generic wrapper for the abs() function.
Definition: Abs.h:83
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecMapExpr.h:455
Generic wrapper for the sqrt() function.
Definition: Sqrt.h:83
BLAZE_DEVICE_CALLABLE DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecMapExpr.h:359
If_t< IsExpression_v< VT >, const VT, const VT & > Operand
Composite data type of the dense vector expression.
Definition: DVecMapExpr.h:159
Header file for the multiplication trait.
typename UnderlyingNumeric< T >::Type UnderlyingNumeric_t
Auxiliary alias declaration for the UnderlyingNumeric type trait.The UnderlyingNumeric_t alias declar...
Definition: UnderlyingNumeric.h:117
decltype(auto) cos(const DenseMatrix< MT, SO > &dm)
Computes the cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1924
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
decltype(auto) ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatMapExpr.h:1361
Header file for the If class template.
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecMapExpr.h:383
Generic wrapper for the imag() function.
Definition: Imag.h:74
Generic wrapper for the exp10() function.
Definition: Exp10.h:67
decltype(auto) exp2(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1660
decltype(auto) sinh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1868
Header file for the UnderlyingBuiltin type trait.
decltype(auto) asin(const DenseMatrix< MT, SO > &dm)
Computes the inverse sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1840
decltype(auto) cosh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1983
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1162
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecMapExpr.h:565
decltype(auto) cbrt(const DenseMatrix< MT, SO > &dm)
Computes the cubic root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1510
#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
BLAZE_DEVICE_CALLABLE bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecMapExpr.h:326
Generic wrapper for the log10() function.
Definition: Log10.h:69
decltype(auto) trunc(const DenseMatrix< MT, SO > &dm)
Applies the trunc() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1268
Header file for all functors.
Header file for all SIMD functionality.
constexpr Bind2nd< OP, A2 > bind2nd(const OP &op, const A2 &a2)
Binds the given object/value to the 2nd parameter of the given binary operation.
Definition: Bind2nd.h:154
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecMapExpr.h:371
BLAZE_DEVICE_CALLABLE ReturnType operator *() const
Direct access to the element at the current iterator position.
Definition: DVecMapExpr.h:272
typename AddTrait< T1, T2 >::Type AddTrait_t
Auxiliary alias declaration for the AddTrait class template.The AddTrait_t alias declaration provides...
Definition: AddTrait.h:238
Header file for the IsAligned type trait.
Generic wrapper for the exp2() function.
Definition: Exp2.h:67
Generic wrapper for the asin() function.
Definition: Asin.h:79
Constraint on the data type.
decltype(auto) atan(const DenseMatrix< MT, SO > &dm)
Computes the inverse tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2070
BLAZE_DEVICE_CALLABLE bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecMapExpr.h:304
decltype(auto) asinh(const DenseMatrix< MT, SO > &dm)
Computes the inverse hyperbolic sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1896
MapTrait_t< RT, OP > ResultType
Result type for expression template evaluations.
Definition: DVecMapExpr.h:148
Generic wrapper for the erf() function.
Definition: Erf.h:77
ElementType ValueType
Type of the underlying elements.
Definition: DVecMapExpr.h:173
Constraint on the data type.
Base class for all unary vector map expression templates.The VecMapExpr class serves as a tag for all...
Definition: VecMapExpr.h:66
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecMapExpr.h:416
Header file for the exception macros of the math module.
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1198
Constraint on the data type.
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecMapExpr.h:411
Generic wrapper for the floor() function.
Definition: Floor.h:81
decltype(auto) exp(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1632
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecMapExpr.h:241
decltype(std::declval< OP >()(std::declval< RN >())) ReturnType
Return type for expression template evaluations.
Definition: DVecMapExpr.h:153
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
decltype(auto) abs(const DenseMatrix< MT, SO > &dm)
Applies the abs() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1156
Generic wrapper for the bitwise XOR ('^') operator.
Definition: Bitxor.h:66
decltype(auto) log(const DenseMatrix< MT, SO > &dm)
Computes the natural logarithm for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1719
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.The MultTrait_t alias declaration provid...
Definition: MultTrait.h:240
Operation operation() const
Returns a copy of the custom operation.
Definition: DVecMapExpr.h:521
Header file for the IsNumeric type trait.
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecMapExpr.h:491
decltype(auto) floor(const DenseMatrix< MT, SO > &dm)
Applies the floor() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1212
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecMapExpr.h:395
Operand dv_
Dense vector of the map expression.
Definition: DVecMapExpr.h:572
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecMapExpr.h:533
decltype(auto) round(const DenseMatrix< MT, SO > &dm)
Applies the round() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1296
Header file for the IsSIMDEnabled type trait.
decltype(auto) tanh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2101
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecMapExpr.h:555
decltype(auto) forEach(const DenseMatrix< MT, SO > &dm, OP op)
Evaluates the given custom operation on each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1128
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
OP Operation
Data type of the custom unary operation.
Definition: DVecMapExpr.h:162
Header file for run time assertion macros.
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DVecMapExpr.h:421
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecMapExpr.h:149
Generic wrapper for the pow() function.
Definition: Pow.h:63
Generic wrapper for the atanh() function.
Definition: Atanh.h:79
Iterator over the elements of the dense vector map expression.
Definition: DVecMapExpr.h:168
Generic wrapper for the invcbrt() function.
Definition: InvCbrt.h:67
Generic wrapper for the real() function.
Definition: Real.h:80
Header file for the addition trait.
IteratorType it_
Iterator to the current vector element.
Definition: DVecMapExpr.h:402
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
Header file for the division trait.
Generic wrapper for the bitwise AND ('&') operator.
Definition: Bitand.h:80
Generic wrapper for the asinh() function.
Definition: Asinh.h:79
ReferenceType reference
Reference return type.
Definition: DVecMapExpr.h:182
decltype(auto) invcbrt(const DenseMatrix< MT, SO > &dm)
Computes the inverse cubic root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1541
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the map expression.
Definition: DVecMapExpr.h:121
Generic wrapper for the tan() function.
Definition: Tan.h:79
Generic wrapper for the log() function.
Definition: Log.h:69
decltype(auto) atanh(const DenseMatrix< MT, SO > &dm)
Computes the inverse hyperbolic tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2132
BLAZE_DEVICE_CALLABLE bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecMapExpr.h:293
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:295
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
Header file for all forward declarations for expression class templates.
Generic wrapper for the logical NOT operator.
Definition: Not.h:58
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
Generic wrapper for the erfc() function.
Definition: Erfc.h:67
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
BLAZE_DEVICE_CALLABLE ConstIterator(IteratorType it, OP op)
Constructor for the ConstIterator class.
Definition: DVecMapExpr.h:195
Generic wrapper for the cos() function.
Definition: Cos.h:69
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant alias template represents ...
Definition: IntegralConstant.h:110
Expression object for the dense vector map() function.The DVecMapExpr class represents the compile ti...
Definition: DVecMapExpr.h:102
ValueType value_type
Type of the underlying elements.
Definition: DVecMapExpr.h:180
Generic wrapper for the sign() function.
Definition: Sign.h:81
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
#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
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecMapExpr.h:176
decltype(auto) sin(const DenseMatrix< MT, SO > &dm)
Computes the sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1809
BLAZE_DEVICE_CALLABLE bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecMapExpr.h:315
decltype(auto) erfc(const DenseMatrix< MT, SO > &dm)
Computes the complementary error function for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2188
Macro for CUDA compatibility.
ResultType_t< VT > RT
Result type of the dense vector expression.
Definition: DVecMapExpr.h:108
decltype(auto) sqrt(const DenseMatrix< MT, SO > &dm)
Computes the square root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1448
Header file for the IsComputation type trait class.
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecMapExpr.h:282
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
Generic wrapper for the acos() function.
Definition: Acos.h:69
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:66
decltype(auto) tan(const DenseMatrix< MT, SO > &dm)
Computes the tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2042
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecMapExpr.h:262
Generic wrapper for the atan() function.
Definition: Atan.h:79
Generic wrapper for the round() function.
Definition: Round.h:81
Generic wrapper for the sinh() function.
Definition: Sinh.h:79
Header file for the IntegralConstant class template.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecMapExpr.h:442
Header file for the map trait.
decltype(auto) log10(const DenseMatrix< MT, SO > &dm)
Computes the common logarithm for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1781
Generic wrapper for the log2() function.
Definition: Log2.h:67
Operand operand() const noexcept
Returns the dense vector operand.
Definition: DVecMapExpr.h:511
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition: HostDevice.h:94
decltype(auto) imag(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the imaginary part of each single element of dm.
Definition: DMatMapExpr.h:1417
Generic wrapper for the cosh() function.
Definition: Cosh.h:69
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1324
decltype(auto) log2(const DenseMatrix< MT, SO > &dm)
Computes the binary logarithm for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1750
decltype(auto) invsqrt(const DenseMatrix< MT, SO > &dm)
Computes the inverse square root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1479
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecMapExpr.h:501
Generic wrapper for the tanh() function.
Definition: Tanh.h:79
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecMapExpr.h:251
ReturnType_t< VT > RN
Return type of the dense vector expression.
Definition: DVecMapExpr.h:110
Generic wrapper for the exp() function.
Definition: Exp.h:69
System settings for the inline keywords.
#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,...
Definition: Assert.h:101
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecMapExpr.h:207
constexpr Bind1st< OP, A1 > bind1st(const OP &op, const A1 &a1)
Binds the given object/value to the 1st parameter of the given binary operation.
Definition: Bind1st.h:154
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector.
Definition: DenseVector.h:191
Generic wrapper for the uniform right-shift operation.
Definition: ShiftRI.h:75
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecMapExpr.h:481
Header file for the IsExpression type trait class.
Header file for the function trace functionality.
decltype(auto) map(const DenseMatrix< MT1, SO > &lhs, const DenseMatrix< MT2, SO > &rhs, OP op)
Evaluates the given binary operation on each single element of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1121