35 #ifndef _BLAZE_MATH_EXPRESSIONS_DVECDVECSUBEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DVECDVECSUBEXPR_H_
94 template<
typename VT1
137 template<
typename VT >
140 enum :
bool { value = useAssign };
153 template<
typename VT >
154 struct UseSMPAssign {
155 enum :
bool { value = ( !VT1::smpAssignable || !VT2::smpAssignable ) && useAssign };
213 explicit inline ConstIterator( LeftIteratorType left, RightIteratorType right )
295 return (*left_) - (*right_);
304 inline auto load() const noexcept {
305 return left_.load() - right_.load();
316 return left_ == rhs.
left_;
327 return left_ != rhs.
left_;
338 return left_ < rhs.
left_;
349 return left_ > rhs.
left_;
360 return left_ <= rhs.
left_;
371 return left_ >= rhs.
left_;
382 return left_ - rhs.
left_;
432 enum :
bool { simdEnabled = VT1::simdEnabled && VT2::simdEnabled &&
436 enum :
bool { smpAssignable = VT1::smpAssignable && VT2::smpAssignable };
477 inline ReturnType
at(
size_t index )
const {
478 if( index >=
lhs_.size() ) {
481 return (*
this)[index];
494 return lhs_.load( index ) -
rhs_.load( index );
523 inline size_t size() const noexcept {
554 template<
typename T >
555 inline bool canAlias(
const T* alias )
const noexcept {
567 template<
typename T >
568 inline bool isAliased(
const T* alias )
const noexcept {
569 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
579 return lhs_.isAligned() &&
rhs_.isAligned();
589 return lhs_.canSMPAssign() ||
rhs_.canSMPAssign() ||
590 (
size() > SMP_DVECDVECSUB_THRESHOLD );
614 template<
typename VT >
623 subAssign( ~lhs, rhs.
rhs_ );
626 assign ( ~lhs, rhs.
lhs_ );
627 subAssign( ~lhs, rhs.
rhs_ );
647 template<
typename VT >
659 const ResultType tmp(
serial( rhs ) );
679 template<
typename VT >
680 friend inline EnableIf_< UseAssign<VT> >
687 addAssign( ~lhs, rhs.lhs_ );
688 subAssign( ~lhs, rhs.rhs_ );
711 template<
typename VT >
712 friend inline EnableIf_< UseAssign<VT> >
719 subAssign( ~lhs, rhs.lhs_ );
720 addAssign( ~lhs, rhs.rhs_ );
743 template<
typename VT >
744 friend inline EnableIf_< UseAssign<VT> >
755 const ResultType tmp(
serial( rhs ) );
756 multAssign( ~lhs, tmp );
779 template<
typename VT >
780 friend inline EnableIf_< UseAssign<VT> >
791 const ResultType tmp(
serial( rhs ) );
792 divAssign( ~lhs, tmp );
815 template<
typename VT >
816 friend inline EnableIf_< UseSMPAssign<VT> >
823 if( !IsComputation<VT1>::value &&
isSame( ~lhs, rhs.lhs_ ) ) {
848 template<
typename VT >
849 friend inline EnableIf_< UseSMPAssign<VT> >
860 const ResultType tmp( rhs );
880 template<
typename VT >
881 friend inline EnableIf_< UseSMPAssign<VT> >
912 template<
typename VT >
913 friend inline EnableIf_< UseSMPAssign<VT> >
944 template<
typename VT >
945 friend inline EnableIf_< UseSMPAssign<VT> >
956 const ResultType tmp( rhs );
980 template<
typename VT >
981 friend inline EnableIf_< UseSMPAssign<VT> >
992 const ResultType tmp( rhs );
1047 template<
typename T1
1050 inline const DVecDVecSubExpr<T1,T2,TF>
1055 if( (~lhs).
size() != (~rhs).
size() ) {
1074 template<
typename VT1,
typename VT2,
bool TF >
1076 :
public Max< Size<VT1>, Size<VT2> >
1092 template<
typename VT1,
typename VT2,
bool TF >
1094 :
public BoolConstant< And< IsAligned<VT1>, IsAligned<VT2> >::value >
1110 template<
typename VT1,
typename VT2,
bool TF >
1112 :
public BoolConstant< And< IsPadded<VT1>, IsPadded<VT2> >::value >
1128 template<
typename VT1,
typename VT2,
bool TF,
bool AF >
1133 using Type = SubExprTrait_< SubvectorExprTrait_<const VT1,AF>
1134 , SubvectorExprTrait_<const VT2,AF> >;
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecDVecSubExpr.h:191
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DVecDVecSubExpr.h:425
#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
PointerType pointer
Pointer return type.
Definition: DVecDVecSubExpr.h:196
Pointer difference type of the Blaze library.
Header file for auxiliary alias declarations.
Header file for the Max class template.
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:72
ElementType_< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:110
Availability of a SIMD subtraction for the given data types.Depending on the available instruction se...
Definition: HasSIMDSub.h:163
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:70
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecSubExpr.h:195
Header file for the subtraction trait.
ResultType_< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:104
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:653
Header file for basic type definitions.
ReferenceType reference
Reference return type.
Definition: DVecDVecSubExpr.h:197
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecSubExpr.h:262
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
Header file for the serial shim.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecSubExpr.h:464
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecSubExpr.h:393
ConstIterator_< VT2 > RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:204
SubExprTrait_< RN1, RN2 > ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecSubExpr.h:123
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
Header file for the And class template.
Header file for the DenseVector base class.
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:723
Header file for the Computation base class.
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:731
Header file for the RequiresEvaluation type trait.
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecSubExpr.h:238
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
DVecDVecSubExpr< VT1, VT2, TF > This
Type of this DVecDVecSubExpr instance.
Definition: DVecDVecSubExpr.h:162
ElementType * PointerType
Pointer return type.
Definition: DVecDVecSubExpr.h:189
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecSubExpr.h:578
Constraint on the data type.
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:343
ConstIterator_< VT1 > LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:201
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecSubExpr.h:417
typename SubExprTrait< T1, T2 >::Type SubExprTrait_
Auxiliary alias declaration for the SubExprTrait class template.The SubExprTrait_ alias declaration p...
Definition: SubExprTrait.h:220
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:72
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecSubExpr.h:225
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecDVecSubExpr.h:294
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:359
IfTrue_< useAssign, const ResultType, const DVecDVecSubExpr & > CompositeType
Data type for composite expression templates.
Definition: DVecDVecSubExpr.h:171
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:370
Header file for the IsTemporary type trait class.
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecDVecSubExpr.h:168
ReturnType_< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:106
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecSubExpr.h:194
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecDVecSubExpr.h:381
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.
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecSubExpr.h:272
ResultType_< VT1 > RT1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:103
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecSubExpr.h:187
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
Iterator over the elements of the dense vector.
Definition: DVecDVecSubExpr.h:183
#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
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecDVecSubExpr.h:533
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:326
DifferenceType difference_type
Difference between two iterators.
Definition: DVecDVecSubExpr.h:198
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
Header file for the IsAligned type trait.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:60
CompositeType_< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:107
Constraint on the data type.
Header file for the exception macros of the math module.
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecSubExpr.h:424
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecSubExpr.h:405
Header file for the VecVecSubExpr base class.
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecSubExpr.h:513
Header file for all forward declarations for expression class templates.
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecSubExpr.h:503
ElementType ValueType
Type of the underlying elements.
Definition: DVecDVecSubExpr.h:188
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecSubExpr.h:588
ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DVecDVecSubExpr.h:213
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:337
Header file for run time assertion macros.
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecDVecSubExpr.h:523
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:160
EnableIf_< IsDenseVector< VT1 > > smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:222
DVecDVecSubExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the DVecDVecSubExpr class.
Definition: DVecDVecSubExpr.h:450
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecSubExpr.h:190
If_< IsExpression< VT1 >, const VT1, const VT1 & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:174
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecSubExpr.h:250
If_< IsExpression< VT2 >, const VT2, const VT2 & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:177
Header file for the HasSIMDSub type trait.
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:315
ElementType_< ResultType > ElementType
Resulting element type.
Definition: DVecDVecSubExpr.h:165
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
RightOperand rhs_
Right-hand side dense vector of the subtraction expression.
Definition: DVecDVecSubExpr.h:597
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecSubExpr.h:555
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecSubExpr.h:477
Constraint on the data type.
ReturnType_< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:105
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
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_VECVECSUBEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid vector/vector ...
Definition: VecVecSubExpr.h:109
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:59
typename SubTrait< T1, T2 >::Type SubTrait_
Auxiliary alias declaration for the SubTrait class template.The SubTrait_ alias declaration provides ...
Definition: SubTrait.h:245
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:110
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
ElementType_< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:109
Header file for the IntegralConstant class template.
Header file for the SubvectorExprTrait class template.
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: DVecDVecSubExpr.h:543
SubTrait_< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: DVecDVecSubExpr.h:163
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecSubExpr.h:491
Base class for all vector/vector subtraction expression templates.The VecVecSubExpr class serves as a...
Definition: VecVecSubExpr.h:65
LeftOperand lhs_
Left-hand side dense vector of the subtraction expression.
Definition: DVecDVecSubExpr.h:596
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecSubExpr.h:284
Header file for the SubExprTrait class template.
Expression object for dense vector-dense vector subtractions.The DVecDVecSubExpr class represents the...
Definition: DVecDVecSubExpr.h:97
System settings for the inline keywords.
Header file for the Size type trait.
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecSubExpr.h:164
#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.
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:348
#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
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecSubExpr.h:568
Compile time check whether the given type is an expression template.This type trait class tests wheth...
Definition: IsExpression.h:71
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecSubExpr.h:304
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
CompositeType_< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:108