Blaze 3.9
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>
54#include <blaze/math/Functors.h>
56#include <blaze/math/SIMD.h>
73#include <blaze/system/Inline.h>
75#include <blaze/util/Assert.h>
76#include <blaze/util/EnableIf.h>
79#include <blaze/util/mpl/If.h>
80#include <blaze/util/Types.h>
83
84
85namespace blaze {
86
87//=================================================================================================
88//
89// CLASS DVECMAPEXPR
90//
91//=================================================================================================
92
93//*************************************************************************************************
100template< typename VT // Type of the dense vector
101 , typename OP // Type of the custom operation
102 , bool TF > // Transpose flag
104 : public VecMapExpr< DenseVector< DVecMapExpr<VT,OP,TF>, TF > >
105 , private Computation
106{
107 private:
108 //**Type definitions****************************************************************************
112 //**********************************************************************************************
113
114 //**Serial evaluation strategy******************************************************************
116
122 static constexpr bool useAssign = ( IsComputation_v<VT> && RequiresEvaluation_v<VT> );
123
126 template< typename VT2 >
127 static constexpr bool UseAssign_v = useAssign;
129 //**********************************************************************************************
130
131 //**Parallel evaluation strategy****************************************************************
133
139 template< typename VT2 >
140 static constexpr bool UseSMPAssign_v =
141 ( ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign );
143 //**********************************************************************************************
144
145 public:
146 //**Type definitions****************************************************************************
149
152
156
158 using ReturnType = decltype( std::declval<OP>()( std::declval<RN>() ) );
159
162
164 using Operand = If_t< IsExpression_v<VT>, const VT, const VT& >;
165
167 using Operation = OP;
168 //**********************************************************************************************
169
170 //**ConstIterator class definition**************************************************************
174 {
175 public:
176 //**Type definitions*************************************************************************
177 using IteratorCategory = std::random_access_iterator_tag;
181 using DifferenceType = ptrdiff_t;
182
183 // STL iterator requirements
189
192 //*******************************************************************************************
193
194 //**Constructor******************************************************************************
201 : it_( it ) // Iterator to the current vector element
202 , op_( std::move(op) ) // The custom unary operation
203 {}
204 //*******************************************************************************************
205
206 //**Addition assignment operator*************************************************************
213 it_ += inc;
214 return *this;
215 }
216 //*******************************************************************************************
217
218 //**Subtraction assignment operator**********************************************************
225 it_ -= dec;
226 return *this;
227 }
228 //*******************************************************************************************
229
230 //**Prefix increment operator****************************************************************
236 ++it_;
237 return *this;
238 }
239 //*******************************************************************************************
240
241 //**Postfix increment operator***************************************************************
247 return ConstIterator( it_++, op_ );
248 }
249 //*******************************************************************************************
250
251 //**Prefix decrement operator****************************************************************
257 --it_;
258 return *this;
259 }
260 //*******************************************************************************************
261
262 //**Postfix decrement operator***************************************************************
268 return ConstIterator( it_--, op_ );
269 }
270 //*******************************************************************************************
271
272 //**Element access operator******************************************************************
278 return op_( *it_ );
279 }
280 //*******************************************************************************************
281
282 //**Load function****************************************************************************
287 inline auto load() const noexcept {
288 return op_.load( it_.load() );
289 }
290 //*******************************************************************************************
291
292 //**Equality operator************************************************************************
298 inline BLAZE_DEVICE_CALLABLE bool operator==( const ConstIterator& rhs ) const {
299 return it_ == rhs.it_;
300 }
301 //*******************************************************************************************
302
303 //**Inequality operator**********************************************************************
309 inline BLAZE_DEVICE_CALLABLE bool operator!=( const ConstIterator& rhs ) const {
310 return it_ != rhs.it_;
311 }
312 //*******************************************************************************************
313
314 //**Less-than operator***********************************************************************
320 inline BLAZE_DEVICE_CALLABLE bool operator<( const ConstIterator& rhs ) const {
321 return it_ < rhs.it_;
322 }
323 //*******************************************************************************************
324
325 //**Greater-than operator********************************************************************
331 inline BLAZE_DEVICE_CALLABLE bool operator>( const ConstIterator& rhs ) const {
332 return it_ > rhs.it_;
333 }
334 //*******************************************************************************************
335
336 //**Less-or-equal-than operator**************************************************************
342 inline BLAZE_DEVICE_CALLABLE bool operator<=( const ConstIterator& rhs ) const {
343 return it_ <= rhs.it_;
344 }
345 //*******************************************************************************************
346
347 //**Greater-or-equal-than operator***********************************************************
353 inline BLAZE_DEVICE_CALLABLE bool operator>=( const ConstIterator& rhs ) const {
354 return it_ >= rhs.it_;
355 }
356 //*******************************************************************************************
357
358 //**Subtraction operator*********************************************************************
365 return it_ - rhs.it_;
366 }
367 //*******************************************************************************************
368
369 //**Addition operator************************************************************************
376 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
377 return ConstIterator( it.it_ + inc, it.op_ );
378 }
379 //*******************************************************************************************
380
381 //**Addition operator************************************************************************
388 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
389 return ConstIterator( it.it_ + inc, it.op_ );
390 }
391 //*******************************************************************************************
392
393 //**Subtraction operator*********************************************************************
400 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
401 return ConstIterator( it.it_ - dec, it.op_ );
402 }
403 //*******************************************************************************************
404
405 private:
406 //**Member variables*************************************************************************
408 OP op_;
409 //*******************************************************************************************
410 };
411 //**********************************************************************************************
412
413 public:
414 //**Compilation flags***************************************************************************
416 static constexpr bool simdEnabled =
417 ( VT::simdEnabled &&
418 If_t< HasSIMDEnabled_v<OP>, GetSIMDEnabled<OP,ET>, HasLoad<OP> >::value );
419
421 static constexpr bool smpAssignable = VT::smpAssignable;
422 //**********************************************************************************************
423
424 //**SIMD properties*****************************************************************************
426 static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
427 //**********************************************************************************************
428
429 //**Constructor*********************************************************************************
435 inline DVecMapExpr( const VT& dv, OP op ) noexcept
436 : dv_( dv ) // Dense vector of the map expression
437 , op_( std::move(op) ) // The custom unary operation
438 {}
439 //**********************************************************************************************
440
441 //**Subscript operator**************************************************************************
447 inline ReturnType operator[]( size_t index ) const {
448 BLAZE_INTERNAL_ASSERT( index < dv_.size(), "Invalid vector access index" );
449 return op_( dv_[index] );
450 }
451 //**********************************************************************************************
452
453 //**At function*********************************************************************************
460 inline ReturnType at( size_t index ) const {
461 if( index >= dv_.size() ) {
462 BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
463 }
464 return (*this)[index];
465 }
466 //**********************************************************************************************
467
468 //**Load function*******************************************************************************
474 BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
475 BLAZE_INTERNAL_ASSERT( index < dv_.size() , "Invalid vector access index" );
476 BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
477 return op_.load( dv_.load( index ) );
478 }
479 //**********************************************************************************************
480
481 //**Begin function******************************************************************************
486 inline ConstIterator begin() const {
487 return ConstIterator( dv_.begin(), op_ );
488 }
489 //**********************************************************************************************
490
491 //**End function********************************************************************************
496 inline ConstIterator end() const {
497 return ConstIterator( dv_.end(), op_ );
498 }
499 //**********************************************************************************************
500
501 //**Size function*******************************************************************************
506 inline size_t size() const noexcept {
507 return dv_.size();
508 }
509 //**********************************************************************************************
510
511 //**Operand access******************************************************************************
516 inline Operand operand() const noexcept {
517 return dv_;
518 }
519 //**********************************************************************************************
520
521 //**Operation access****************************************************************************
526 inline Operation operation() const {
527 return op_;
528 }
529 //**********************************************************************************************
530
531 //**********************************************************************************************
537 template< typename T >
538 inline bool canAlias( const T* alias ) const noexcept {
539 return IsExpression_v<VT> && dv_.canAlias( alias );
540 }
541 //**********************************************************************************************
542
543 //**********************************************************************************************
549 template< typename T >
550 inline bool isAliased( const T* alias ) const noexcept {
551 return dv_.isAliased( alias );
552 }
553 //**********************************************************************************************
554
555 //**********************************************************************************************
560 inline bool isAligned() const noexcept {
561 return dv_.isAligned();
562 }
563 //**********************************************************************************************
564
565 //**********************************************************************************************
570 inline bool canSMPAssign() const noexcept {
571 return dv_.canSMPAssign();
572 }
573 //**********************************************************************************************
574
575 private:
576 //**Member variables****************************************************************************
579 //**********************************************************************************************
580
581 //**Assignment to dense vectors*****************************************************************
596 template< typename VT2 > // Type of the target dense vector
597 friend inline auto assign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
599 IsSame_v< UnderlyingScalar_t<VT>, UnderlyingScalar_t<VT2> > >
600 {
602
603 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
604
605 assign( *lhs, rhs.dv_ );
606 assign( *lhs, map( *lhs, rhs.op_ ) );
607 }
609 //**********************************************************************************************
610
611 //**Assignment to dense vectors*****************************************************************
626 template< typename VT2 > // Type of the target dense vector
627 friend inline auto assign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
629 !IsSame_v< UnderlyingScalar_t<VT>, UnderlyingScalar_t<VT2> > >
630 {
632
636
637 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
638
639 const RT tmp( serial( rhs.dv_ ) );
640 assign( *lhs, map( tmp, rhs.op_ ) );
641 }
643 //**********************************************************************************************
644
645 //**Assignment to sparse vectors****************************************************************
659 template< typename VT2 > // Type of the target sparse vector
660 friend inline auto assign( SparseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
661 -> EnableIf_t< UseAssign_v<VT2> >
662 {
664
668
669 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
670
671 const RT tmp( serial( rhs.dv_ ) );
672 assign( *lhs, map( tmp, rhs.op_ ) );
673 }
675 //**********************************************************************************************
676
677 //**Addition assignment to dense vectors********************************************************
691 template< typename VT2 > // Type of the target dense vector
692 friend inline auto addAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
693 -> EnableIf_t< UseAssign_v<VT2> >
694 {
696
700
701 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
702
703 const RT tmp( serial( rhs.dv_ ) );
704 addAssign( *lhs, map( tmp, rhs.op_ ) );
705 }
707 //**********************************************************************************************
708
709 //**Addition assignment to sparse vectors*******************************************************
710 // No special implementation for the addition assignment to sparse vectors.
711 //**********************************************************************************************
712
713 //**Subtraction assignment to dense vectors*****************************************************
727 template< typename VT2 > // Type of the target dense vector
728 friend inline auto subAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
729 -> EnableIf_t< UseAssign_v<VT2> >
730 {
732
736
737 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
738
739 const RT tmp( serial( rhs.dv_ ) );
740 subAssign( *lhs, map( tmp, rhs.op_ ) );
741 }
743 //**********************************************************************************************
744
745 //**Subtraction assignment to sparse vectors****************************************************
746 // No special implementation for the subtraction assignment to sparse vectors.
747 //**********************************************************************************************
748
749 //**Multiplication assignment to dense vectors**************************************************
763 template< typename VT2 > // Type of the target dense vector
764 friend inline auto multAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
765 -> EnableIf_t< UseAssign_v<VT2> >
766 {
768
772
773 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
774
775 const RT tmp( serial( rhs.dv_ ) );
776 multAssign( *lhs, map( tmp, rhs.op_ ) );
777 }
779 //**********************************************************************************************
780
781 //**Multiplication assignment to sparse vectors*************************************************
782 // No special implementation for the multiplication assignment to sparse vectors.
783 //**********************************************************************************************
784
785 //**Division assignment to dense vectors********************************************************
799 template< typename VT2 > // Type of the target dense vector
800 friend inline auto divAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
801 -> EnableIf_t< UseAssign_v<VT2> >
802 {
804
808
809 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
810
811 const RT tmp( serial( rhs.dv_ ) );
812 divAssign( *lhs, map( tmp, rhs.op_ ) );
813 }
815 //**********************************************************************************************
816
817 //**Division assignment to sparse vectors*******************************************************
818 // No special implementation for the division assignment to sparse vectors.
819 //**********************************************************************************************
820
821 //**SMP assignment to dense vectors*************************************************************
836 template< typename VT2 > // Type of the target dense vector
837 friend inline auto smpAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
838 -> EnableIf_t< UseSMPAssign_v<VT2> &&
839 IsSame_v< UnderlyingScalar_t<VT>, UnderlyingScalar_t<VT2> > >
840 {
842
843 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
844
845 smpAssign( *lhs, rhs.dv_ );
846 smpAssign( *lhs, map( *lhs, rhs.op_ ) );
847 }
849 //**********************************************************************************************
850
851 //**SMP assignment to dense vectors*************************************************************
866 template< typename VT2 > // Type of the target dense vector
867 friend inline auto smpAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
868 -> EnableIf_t< UseSMPAssign_v<VT2> &&
869 !IsSame_v< UnderlyingScalar_t<VT>, UnderlyingScalar_t<VT2> > >
870 {
872
876
877 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
878
879 const RT tmp( rhs.dv_ );
880 smpAssign( *lhs, map( tmp, rhs.op_ ) );
881 }
883 //**********************************************************************************************
884
885 //**SMP assignment to sparse vectors************************************************************
899 template< typename VT2 > // Type of the target sparse vector
900 friend inline auto smpAssign( SparseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
901 -> EnableIf_t< UseSMPAssign_v<VT2> >
902 {
904
908
909 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
910
911 const RT tmp( rhs.dv_ );
912 smpAssign( *lhs, map( tmp, rhs.op_ ) );
913 }
915 //**********************************************************************************************
916
917 //**SMP addition assignment to dense vectors****************************************************
931 template< typename VT2 > // Type of the target dense vector
932 friend inline auto smpAddAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
933 -> EnableIf_t< UseSMPAssign_v<VT2> >
934 {
936
940
941 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
942
943 const RT tmp( rhs.dv_ );
944 smpAddAssign( *lhs, map( tmp, rhs.op_ ) );
945 }
947 //**********************************************************************************************
948
949 //**SMP addition assignment to sparse vectors***************************************************
950 // No special implementation for the SMP addition assignment to sparse vectors.
951 //**********************************************************************************************
952
953 //**SMP subtraction assignment to dense vectors*************************************************
967 template< typename VT2 > // Type of the target dense vector
968 friend inline auto smpSubAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
969 -> EnableIf_t< UseSMPAssign_v<VT2> >
970 {
972
976
977 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
978
979 const RT tmp( rhs.dv_ );
980 smpSubAssign( *lhs, map( tmp, rhs.op_ ) );
981 }
983 //**********************************************************************************************
984
985 //**SMP subtraction assignment to sparse vectors************************************************
986 // No special implementation for the SMP subtraction assignment to sparse vectors.
987 //**********************************************************************************************
988
989 //**SMP multiplication assignment to dense vectors**********************************************
1003 template< typename VT2 > // Type of the target dense vector
1004 friend inline auto smpMultAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
1005 -> EnableIf_t< UseSMPAssign_v<VT2> >
1006 {
1008
1012
1013 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1014
1015 const RT tmp( rhs.dv_ );
1016 smpMultAssign( *lhs, map( tmp, rhs.op_ ) );
1017 }
1019 //**********************************************************************************************
1020
1021 //**SMP multiplication assignment to sparse vectors*********************************************
1022 // No special implementation for the SMP multiplication assignment to sparse vectors.
1023 //**********************************************************************************************
1024
1025 //**SMP division assignment to dense vectors****************************************************
1039 template< typename VT2 > // Type of the target dense vector
1040 friend inline auto smpDivAssign( DenseVector<VT2,TF>& lhs, const DVecMapExpr& rhs )
1041 -> EnableIf_t< UseSMPAssign_v<VT2> >
1042 {
1044
1048
1049 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1050
1051 const RT tmp( rhs.dv_ );
1052 smpDivAssign( *lhs, map( tmp, rhs.op_ ) );
1053 }
1055 //**********************************************************************************************
1056
1057 //**SMP division assignment to sparse vectors***************************************************
1058 // No special implementation for the SMP division assignment to sparse vectors.
1059 //**********************************************************************************************
1060
1061 //**Compile time checks*************************************************************************
1066 //**********************************************************************************************
1067};
1068//*************************************************************************************************
1069
1070
1071
1072
1073//=================================================================================================
1074//
1075// GLOBAL FUNCTIONS
1076//
1077//=================================================================================================
1078
1079//*************************************************************************************************
1097template< typename VT // Type of the dense vector
1098 , bool TF // Transpose flag
1099 , typename OP > // Type of the custom operation
1100inline decltype(auto) map( const DenseVector<VT,TF>& dv, OP op )
1101{
1103
1104 using ReturnType = const DVecMapExpr<VT,OP,TF>;
1105 return ReturnType( *dv, std::move(op) );
1106}
1107//*************************************************************************************************
1108
1109
1110//*************************************************************************************************
1128template< typename VT // Type of the dense vector
1129 , bool TF // Transpose flag
1130 , typename OP > // Type of the custom operation
1131inline decltype(auto) forEach( const DenseVector<VT,TF>& dv, OP op )
1132{
1134
1135 return map( *dv, std::move(op) );
1136}
1137//*************************************************************************************************
1138
1139
1140//*************************************************************************************************
1159template< typename VT // Type of the dense vector
1160 , bool TF // Transpose flag
1161 , typename ST // Type of the scalar exponent
1162 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
1163decltype(auto) min( const DenseVector<VT,TF>& dv, ST scalar )
1164{
1166
1167 using ET = ElementType_t<VT>;
1168 using ScalarType = If_t< IsNumeric_v<ET> && IsNumeric_v<ST>, MapTrait_t<ET,ST,Min>, ST >;
1169 return map( *dv, bind2nd( Min(), ScalarType( scalar ) ) );
1170}
1171//*************************************************************************************************
1172
1173
1174//*************************************************************************************************
1193template< typename ST // Type of the scalar exponent
1194 , typename VT // Type of the dense vector
1195 , bool TF // Transpose flag
1196 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
1197decltype(auto) min( ST scalar, const DenseVector<VT,TF>& dv )
1198{
1200
1201 using ET = ElementType_t<VT>;
1202 using ScalarType = If_t< IsNumeric_v<ST> && IsNumeric_v<ET>, MapTrait_t<ST,ET,Min>, ST >;
1203 return map( *dv, bind1st( Min(), ScalarType( scalar ) ) );
1204}
1205//*************************************************************************************************
1206
1207
1208//*************************************************************************************************
1230template< typename VT // Type of the dense vector
1231 , bool TF // Transpose flag
1232 , typename ST // Type of the scalar exponent
1233 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
1234decltype(auto) max( const DenseVector<VT,TF>& dv, ST scalar )
1235{
1237
1238 using ET = ElementType_t<VT>;
1239 using ScalarType = If_t< IsNumeric_v<ET> && IsNumeric_v<ST>, MapTrait_t<ET,ST,Max>, ST >;
1240 return map( *dv, bind2nd( Max(), ScalarType( scalar ) ) );
1241}
1242//*************************************************************************************************
1243
1244
1245//*************************************************************************************************
1264template< typename ST // Type of the scalar exponent
1265 , typename VT // Type of the dense vector
1266 , bool TF // Transpose flag
1267 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
1268decltype(auto) max( ST scalar, const DenseVector<VT,TF>& dv )
1269{
1271
1272 using ET = ElementType_t<VT>;
1273 using ScalarType = If_t< IsNumeric_v<ST> && IsNumeric_v<ET>, MapTrait_t<ST,ET,Max>, ST >;
1274 return map( *dv, bind1st( Max(), ScalarType( scalar ) ) );
1275}
1276//*************************************************************************************************
1277
1278
1279//*************************************************************************************************
1296template< typename VT // Type of the dense vector
1297 , bool TF > // Transpose flag
1298inline decltype(auto) abs( const DenseVector<VT,TF>& dv )
1299{
1301
1302 return map( *dv, Abs() );
1303}
1304//*************************************************************************************************
1305
1306
1307//*************************************************************************************************
1324template< typename VT // Type of the dense vector
1325 , bool TF > // Transpose flag
1326inline decltype(auto) sign( const DenseVector<VT,TF>& dv )
1327{
1329
1330 return map( *dv, Sign() );
1331}
1332//*************************************************************************************************
1333
1334
1335//*************************************************************************************************
1352template< typename VT // Type of the dense vector
1353 , bool TF > // Transpose flag
1354inline decltype(auto) floor( const DenseVector<VT,TF>& dv )
1355{
1357
1358 return map( *dv, Floor() );
1359}
1360//*************************************************************************************************
1361
1362
1363//*************************************************************************************************
1380template< typename VT // Type of the dense vector
1381 , bool TF > // Transpose flag
1382inline decltype(auto) ceil( const DenseVector<VT,TF>& dv )
1383{
1385
1386 return map( *dv, Ceil() );
1387}
1388//*************************************************************************************************
1389
1390
1391//*************************************************************************************************
1408template< typename VT // Type of the dense vector
1409 , bool TF > // Transpose flag
1410inline decltype(auto) trunc( const DenseVector<VT,TF>& dv )
1411{
1413
1414 return map( *dv, Trunc() );
1415}
1416//*************************************************************************************************
1417
1418
1419//*************************************************************************************************
1436template< typename VT // Type of the dense vector
1437 , bool TF > // Transpose flag
1438inline decltype(auto) round( const DenseVector<VT,TF>& dv )
1439{
1441
1442 return map( *dv, Round() );
1443}
1444//*************************************************************************************************
1445
1446
1447//*************************************************************************************************
1464template< typename VT // Type of the dense vector
1465 , bool TF > // Transpose flag
1466inline decltype(auto) conj( const DenseVector<VT,TF>& dv )
1467{
1469
1470 return map( *dv, Conj() );
1471}
1472//*************************************************************************************************
1473
1474
1475//*************************************************************************************************
1501template< typename VT // Type of the dense vector
1502 , bool TF > // Transpose flag
1503inline decltype(auto) ctrans( const DenseVector<VT,TF>& dv )
1504{
1506
1507 return trans( conj( *dv ) );
1508}
1509//*************************************************************************************************
1510
1511
1512//*************************************************************************************************
1529template< typename VT // Type of the dense vector
1530 , bool TF > // Transpose flag
1531inline decltype(auto) real( const DenseVector<VT,TF>& dv )
1532{
1534
1535 return map( *dv, Real() );
1536}
1537//*************************************************************************************************
1538
1539
1540//*************************************************************************************************
1557template< typename VT // Type of the dense vector
1558 , bool TF > // Transpose flag
1559inline decltype(auto) imag( const DenseVector<VT,TF>& dv )
1560{
1562
1563 return map( *dv, Imag() );
1564}
1565//*************************************************************************************************
1566
1567
1568//*************************************************************************************************
1585template< typename VT // Type of the dense vector
1586 , bool TF > // Transpose flag
1587inline decltype(auto) arg( const DenseVector<VT,TF>& dv )
1588{
1590
1591 return map( *dv, Arg() );
1592}
1593//*************************************************************************************************
1594
1595
1596//*************************************************************************************************
1616template< typename VT // Type of the dense vector
1617 , bool TF > // Transpose flag
1618inline decltype(auto) sqrt( const DenseVector<VT,TF>& dv )
1619{
1621
1622 return map( *dv, Sqrt() );
1623}
1624//*************************************************************************************************
1625
1626
1627//*************************************************************************************************
1647template< typename VT // Type of the dense vector
1648 , bool TF > // Transpose flag
1649inline decltype(auto) invsqrt( const DenseVector<VT,TF>& dv )
1650{
1652
1653 return map( *dv, InvSqrt() );
1654}
1655//*************************************************************************************************
1656
1657
1658//*************************************************************************************************
1678template< typename VT // Type of the dense vector
1679 , bool TF > // Transpose flag
1680inline decltype(auto) cbrt( const DenseVector<VT,TF>& dv )
1681{
1683
1684 return map( *dv, Cbrt() );
1685}
1686//*************************************************************************************************
1687
1688
1689//*************************************************************************************************
1709template< typename VT // Type of the dense vector
1710 , bool TF > // Transpose flag
1711inline decltype(auto) invcbrt( const DenseVector<VT,TF>& dv )
1712{
1714
1715 return map( *dv, InvCbrt() );
1716}
1717//*************************************************************************************************
1718
1719
1720//*************************************************************************************************
1739template< typename VT // Type of the dense vector
1740 , bool TF // Transpose flag
1741 , typename DT > // Type of the delimiters
1742inline decltype(auto) clamp( const DenseVector<VT,TF>& dv, const DT& min, const DT& max )
1743{
1745
1746 return map( *dv, bind2nd( bind3rd( Clamp(), max ), min ) );
1747}
1748//*************************************************************************************************
1749
1750
1751//*************************************************************************************************
1769template< typename VT // Type of the dense vector
1770 , bool TF // Transpose flag
1771 , typename ST // Type of the scalar exponent
1772 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
1773inline decltype(auto) pow( const DenseVector<VT,TF>& dv, ST exp )
1774{
1776
1777 using ET = ElementType_t<VT>;
1778 using ScalarType = If_t< IsNumeric_v<ET> && IsNumeric_v<ST>, MultTrait_t<ET,ST>, ST >;
1779 return map( *dv, blaze::bind2nd( Pow(), ScalarType( exp ) ) );
1780}
1781//*************************************************************************************************
1782
1783
1784//*************************************************************************************************
1801template< typename VT // Type of the dense vector
1802 , bool TF > // Transpose flag
1803inline decltype(auto) exp( const DenseVector<VT,TF>& dv )
1804{
1806
1807 return map( *dv, Exp() );
1808}
1809//*************************************************************************************************
1810
1811
1812//*************************************************************************************************
1829template< typename VT // Type of the dense vector
1830 , bool TF > // Transpose flag
1831inline decltype(auto) exp2( const DenseVector<VT,TF>& dv )
1832{
1834
1835 return map( *dv, Exp2() );
1836}
1837//*************************************************************************************************
1838
1839
1840//*************************************************************************************************
1857template< typename VT // Type of the dense vector
1858 , bool TF > // Transpose flag
1859inline decltype(auto) exp10( const DenseVector<VT,TF>& dv )
1860{
1862
1863 return map( *dv, Exp10() );
1864}
1865//*************************************************************************************************
1866
1867
1868//*************************************************************************************************
1888template< typename VT // Type of the dense vector
1889 , bool TF > // Transpose flag
1890inline decltype(auto) log( const DenseVector<VT,TF>& dv )
1891{
1893
1894 return map( *dv, Log() );
1895}
1896//*************************************************************************************************
1897
1898
1899//*************************************************************************************************
1919template< typename VT // Type of the dense vector
1920 , bool TF > // Transpose flag
1921inline decltype(auto) log2( const DenseVector<VT,TF>& dv )
1922{
1924
1925 return map( *dv, Log2() );
1926}
1927//*************************************************************************************************
1928
1929
1930//*************************************************************************************************
1950template< typename VT // Type of the dense vector
1951 , bool TF > // Transpose flag
1952inline decltype(auto) log10( const DenseVector<VT,TF>& dv )
1953{
1955
1956 return map( *dv, Log10() );
1957}
1958//*************************************************************************************************
1959
1960
1961//*************************************************************************************************
1983template< typename VT // Type of the dense vector
1984 , bool TF > // Transpose flag
1985inline decltype(auto) log1p( const DenseVector<VT,TF>& dv )
1986{
1988
1989 return map( *dv, Log1p() );
1990}
1991//*************************************************************************************************
1992
1993
1994//*************************************************************************************************
2016template< typename VT // Type of the dense vector
2017 , bool SO > // Storage order
2018inline decltype(auto) lgamma( const DenseVector<VT,SO>& dv )
2019{
2021
2022 return map( *dv, LGamma() );
2023}
2024//*************************************************************************************************
2025
2026
2027//*************************************************************************************************
2044template< typename VT // Type of the dense vector
2045 , bool TF > // Transpose flag
2046inline decltype(auto) sin( const DenseVector<VT,TF>& dv )
2047{
2049
2050 return map( *dv, Sin() );
2051}
2052//*************************************************************************************************
2053
2054
2055//*************************************************************************************************
2075template< typename VT // Type of the dense vector
2076 , bool TF > // Transpose flag
2077inline decltype(auto) asin( const DenseVector<VT,TF>& dv )
2078{
2080
2081 return map( *dv, Asin() );
2082}
2083//*************************************************************************************************
2084
2085
2086//*************************************************************************************************
2103template< typename VT // Type of the dense vector
2104 , bool TF > // Transpose flag
2105inline decltype(auto) sinh( const DenseVector<VT,TF>& dv )
2106{
2108
2109 return map( *dv, Sinh() );
2110}
2111//*************************************************************************************************
2112
2113
2114//*************************************************************************************************
2131template< typename VT // Type of the dense vector
2132 , bool TF > // Transpose flag
2133inline decltype(auto) asinh( const DenseVector<VT,TF>& dv )
2134{
2136
2137 return map( *dv, Asinh() );
2138}
2139//*************************************************************************************************
2140
2141
2142//*************************************************************************************************
2159template< typename VT // Type of the dense vector
2160 , bool TF > // Transpose flag
2161inline decltype(auto) cos( const DenseVector<VT,TF>& dv )
2162{
2164
2165 return map( *dv, Cos() );
2166}
2167//*************************************************************************************************
2168
2169
2170//*************************************************************************************************
2190template< typename VT // Type of the dense vector
2191 , bool TF > // Transpose flag
2192inline decltype(auto) acos( const DenseVector<VT,TF>& dv )
2193{
2195
2196 return map( *dv, Acos() );
2197}
2198//*************************************************************************************************
2199
2200
2201//*************************************************************************************************
2218template< typename VT // Type of the dense vector
2219 , bool TF > // Transpose flag
2220inline decltype(auto) cosh( const DenseVector<VT,TF>& dv )
2221{
2223
2224 return map( *dv, Cosh() );
2225}
2226//*************************************************************************************************
2227
2228
2229//*************************************************************************************************
2249template< typename VT // Type of the dense vector
2250 , bool TF > // Transpose flag
2251inline decltype(auto) acosh( const DenseVector<VT,TF>& dv )
2252{
2254
2255 return map( *dv, Acosh() );
2256}
2257//*************************************************************************************************
2258
2259
2260//*************************************************************************************************
2277template< typename VT // Type of the dense vector
2278 , bool TF > // Transpose flag
2279inline decltype(auto) tan( const DenseVector<VT,TF>& dv )
2280{
2282
2283 return map( *dv, Tan() );
2284}
2285//*************************************************************************************************
2286
2287
2288//*************************************************************************************************
2305template< typename VT // Type of the dense vector
2306 , bool TF > // Transpose flag
2307inline decltype(auto) atan( const DenseVector<VT,TF>& dv )
2308{
2310
2311 return map( *dv, Atan() );
2312}
2313//*************************************************************************************************
2314
2315
2316//*************************************************************************************************
2336template< typename VT // Type of the dense vector
2337 , bool TF > // Transpose flag
2338inline decltype(auto) tanh( const DenseVector<VT,TF>& dv )
2339{
2341
2342 return map( *dv, Tanh() );
2343}
2344//*************************************************************************************************
2345
2346
2347//*************************************************************************************************
2367template< typename VT // Type of the dense vector
2368 , bool TF > // Transpose flag
2369inline decltype(auto) atanh( const DenseVector<VT,TF>& dv )
2370{
2372
2373 return map( *dv, Atanh() );
2374}
2375//*************************************************************************************************
2376
2377
2378//*************************************************************************************************
2395template< typename VT // Type of the dense vector
2396 , bool TF > // Transpose flag
2397inline decltype(auto) erf( const DenseVector<VT,TF>& dv )
2398{
2400
2401 return map( *dv, Erf() );
2402}
2403//*************************************************************************************************
2404
2405
2406//*************************************************************************************************
2423template< typename VT // Type of the dense vector
2424 , bool TF > // Transpose flag
2425inline decltype(auto) erfc( const DenseVector<VT,TF>& dv )
2426{
2428
2429 return map( *dv, Erfc() );
2430}
2431//*************************************************************************************************
2432
2433
2434
2435
2436//=================================================================================================
2437//
2438// GLOBAL RESTRUCTURING FUNCTIONS
2439//
2440//=================================================================================================
2441
2442//*************************************************************************************************
2453template< typename VT // Type of the dense vector
2454 , bool TF > // Transpose flag
2455inline decltype(auto) abs( const DVecMapExpr<VT,Abs,TF>& dv )
2456{
2458
2459 return dv;
2460}
2462//*************************************************************************************************
2463
2464
2465//*************************************************************************************************
2476template< typename VT // Type of the dense vector
2477 , bool TF > // Transpose flag
2478inline decltype(auto) sign( const DVecMapExpr<VT,Sign,TF>& dv )
2479{
2481
2482 return dv;
2483}
2485//*************************************************************************************************
2486
2487
2488//*************************************************************************************************
2499template< typename VT // Type of the dense vector
2500 , bool TF > // Transpose flag
2501inline decltype(auto) floor( const DVecMapExpr<VT,Floor,TF>& dv )
2502{
2504
2505 return dv;
2506}
2508//*************************************************************************************************
2509
2510
2511//*************************************************************************************************
2522template< typename VT // Type of the dense vector
2523 , bool TF > // Transpose flag
2524inline decltype(auto) ceil( const DVecMapExpr<VT,Ceil,TF>& dv )
2525{
2527
2528 return dv;
2529}
2531//*************************************************************************************************
2532
2533
2534//*************************************************************************************************
2545template< typename VT // Type of the dense vector
2546 , bool TF > // Transpose flag
2547inline decltype(auto) trunc( const DVecMapExpr<VT,Trunc,TF>& dv )
2548{
2550
2551 return dv;
2552}
2554//*************************************************************************************************
2555
2556
2557//*************************************************************************************************
2568template< typename VT // Type of the dense vector
2569 , bool TF > // Transpose flag
2570inline decltype(auto) round( const DVecMapExpr<VT,Round,TF>& dv )
2571{
2573
2574 return dv;
2575}
2577//*************************************************************************************************
2578
2579
2580//*************************************************************************************************
2598template< typename VT // Type of the dense vector
2599 , bool TF > // Transpose flag
2600inline decltype(auto) conj( const DVecMapExpr<VT,Conj,TF>& dv )
2601{
2603
2604 return dv.operand();
2605}
2607//*************************************************************************************************
2608
2609
2610//*************************************************************************************************
2628template< typename VT // Type of the dense vector
2629 , bool TF > // Transpose flag
2630inline decltype(auto) conj( const DVecTransExpr<DVecMapExpr<VT,Conj,TF>,!TF>& dv )
2631{
2633
2634 return trans( dv.operand().operand() );
2635}
2637//*************************************************************************************************
2638
2639
2640//*************************************************************************************************
2651template< typename VT // Type of the dense vector
2652 , bool TF > // Transpose flag
2653inline decltype(auto) real( const DVecMapExpr<VT,Real,TF>& dv )
2654{
2656
2657 return dv;
2658}
2660//*************************************************************************************************
2661
2662
2663
2664
2665//=================================================================================================
2666//
2667// GLOBAL ARITHMETIC OPERATORS
2668//
2669//=================================================================================================
2670
2671//*************************************************************************************************
2694template< typename VT // Type of the left-hand side dense vector
2695 , bool TF // Transpose flag of the left-hand side dense vector
2696 , typename ST // Type of the right-hand side scalar
2697 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
2698inline decltype(auto) operator+( const DenseVector<VT,TF>& vec, ST scalar )
2699{
2701
2702 using ET = ElementType_t<VT>;
2703 using ScalarType = If_t< IsNumeric_v<ET> && IsNumeric_v<ST>, AddTrait_t<ET,ST>, ST >;
2704 return map( *vec, blaze::bind2nd( Add{}, ScalarType( scalar ) ) );
2705}
2706//*************************************************************************************************
2707
2708
2709//*************************************************************************************************
2732template< typename ST // Type of the left-hand side scalar
2733 , typename VT // Type of the right-hand side dense vector
2734 , bool TF // Transpose flag of the right-hand side dense vector
2735 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
2736inline decltype(auto) operator+( ST scalar, const DenseVector<VT,TF>& vec )
2737{
2739
2740 using ET = ElementType_t<VT>;
2741 using ScalarType = If_t< IsNumeric_v<ST> && IsNumeric_v<ET>, AddTrait_t<ST,ET>, ST >;
2742 return map( *vec, blaze::bind1st( Add{}, ScalarType( scalar ) ) );
2743}
2744//*************************************************************************************************
2745
2746
2747//*************************************************************************************************
2770template< typename VT // Type of the left-hand side dense vector
2771 , bool TF // Transpose flag of the left-hand side dense vector
2772 , typename ST // Type of the right-hand side scalar
2773 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
2774inline decltype(auto) operator-( const DenseVector<VT,TF>& vec, ST scalar )
2775{
2777
2778 using ET = ElementType_t<VT>;
2779 using ScalarType = If_t< IsNumeric_v<ET> && IsNumeric_v<ST>, SubTrait_t<ET,ST>, ST >;
2780 return map( *vec, blaze::bind2nd( Sub{}, ScalarType( scalar ) ) );
2781}
2782//*************************************************************************************************
2783
2784
2785//*************************************************************************************************
2808template< typename ST // Type of the left-hand side scalar
2809 , typename VT // Type of the right-hand side dense vector
2810 , bool TF // Transpose flag of the right-hand side dense vector
2811 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
2812inline decltype(auto) operator-( ST scalar, const DenseVector<VT,TF>& vec )
2813{
2815
2816 using ET = ElementType_t<VT>;
2817 using ScalarType = If_t< IsNumeric_v<ST> && IsNumeric_v<ET>, SubTrait_t<ST,ET>, ST >;
2818 return map( *vec, blaze::bind1st( Sub{}, ScalarType( scalar ) ) );
2819}
2820//*************************************************************************************************
2821
2822
2823//*************************************************************************************************
2846template< typename ST // Type of the left-hand side scalar
2847 , typename VT // Type of the right-hand side dense vector
2848 , bool TF // Transpose flag of the right-hand side dense vector
2849 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
2850inline decltype(auto) operator/( ST scalar, const DenseVector<VT,TF>& vec )
2851{
2853
2854 using ET = ElementType_t<VT>;
2855 using ScalarType = If_t< IsNumeric_v<ST> && IsNumeric_v<ET>, DivTrait_t<ST,ET>, ST >;
2856 return map( *vec, blaze::bind1st( Div{}, ScalarType( scalar ) ) );
2857}
2858//*************************************************************************************************
2859
2860
2861//*************************************************************************************************
2877template< typename VT // Type of the dense vector
2878 , bool TF > // Transpose flag
2879inline decltype(auto) operator<<( const DenseVector<VT,TF>& vec, int count )
2880{
2882
2883 return map( *vec, ShiftLI( count ) );
2884}
2885//*************************************************************************************************
2886
2887
2888//*************************************************************************************************
2904template< typename VT // Type of the dense vector
2905 , bool TF > // Transpose flag
2906inline decltype(auto) operator>>( const DenseVector<VT,TF>& vec, int count )
2907{
2909
2910 return map( *vec, ShiftRI( count ) );
2911}
2912//*************************************************************************************************
2913
2914
2915//*************************************************************************************************
2931template< typename VT // Type of the left-hand side dense vector
2932 , bool TF // Transpose flag
2933 , typename ST // Type of the right-hand side scalar
2934 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
2935inline decltype(auto) operator&( const DenseVector<VT,TF>& vec, ST scalar )
2936{
2938
2939 return map( *vec, blaze::bind2nd( Bitand{}, scalar ) );
2940}
2941//*************************************************************************************************
2942
2943
2944//*************************************************************************************************
2960template< typename VT // Type of the left-hand side dense vector
2961 , bool TF // Transpose flag
2962 , typename ST // Type of the right-hand side scalar
2963 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
2964inline decltype(auto) operator|( const DenseVector<VT,TF>& vec, ST scalar )
2965{
2967
2968 return map( *vec, blaze::bind2nd( Bitor{}, scalar ) );
2969}
2970//*************************************************************************************************
2971
2972
2973//*************************************************************************************************
2989template< typename VT // Type of the left-hand side dense vector
2990 , bool TF // Transpose flag
2991 , typename ST // Type of the right-hand side scalar
2992 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
2993inline decltype(auto) operator^( const DenseVector<VT,TF>& vec, ST scalar )
2994{
2996
2997 return map( *vec, blaze::bind2nd( Bitxor{}, scalar ) );
2998}
2999//*************************************************************************************************
3000
3001
3002
3003
3004//=================================================================================================
3005//
3006// GLOBAL LOGICAL OPERATORS
3007//
3008//=================================================================================================
3009
3010//*************************************************************************************************
3025template< typename VT // Type of the dense vector
3026 , bool TF > // Transpose flag
3027inline decltype(auto) operator!( const DenseVector<VT,TF>& vec )
3028{
3030
3031 return map( *vec, Not{} );
3032}
3033//*************************************************************************************************
3034
3035
3036
3037
3038//=================================================================================================
3039//
3040// ISALIGNED SPECIALIZATIONS
3041//
3042//=================================================================================================
3043
3044//*************************************************************************************************
3046template< typename VT, typename OP, bool TF >
3047struct IsAligned< DVecMapExpr<VT,OP,TF> >
3048 : public IsAligned<VT>
3049{};
3051//*************************************************************************************************
3052
3053
3054
3055
3056//=================================================================================================
3057//
3058// ISPADDED SPECIALIZATIONS
3059//
3060//=================================================================================================
3061
3062//*************************************************************************************************
3064template< typename VT, typename OP, bool TF >
3065struct IsPadded< DVecMapExpr<VT,OP,TF> >
3066 : public BoolConstant< IsPadded_v<VT> && IsPaddingEnabled_v<OP> >
3067{};
3069//*************************************************************************************************
3070
3071} // namespace blaze
3072
3073#endif
Header file for the addition trait.
Header file for auxiliary alias declarations.
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition: Aliases.h:470
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition: Aliases.h:450
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition: Aliases.h:190
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.
Definition: Aliases.h:130
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition: Aliases.h:550
Header file for run time assertion macros.
Header file for the division trait.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Header file for all functors.
Header file for the HasLoad type trait.
Macro for CUDA compatibility.
Header file for the If class template.
Header file for the IntegralConstant class template.
Header file for the IsAligned type trait.
Header file for the IsComputation type trait class.
Header file for the IsExpression type trait class.
Header file for the IsNumeric type trait.
Header file for the IsPadded type trait.
Header file for the IsPaddingEnabled type trait.
Header file for the IsSIMDEnabled type trait.
Header file for the IsSame and IsStrictlySame type traits.
Header file for the IsScalar type trait.
Deactivation of problematic macros.
Header file for the map trait.
Header file for the multiplication trait.
Header file for all SIMD functionality.
Header file for the subtraction trait.
Header file for the UnderlyingScalar type trait.
Iterator over the elements of the dense vector map expression.
Definition: DVecMapExpr.h:174
BLAZE_DEVICE_CALLABLE bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecMapExpr.h:309
IteratorCategory iterator_category
The iterator category.
Definition: DVecMapExpr.h:184
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecMapExpr.h:212
OP op_
The custom unary operation.
Definition: DVecMapExpr.h:408
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecMapExpr.h:224
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecMapExpr.h:376
BLAZE_DEVICE_CALLABLE bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecMapExpr.h:331
BLAZE_DEVICE_CALLABLE DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecMapExpr.h:364
BLAZE_DEVICE_CALLABLE bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecMapExpr.h:320
DifferenceType difference_type
Difference between two iterators.
Definition: DVecMapExpr.h:188
BLAZE_DEVICE_CALLABLE ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecMapExpr.h:277
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecMapExpr.h:177
PointerType pointer
Pointer return type.
Definition: DVecMapExpr.h:186
ElementType ValueType
Type of the underlying elements.
Definition: DVecMapExpr.h:178
ValueType value_type
Type of the underlying elements.
Definition: DVecMapExpr.h:185
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecMapExpr.h:267
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecMapExpr.h:246
IteratorType it_
Iterator to the current vector element.
Definition: DVecMapExpr.h:407
ElementType * PointerType
Pointer return type.
Definition: DVecMapExpr.h:179
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecMapExpr.h:388
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition: DVecMapExpr.h:235
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecMapExpr.h:287
ReferenceType reference
Reference return type.
Definition: DVecMapExpr.h:187
BLAZE_DEVICE_CALLABLE bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecMapExpr.h:342
ElementType & ReferenceType
Reference return type.
Definition: DVecMapExpr.h:180
ConstIterator_t< VT > IteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecMapExpr.h:191
BLAZE_DEVICE_CALLABLE bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecMapExpr.h:353
BLAZE_DEVICE_CALLABLE bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecMapExpr.h:298
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecMapExpr.h:400
BLAZE_DEVICE_CALLABLE ConstIterator(IteratorType it, OP op)
Constructor for the ConstIterator class.
Definition: DVecMapExpr.h:200
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecMapExpr.h:181
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecMapExpr.h:256
Expression object for the dense vector map() function.
Definition: DVecMapExpr.h:106
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecMapExpr.h:486
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecMapExpr.h:570
Operation op_
The custom unary operation.
Definition: DVecMapExpr.h:578
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecMapExpr.h:496
ElementType_t< VT > ET
Element type of the dense vector expression.
Definition: DVecMapExpr.h:110
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecMapExpr.h:416
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecMapExpr.h:154
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecMapExpr.h:538
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecMapExpr.h:550
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecMapExpr.h:447
MapTrait_t< RT, OP > ResultType
Result type for expression template evaluations.
Definition: DVecMapExpr.h:153
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecMapExpr.h:506
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecMapExpr.h:460
If_t< IsExpression_v< VT >, const VT, const VT & > Operand
Composite data type of the dense vector expression.
Definition: DVecMapExpr.h:164
Operation operation() const
Returns a copy of the custom operation.
Definition: DVecMapExpr.h:526
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DVecMapExpr.h:426
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DVecMapExpr.h:155
DVecMapExpr(const VT &dv, OP op) noexcept
Constructor for the DVecMapExpr class.
Definition: DVecMapExpr.h:435
Operand dv_
Dense vector of the map expression.
Definition: DVecMapExpr.h:577
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecMapExpr.h:560
ResultType_t< VT > RT
Result type of the dense vector expression.
Definition: DVecMapExpr.h:109
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecMapExpr.h:474
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the map expression.
Definition: DVecMapExpr.h:122
If_t< useAssign, const ResultType, const DVecMapExpr & > CompositeType
Data type for composite expression templates.
Definition: DVecMapExpr.h:161
Operand operand() const noexcept
Returns the dense vector operand.
Definition: DVecMapExpr.h:516
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecMapExpr.h:421
OP Operation
Data type of the custom unary operation.
Definition: DVecMapExpr.h:167
ReturnType_t< VT > RN
Return type of the dense vector expression.
Definition: DVecMapExpr.h:111
decltype(std::declval< OP >()(std::declval< RN >())) ReturnType
Return type for expression template evaluations.
Definition: DVecMapExpr.h:158
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
SIMD characteristics of data types.
Definition: SIMDTrait.h:297
Constraint on the data type.
Constraint on the data type.
Header file for the Computation base class.
Header file for the DenseVector base class.
Header file for the VecMapExpr base class.
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
decltype(auto) arg(const DenseVector< VT, TF > &dv)
Returns a vector containing the phase angle of each single element of dv.
Definition: DVecMapExpr.h:1587
decltype(auto) acosh(const DenseVector< VT, TF > &dv)
Computes the inverse hyperbolic cosine for each single element of the dense vector dv.
Definition: DVecMapExpr.h:2251
decltype(auto) forEach(const DenseVector< VT, TF > &dv, OP op)
Evaluates the given custom operation on each single element of the dense vector dv.
Definition: DVecMapExpr.h:1131
decltype(auto) erfc(const DenseVector< VT, TF > &dv)
Computes the complementary error function for each single element of the dense vector dv.
Definition: DVecMapExpr.h:2425
decltype(auto) ceil(const DenseVector< VT, TF > &dv)
Applies the ceil() function to each single element of the dense vector dv.
Definition: DVecMapExpr.h:1382
decltype(auto) cos(const DenseVector< VT, TF > &dv)
Computes the cosine for each single element of the dense vector dv.
Definition: DVecMapExpr.h:2161
decltype(auto) trunc(const DenseVector< VT, TF > &dv)
Applies the trunc() function to each single element of the dense vector dv.
Definition: DVecMapExpr.h:1410
decltype(auto) round(const DenseVector< VT, TF > &dv)
Applies the round() function to each single element of the dense vector dv.
Definition: DVecMapExpr.h:1438
decltype(auto) atan(const DenseVector< VT, TF > &dv)
Computes the inverse tangent for each single element of the dense vector dv.
Definition: DVecMapExpr.h:2307
decltype(auto) max(ST scalar, const DenseVector< VT, TF > &dv)
Computes the componentwise maximum of a scalar and a dense vector dv.
Definition: DVecMapExpr.h:1268
decltype(auto) asin(const DenseVector< VT, TF > &dv)
Computes the inverse sine for each single element of the dense vector dv.
Definition: DVecMapExpr.h:2077
decltype(auto) tan(const DenseVector< VT, TF > &dv)
Computes the tangent for each single element of the dense vector dv.
Definition: DVecMapExpr.h:2279
decltype(auto) atanh(const DenseVector< VT, TF > &dv)
Computes the inverse hyperbolic tangent for each single element of the dense vector dv.
Definition: DVecMapExpr.h:2369
decltype(auto) exp2(const DenseVector< VT, TF > &dv)
Computes for each single element of the dense vector dv.
Definition: DVecMapExpr.h:1831
decltype(auto) conj(const DenseVector< VT, TF > &dv)
Returns a vector containing the complex conjugate of each single element of dv.
Definition: DVecMapExpr.h:1466
decltype(auto) sinh(const DenseVector< VT, TF > &dv)
Computes the hyperbolic sine for each single element of the dense vector dv.
Definition: DVecMapExpr.h:2105
decltype(auto) invsqrt(const DenseVector< VT, TF > &dv)
Computes the inverse square root of each single element of the dense vector dv.
Definition: DVecMapExpr.h:1649
decltype(auto) invcbrt(const DenseVector< VT, TF > &dv)
Computes the inverse cubic root of each single element of the dense vector dv.
Definition: DVecMapExpr.h:1711
decltype(auto) log10(const DenseVector< VT, TF > &dv)
Computes the common logarithm for each single element of the dense vector dv.
Definition: DVecMapExpr.h:1952
decltype(auto) log1p(const DenseVector< VT, TF > &dv)
Computes the natural logarithm of x+1 for each single element of the dense vector dv.
Definition: DVecMapExpr.h:1985
decltype(auto) floor(const DenseVector< VT, TF > &dv)
Applies the floor() function to each single element of the dense vector dv.
Definition: DVecMapExpr.h:1354
decltype(auto) sqrt(const DenseVector< VT, TF > &dv)
Computes the square root of each single element of the dense vector dv.
Definition: DVecMapExpr.h:1618
decltype(auto) ctrans(const DenseVector< VT, TF > &dv)
Returns the conjugate transpose vector of dv.
Definition: DVecMapExpr.h:1503
decltype(auto) log2(const DenseVector< VT, TF > &dv)
Computes the binary logarithm for each single element of the dense vector dv.
Definition: DVecMapExpr.h:1921
decltype(auto) erf(const DenseVector< VT, TF > &dv)
Computes the error function for each single element of the dense vector dv.
Definition: DVecMapExpr.h:2397
decltype(auto) exp(const DenseVector< VT, TF > &dv)
Computes for each single element of the dense vector dv.
Definition: DVecMapExpr.h:1803
decltype(auto) imag(const DenseVector< VT, TF > &dv)
Returns a vector containing the imaginary part of each single element of dv.
Definition: DVecMapExpr.h:1559
decltype(auto) log(const DenseVector< VT, TF > &dv)
Computes the natural logarithm for each single element of the dense vector dv.
Definition: DVecMapExpr.h:1890
decltype(auto) sin(const DenseVector< VT, TF > &dv)
Computes the sine for each single element of the dense vector dv.
Definition: DVecMapExpr.h:2046
decltype(auto) min(ST scalar, const DenseVector< VT, TF > &dv)
Computes the componentwise minimum of a scalar and a dense vector dv.
Definition: DVecMapExpr.h:1197
decltype(auto) cosh(const DenseVector< VT, TF > &dv)
Computes the hyperbolic cosine for each single element of the dense vector dv.
Definition: DVecMapExpr.h:2220
decltype(auto) abs(const DenseVector< VT, TF > &dv)
Applies the abs() function to each single element of the dense vector dv.
Definition: DVecMapExpr.h:1298
decltype(auto) clamp(const DenseVector< VT, TF > &dv, const DT &min, const DT &max)
Restricts each single element of the dense vector dv to the range .
Definition: DVecMapExpr.h:1742
decltype(auto) real(const DenseVector< VT, TF > &dv)
Returns a vector containing the real part of each single element of dv.
Definition: DVecMapExpr.h:1531
decltype(auto) exp10(const DenseVector< VT, TF > &dv)
Computes for each single element of the dense vector dv.
Definition: DVecMapExpr.h:1859
decltype(auto) cbrt(const DenseVector< VT, TF > &dv)
Computes the cubic root of each single element of the dense vector dv.
Definition: DVecMapExpr.h:1680
decltype(auto) map(const DenseVector< VT, TF > &dv, OP op)
Evaluates the given custom operation on each single element of the dense vector dv.
Definition: DVecMapExpr.h:1100
decltype(auto) pow(const DenseVector< VT, TF > &dv, ST exp)
Computes the exponential value for each single element of the dense vector dv.
Definition: DVecMapExpr.h:1773
decltype(auto) tanh(const DenseVector< VT, TF > &dv)
Computes the hyperbolic tangent for each single element of the dense vector dv.
Definition: DVecMapExpr.h:2338
decltype(auto) sign(const DenseVector< VT, TF > &dv)
Applies the sign() function to each single element of the dense vector dv.
Definition: DVecMapExpr.h:1326
decltype(auto) acos(const DenseVector< VT, TF > &dv)
Computes the inverse cosine for each single element of the dense vector dv.
Definition: DVecMapExpr.h:2192
decltype(auto) asinh(const DenseVector< VT, TF > &dv)
Computes the inverse hyperbolic sine for each single element of the dense vector dv.
Definition: DVecMapExpr.h:2133
decltype(auto) lgamma(const DenseVector< VT, SO > &dv)
Computes the natural logarithm of the absolute value of the gamma function for each single element of...
Definition: DVecMapExpr.h:2018
constexpr Bind1st< OP, A1 > bind1st(const OP &op, const A1 &a1)
Binds the given object/value to the 1st parameter of the given operation.
Definition: Bind1st.h:153
constexpr Bind3rd< OP, A3 > bind3rd(const OP &op, const A3 &a3)
Binds the given object/value to the 3rd parameter of the given operation.
Definition: Bind3rd.h:157
constexpr Bind2nd< OP, A2 > bind2nd(const OP &op, const A2 &a2)
Binds the given object/value to the 2nd parameter of the given operation.
Definition: Bind2nd.h:155
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.
Definition: TransposeFlag.h:63
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: DenseVector.h:61
typename DivTrait< T1, T2 >::Type DivTrait_t
Auxiliary alias declaration for the DivTrait class template.
Definition: DivTrait.h:164
typename MapTrait< Args... >::Type MapTrait_t
Auxiliary alias declaration for the MapTrait class template.
Definition: MapTrait.h:131
typename AddTrait< T1, T2 >::Type AddTrait_t
Auxiliary alias declaration for the AddTrait class template.
Definition: AddTrait.h:163
typename SubTrait< T1, T2 >::Type SubTrait_t
Auxiliary alias declaration for the SubTrait class template.
Definition: SubTrait.h:163
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.
Definition: MultTrait.h:165
typename UnderlyingScalar< T >::Type UnderlyingScalar_t
Auxiliary alias declaration for the UnderlyingScalar type trait.
Definition: UnderlyingScalar.h:116
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
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:221
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
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
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:192
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
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition: HostDevice.h:94
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition: If.h:108
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.
Definition: IntegralConstant.h:110
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition: FunctionTrace.h:94
Header file for the exception macros of the math module.
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Header file for the serial shim.
Generic wrapper for the abs() function.
Definition: Abs.h:85
Generic wrapper for the acos() function.
Definition: Acos.h:71
Generic wrapper for the acosh() function.
Definition: Acosh.h:71
Generic wrapper for the addition operator.
Definition: Add.h:85
Generic wrapper for the arg() function.
Definition: Arg.h:77
Generic wrapper for the asin() function.
Definition: Asin.h:81
Generic wrapper for the asinh() function.
Definition: Asinh.h:81
Generic wrapper for the atan() function.
Definition: Atan.h:81
Generic wrapper for the atanh() function.
Definition: Atanh.h:81
Generic wrapper for the bitwise AND ('&') operator.
Definition: Bitand.h:82
Generic wrapper for the bitwise OR ('|') operator.
Definition: Bitor.h:82
Generic wrapper for the bitwise XOR ('^') operator.
Definition: Bitxor.h:68
Generic wrapper for the cbrt() function.
Definition: Cbrt.h:83
Generic wrapper for the ceil() function.
Definition: Ceil.h:83
Generic wrapper for the clamp() function.
Definition: Clamp.h:68
Base class for all compute expression templates.
Definition: Computation.h:68
Generic wrapper for the conj() function.
Definition: Conj.h:85
Generic wrapper for the cos() function.
Definition: Cos.h:71
Generic wrapper for the cosh() function.
Definition: Cosh.h:71
Generic wrapper for the division operator.
Definition: Div.h:81
Generic wrapper for the erf() function.
Definition: Erf.h:79
Generic wrapper for the erfc() function.
Definition: Erfc.h:69
Generic wrapper for the exp10() function.
Definition: Exp10.h:69
Generic wrapper for the exp2() function.
Definition: Exp2.h:69
Generic wrapper for the exp() function.
Definition: Exp.h:71
Generic wrapper for the floor() function.
Definition: Floor.h:83
Generic wrapper for the imag() function.
Definition: Imag.h:76
Generic wrapper for the invcbrt() function.
Definition: InvCbrt.h:69
Generic wrapper for the invsqrt() function.
Definition: InvSqrt.h:71
Generic wrapper for the lgamma() function.
Definition: LGamma.h:71
Generic wrapper for the log10() function.
Definition: Log10.h:71
Generic wrapper for the log1p() function.
Definition: Log1p.h:71
Generic wrapper for the log2() function.
Definition: Log2.h:69
Generic wrapper for the log() function.
Definition: Log.h:71
Generic wrapper for the max() function.
Definition: Max.h:82
Generic wrapper for the min() function.
Definition: Min.h:82
Generic wrapper for the logical NOT operator.
Definition: Not.h:60
Generic wrapper for the pow() function.
Definition: Pow.h:65
Generic wrapper for the real() function.
Definition: Real.h:82
Generic wrapper for the round() function.
Definition: Round.h:83
Generic wrapper for the uniform left-shift operation.
Definition: ShiftLI.h:78
Generic wrapper for the uniform right-shift operation.
Definition: ShiftRI.h:77
Generic wrapper for the sign() function.
Definition: Sign.h:83
Generic wrapper for the sin() function.
Definition: Sin.h:81
Generic wrapper for the sinh() function.
Definition: Sinh.h:81
Generic wrapper for the sqrt() function.
Definition: Sqrt.h:85
Generic wrapper for the subtraction operator.
Definition: Sub.h:85
Generic wrapper for the tan() function.
Definition: Tan.h:81
Generic wrapper for the tanh() function.
Definition: Tanh.h:81
Generic wrapper for the trunc() function.
Definition: Trunc.h:83
Base class for all unary vector map expression templates.
Definition: VecMapExpr.h:68
System settings for the inline keywords.
Header file for the RequiresEvaluation type trait.
Header file for basic type definitions.