35 #ifndef _BLAZE_MATH_EXPRESSIONS_DVECDVECADDEXPR_H_ 36 #define _BLAZE_MATH_EXPRESSIONS_DVECDVECADDEXPR_H_ 95 template<
typename VT1
99 :
public VecVecAddExpr< DenseVector< DVecDVecAddExpr<VT1,VT2,TF>, TF > >
138 template<
typename VT >
141 enum :
bool { value = useAssign };
154 template<
typename VT >
155 struct UseSMPAssign {
156 enum :
bool { value = ( !VT1::smpAssignable || !VT2::smpAssignable ) && useAssign };
296 return (*left_) + (*right_);
305 inline auto load() const noexcept {
306 return left_.load() + right_.load();
317 return left_ == rhs.
left_;
328 return left_ != rhs.
left_;
339 return left_ < rhs.
left_;
350 return left_ > rhs.
left_;
361 return left_ <= rhs.
left_;
372 return left_ >= rhs.
left_;
383 return left_ - rhs.
left_;
433 enum :
bool { simdEnabled = VT1::simdEnabled && VT2::simdEnabled &&
437 enum :
bool { smpAssignable = VT1::smpAssignable && VT2::smpAssignable };
479 if( index >=
lhs_.size() ) {
482 return (*
this)[index];
495 return lhs_.load( index ) +
rhs_.load( index );
524 inline size_t size() const noexcept {
555 template<
typename T >
556 inline bool canAlias(
const T* alias )
const noexcept {
568 template<
typename T >
569 inline bool isAliased(
const T* alias )
const noexcept {
570 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
580 return lhs_.isAligned() &&
rhs_.isAligned();
590 return lhs_.canSMPAssign() ||
rhs_.canSMPAssign() ||
591 (
size() > SMP_DVECDVECADD_THRESHOLD );
615 template<
typename VT >
624 addAssign( ~lhs, rhs.
rhs_ );
627 addAssign( ~lhs, rhs.
lhs_ );
630 assign ( ~lhs, rhs.
lhs_ );
631 addAssign( ~lhs, rhs.
rhs_ );
651 template<
typename VT >
683 template<
typename VT >
691 addAssign( ~lhs, rhs.
lhs_ );
692 addAssign( ~lhs, rhs.
rhs_ );
715 template<
typename VT >
723 subAssign( ~lhs, rhs.
lhs_ );
724 subAssign( ~lhs, rhs.
rhs_ );
747 template<
typename VT >
760 multAssign( ~lhs, tmp );
783 template<
typename VT >
796 divAssign( ~lhs, tmp );
819 template<
typename VT >
855 template<
typename VT >
887 template<
typename VT >
919 template<
typename VT >
951 template<
typename VT >
987 template<
typename VT >
1054 template<
typename VT1
1057 inline decltype(
auto)
1062 if( (~lhs).
size() != (~rhs).
size() ) {
1082 template<
typename VT1,
typename VT2,
bool TF >
1083 struct Size< DVecDVecAddExpr<VT1,VT2,TF> >
1084 :
public Maximum< Size<VT1>, Size<VT2> >
1100 template<
typename VT1,
typename VT2,
bool TF >
1101 struct IsAligned< DVecDVecAddExpr<VT1,VT2,TF> >
1102 :
public BoolConstant< And< IsAligned<VT1>, IsAligned<VT2> >::value >
1118 template<
typename VT1,
typename VT2,
bool TF >
1119 struct IsPadded< DVecDVecAddExpr<VT1,VT2,TF> >
1120 :
public BoolConstant< And< IsPadded<VT1>, IsPadded<VT2> >::value >
#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
Iterator over the elements of the dense vector.
Definition: DVecDVecAddExpr.h:184
Pointer difference type of the Blaze library.
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecAddExpr.h:188
ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DVecDVecAddExpr.h:214
Header file for auxiliary alias declarations.
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:72
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:349
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:70
BLAZE_ALWAYS_INLINE bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b) noexcept
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:786
Header file for basic type definitions.
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecAddExpr.h:579
ElementType_< ResultType > ElementType
Resulting element type.
Definition: DVecDVecAddExpr.h:166
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecDVecAddExpr.h:382
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecAddExpr.h:191
AddTrait_< RE1, RE2 > ResultType
Result type for expression template evaluations.
Definition: DVecDVecAddExpr.h:164
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 serial shim.
IfTrue_< useAssign, const ResultType, const DVecDVecAddExpr &> CompositeType
Data type for composite expression templates.
Definition: DVecDVecAddExpr.h:172
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:327
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecDVecAddExpr.h:524
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
If_< IsExpression< VT1 >, const VT1, const VT1 &> LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:175
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
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecAddExpr.h:514
Header file for the And class template.
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.
Availability of a SIMD addition for the given data types.Depending on the available instruction set (...
Definition: HasSIMDAdd.h:171
Header file for the AddExprTrait class template.
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecAddExpr.h:569
ConstIterator_< VT2 > RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:205
Header file for the Computation base class.
RightOperand rhs_
Right-hand side dense vector of the addition expression.
Definition: DVecDVecAddExpr.h:598
Header file for the RequiresEvaluation type trait.
ResultType_< VT1 > RE1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:104
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
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
ElementType_< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:110
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
CompositeType_< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:109
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:363
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecAddExpr.h:478
Constraint on the data type.
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecAddExpr.h:239
Compile time check for the alignment of data types.This type trait tests whether the given data type ...
Definition: IsAligned.h:87
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:72
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecAddExpr.h:406
ReturnType_< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:106
Header file for the IsTemporary type trait class.
typename AddExprTrait< T1, T2 >::Type AddExprTrait_
Auxiliary alias declaration for the AddExprTrait class template.The AddExprTrait_ alias declaration p...
Definition: AddExprTrait.h:112
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for the If class template.
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecDVecAddExpr.h:534
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecAddExpr.h:273
Header file for the VecVecAddExpr base class.
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecAddExpr.h:196
If_< IsExpression< VT2 >, const VT2, const VT2 &> RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:178
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
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecAddExpr.h:305
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecAddExpr.h:589
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:371
#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
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_VECVECADDEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid vector/vector ...
Definition: VecVecAddExpr.h:108
Header file for the HasSIMDAdd type trait.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Header file for all SIMD functionality.
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DVecDVecAddExpr.h:426
Header file for the IsAligned type trait.
Constraint on the data type.
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:360
DVecDVecAddExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the DVecDVecAddExpr class.
Definition: DVecDVecAddExpr.h:451
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecAddExpr.h:556
ReferenceType reference
Reference return type.
Definition: DVecDVecAddExpr.h:198
Constraint on the data type.
ElementType * PointerType
Pointer return type.
Definition: DVecDVecAddExpr.h:190
Header file for the exception macros of the math module.
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecAddExpr.h:226
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Base class for all vector/vector addition expression templates.The VecVecAddExpr class serves as a ta...
Definition: VecVecAddExpr.h:66
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecAddExpr.h:492
Header file for the EnableIf class template.
ReturnType_< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:107
Header file for the IsPadded type trait.
Constraint on the data type.
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecAddExpr.h:285
PointerType pointer
Pointer return type.
Definition: DVecDVecAddExpr.h:197
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: DVecDVecAddExpr.h:544
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecDVecAddExpr.h:169
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecAddExpr.h:465
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecDVecAddExpr.h:295
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:338
Header file for run time assertion macros.
ResultType_< VT2 > RE2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:105
Header file for the addition trait.
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
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
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecAddExpr.h:263
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:819
#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
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecAddExpr.h:425
LeftOperand lhs_
Left-hand side dense vector of the addition expression.
Definition: DVecDVecAddExpr.h:597
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecAddExpr.h:418
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
Expression object for dense vector-dense vector additions.The DVecDVecAddExpr class represents the co...
Definition: DVecDVecAddExpr.h:98
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecAddExpr.h:394
ElementType ValueType
Type of the underlying elements.
Definition: DVecDVecAddExpr.h:189
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3082
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
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:316
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecAddExpr.h:251
Header file for the IsComputation type trait class.
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 a vector.The Size type trait evaluates the size of the given v...
Definition: Size.h:74
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecAddExpr.h:165
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:130
Header file for the IntegralConstant class template.
ConstIterator_< VT1 > LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:202
CompositeType_< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:108
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecAddExpr.h:504
AddExprTrait_< RN1, RN2 > ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecAddExpr.h:124
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:423
ElementType_< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:111
Constraint on the data type.
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
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
typename AddTrait< T1, T2 >::Type AddTrait_
Auxiliary alias declaration for the AddTrait class template.The AddTrait_ alias declaration provides ...
Definition: AddTrait.h:250
#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
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecAddExpr.h:195
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.