35 #ifndef _BLAZE_MATH_EXPRESSIONS_DVECDVECMAPEXPR_H_ 36 #define _BLAZE_MATH_EXPRESSIONS_DVECDVECMAPEXPR_H_ 95 template<
typename VT1
100 :
public VecVecMapExpr< DenseVector< DVecDVecMapExpr<VT1,VT2,OP,TF>, TF > >
132 template<
typename VT >
135 enum :
bool { value = useAssign };
148 template<
typename VT >
149 struct UseSMPAssign {
150 enum :
bool { value = ( !VT1::smpAssignable || !VT2::smpAssignable ) && useAssign };
157 struct UseSIMDEnabledFlag {
159 enum :
bool { value = OP::BLAZE_TEMPLATE simdEnabled<ET1,ET2>() };
172 using ReturnType = decltype( std::declval<OP>()( std::declval<RN1>(), std::declval<RN2>() ) );
310 return op_( *left_, *right_ );
319 inline auto load() const noexcept {
320 return op_.load( left_.load(), right_.load() );
331 return left_ == rhs.
left_;
342 return left_ != rhs.
left_;
353 return left_ < rhs.
left_;
364 return left_ > rhs.
left_;
375 return left_ <= rhs.
left_;
386 return left_ >= rhs.
left_;
397 return left_ - rhs.
left_;
448 enum :
bool { simdEnabled = VT1::simdEnabled && VT2::simdEnabled &&
452 enum :
bool { smpAssignable = VT1::smpAssignable && VT2::smpAssignable };
494 if( index >=
lhs_.size() ) {
497 return (*
this)[index];
510 return op_.load(
lhs_.load( index ),
rhs_.load( index ) );
539 inline size_t size() const noexcept {
580 template<
typename T >
581 inline bool canAlias(
const T* alias )
const noexcept {
593 template<
typename T >
594 inline bool isAliased(
const T* alias )
const noexcept {
595 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
605 return lhs_.isAligned() &&
rhs_.isAligned();
615 return lhs_.canSMPAssign() &&
rhs_.canSMPAssign();
640 template<
typename VT >
654 assign( ~lhs,
map( x, y, rhs.
op_ ) );
673 template<
typename VT >
705 template<
typename VT >
719 addAssign( ~lhs,
map( x, y, rhs.
op_ ) );
742 template<
typename VT >
756 subAssign( ~lhs,
map( x, y, rhs.
op_ ) );
779 template<
typename VT >
793 multAssign( ~lhs,
map( x, y, rhs.
op_ ) );
816 template<
typename VT >
830 divAssign( ~lhs,
map( x, y, rhs.
op_ ) );
853 template<
typename VT >
886 template<
typename VT >
919 template<
typename VT >
957 template<
typename VT >
995 template<
typename VT >
1033 template<
typename VT >
1097 template<
typename VT1
1101 inline decltype(
auto)
1106 if( (~lhs).
size() != (~rhs).
size() ) {
1134 template<
typename VT1
1137 inline decltype(
auto)
1142 return map( ~lhs, ~rhs,
Min() );
1165 template<
typename VT1
1168 inline decltype(
auto)
1173 return map( ~lhs, ~rhs,
Max() );
1196 template<
typename VT1
1199 inline decltype(
auto)
1227 template<
typename VT1
1230 inline decltype(
auto)
1235 return map( ~lhs, ~rhs,
Pow() );
1258 template<
typename VT1
1261 inline decltype(
auto)
1281 template<
typename VT1,
typename VT2,
typename OP,
bool TF >
1282 struct Size< DVecDVecMapExpr<VT1,VT2,OP,TF>, 0UL >
1283 :
public Maximum< Size<VT1,0UL>, Size<VT2,0UL> >
1299 template<
typename VT1,
typename VT2,
typename OP,
bool TF >
1300 struct IsAligned< DVecDVecMapExpr<VT1,VT2,OP,TF> >
1301 :
public And< IsAligned<VT1>, IsAligned<VT2> >
1317 template<
typename VT1,
typename VT2,
typename OP,
bool TF >
1318 struct IsPadded< DVecDVecMapExpr<VT1,VT2,OP,TF> >
1319 :
public And< IsPadded<VT1>, IsPadded<VT2> >
Header file for the Pow functor.
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Pointer difference type of the Blaze library.
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecMapExpr.h:207
ReferenceType reference
Reference return type.
Definition: DVecDVecMapExpr.h:210
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecMapExpr.h:265
Header file for auxiliary alias declarations.
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecMapExpr.h:253
If_< RequiresEvaluation< VT1 >, const RT1, CT1 > LT
Type for the assignment of the left-hand side dense vector operand.
Definition: DVecDVecMapExpr.h:187
decltype(std::declval< OP >()(std::declval< RN1 >(), std::declval< RN2 >())) ReturnType
Return type for expression template evaluations.
Definition: DVecDVecMapExpr.h:172
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecMapExpr.h:287
Header file for basic type definitions.
ElementType_< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecMapExpr.h:107
decltype(auto) hypot(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise hypotenous for the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1235
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecDVecMapExpr.h:309
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:164
Header file for the Hypot functor.
Header file for the serial shim.
Generic wrapper for the atan2() function.
Definition: Atan2.h:62
RightOperand rhs_
Right-hand side dense vector of the map expression.
Definition: DVecDVecMapExpr.h:622
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecMapExpr.h:299
Header file for the IsSame and IsStrictlySame type traits.
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:1267
typename BinaryMapTrait< T1, T2, OP >::Type BinaryMapTrait_
Auxiliary alias declaration for the BinaryMapTrait class template.The BinaryMapTrait_ alias declarati...
Definition: BinaryMapTrait.h:139
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecMapExpr.h:581
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecMapExpr.h:341
Header file for the And class template.
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
Compile time value evaluation.The Maximum alias declaration selects the larger of the two given templ...
Definition: Maximum.h:73
Header file for the DenseVector base class.
LeftOperand lhs_
Left-hand side dense vector of the map expression.
Definition: DVecDVecMapExpr.h:621
ElementType * PointerType
Pointer return type.
Definition: DVecDVecMapExpr.h:202
Header file for the Computation base class.
Header file for the RequiresEvaluation type trait.
CompositeType_< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecMapExpr.h:112
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecMapExpr.h:432
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1950
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:133
Header file for the VecVecMapExpr base class.
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:363
ElementType_< ResultType > ElementType
Resulting element type.
Definition: DVecDVecMapExpr.h:169
Compile time check for the alignment of data types.This type trait tests whether the given data type ...
Definition: IsAligned.h:87
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecMapExpr.h:604
Header file for the Maximum class template.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:71
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecMapExpr.h:277
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
ElementType_< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecMapExpr.h:108
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecMapExpr.h:203
Operation operation() const
Returns a copy of the custom operation.
Definition: DVecDVecMapExpr.h:569
ElementType ValueType
Type of the underlying elements.
Definition: DVecDVecMapExpr.h:201
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
Header file for nested template disabiguation.
Header file for the If class template.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecMapExpr.h:480
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecMapExpr.h:363
Compile time check for data types with padding.This type trait tests whether the given data type empl...
Definition: IsPadded.h:76
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:102
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
Iterator over the elements of the dense vector map expression.
Definition: DVecDVecMapExpr.h:196
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Header file for all SIMD functionality.
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecMapExpr.h:529
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
Header file for the IsAligned type trait.
Constraint on the data type.
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecMapExpr.h:330
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DVecDVecMapExpr.h:440
OP op_
The custom unary operation.
Definition: DVecDVecMapExpr.h:441
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecMapExpr.h:439
Constraint on the data type.
DVecDVecMapExpr(const VT1 &lhs, const VT2 &rhs, OP op) noexcept
Constructor for the DVecMapExpr class.
Definition: DVecDVecMapExpr.h:467
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecDVecMapExpr.h:396
ReturnType_< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecMapExpr.h:109
Header file for the exception macros of the math module.
decltype(auto) atan2(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the multi-valued inverse tangent of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1299
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecMapExpr.h:352
Constraint on the data type.
ResultType_< VT1 > RT1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecMapExpr.h:105
Header file for all forward declarations for expression class templates.
If_< RequiresEvaluation< VT2 >, const RT2, CT2 > RT
Type for the assignment of the right-hand side dense vector operand.
Definition: DVecDVecMapExpr.h:190
ResultType_< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecMapExpr.h:106
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecMapExpr.h:614
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
ConstIterator(LeftIteratorType left, RightIteratorType right, OP op)
Constructor for the ConstIterator class.
Definition: DVecDVecMapExpr.h:227
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecMapExpr.h:374
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecMapExpr.h:385
Header file for the binary map trait.
ReturnType_< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecMapExpr.h:110
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecDVecMapExpr.h:549
Header file for run time assertion macros.
PointerType pointer
Pointer return type.
Definition: DVecDVecMapExpr.h:209
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecMapExpr.h:493
Generic wrapper for the pow() function.
Definition: Pow.h:62
Generic wrapper for the max() function.
Definition: Max.h:62
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecMapExpr.h:200
OP Operation
Data type of the custom unary operation.
Definition: DVecDVecMapExpr.h:184
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:154
EnableIf_< IsDenseVector< VT1 > > smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:222
Header file for the Atan2 functor.
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:296
#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
CompositeType_< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecMapExpr.h:111
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:816
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecMapExpr.h:507
Header file for the HasMember type traits.
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecMapExpr.h:594
#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
ConstIterator_< VT1 > LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecMapExpr.h:214
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecMapExpr.h:519
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
Generic wrapper for the min() function.
Definition: Min.h:62
Header file for the Min functor.
ConstIterator_< VT2 > RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecMapExpr.h:217
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecMapExpr.h:208
If_< IsExpression< VT2 >, const VT2, const VT2 &> RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecMapExpr.h:181
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecMapExpr.h:168
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecMapExpr.h:408
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecMapExpr.h:319
Operation op_
The custom unary operation.
Definition: DVecDVecMapExpr.h:623
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:66
Compile time evaluation of the size of vectors and matrices.The Size type trait evaluates the size of...
Definition: Size.h:80
Generic wrapper for the hypot() function.
Definition: Hypot.h:62
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecMapExpr.h:420
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:130
BinaryMapTrait_< RT1, RT2, OP > ResultType
Result type for expression template evaluations.
Definition: DVecDVecMapExpr.h:167
Base class for all binary vector map expression templates.The VecVecMapExpr class serves as a tag for...
Definition: VecVecMapExpr.h:66
Compile time logical 'and' evaluation.The And alias declaration performs at compile time a logical 'a...
Definition: And.h:76
Header file for the Max functor.
Expression object for the dense vector-dense vector map() function.The DVecDVecMapExpr class represen...
Definition: DVecDVecMapExpr.h:99
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:423
IfTrue_< useAssign, const ResultType, const DVecDVecMapExpr &> CompositeType
Data type for composite expression templates.
Definition: DVecDVecMapExpr.h:175
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecMapExpr.h:240
BLAZE_CREATE_HAS_DATA_OR_FUNCTION_MEMBER_TYPE_TRAIT(HasSIMDEnabled, simdEnabled)
Definition of the HasSIMDEnabled type trait.
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: DVecDVecMapExpr.h:559
System settings for the inline keywords.
Header file for the Size type trait.
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.In case the given data type T is not a dense or sparse vector type and in...
Definition: TransposeFlag.h:63
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Compile time check whether the given type is an expression template.This type trait class tests wheth...
Definition: IsExpression.h:95
Header file for the IsExpression type trait class.
Header file for the function trace functionality.
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecDVecMapExpr.h:539
If_< IsExpression< VT1 >, const VT1, const VT1 &> LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecMapExpr.h:178
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:1134