35 #ifndef _BLAZE_MATH_EXPRESSIONS_DVECDVECDIVEXPR_H_ 36 #define _BLAZE_MATH_EXPRESSIONS_DVECDVECDIVEXPR_H_ 91 template<
typename VT1
95 :
public VecVecDivExpr< DenseVector< DVecDVecDivExpr<VT1,VT2,TF>, TF > >
117 static constexpr
bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );
132 ( RequiresEvaluation_v<VT1> || RequiresEvaluation_v<VT2> || !
returnExpr );
135 template<
typename VT >
137 static constexpr
bool UseAssign_v =
useAssign;
149 template<
typename VT >
150 static constexpr
bool UseSMPAssign_v =
151 ( ( !VT1::smpAssignable || !VT2::smpAssignable ) &&
useAssign );
291 return (*
left_) / (*right_);
300 inline auto load() const noexcept {
429 ( VT1::simdEnabled && VT2::simdEnabled && HasSIMDDiv_v<ET1,ET2> );
432 static constexpr
bool smpAssignable = ( VT1::smpAssignable && VT2::smpAssignable );
474 if( index >=
lhs_.size() ) {
477 return (*
this)[index];
490 return lhs_.load( index ) /
rhs_.load( index );
519 inline size_t size() const noexcept {
550 template<
typename T >
551 inline bool canAlias(
const T* alias )
const noexcept {
552 return ( IsExpression_v<VT1> && ( RequiresEvaluation_v<VT1> ?
lhs_.isAliased( alias ) :
lhs_.canAlias( alias ) ) ) ||
553 ( IsExpression_v<VT2> && ( RequiresEvaluation_v<VT2> ?
rhs_.isAliased( alias ) :
rhs_.canAlias( alias ) ) );
563 template<
typename T >
564 inline bool isAliased(
const T* alias )
const noexcept {
565 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
575 return lhs_.isAligned() &&
rhs_.isAligned();
585 return lhs_.canSMPAssign() ||
rhs_.canSMPAssign() ||
586 (
size() > SMP_DVECDVECDIV_THRESHOLD );
610 template<
typename VT >
624 if( !IsComputation_v<VT1> &&
isSame( ~lhs, rhs.lhs_ ) ) {
625 divAssign( ~lhs, rhs.rhs_ );
627 else if( ( IsSame_v<VT,ResultType> || IsSame_v<ET,ET1> ) && !rhs.rhs_.isAliased( &(~lhs) ) ) {
628 assign ( ~lhs, rhs.lhs_ );
629 divAssign( ~lhs, rhs.rhs_ );
653 template<
typename VT >
685 template<
typename VT >
686 friend inline auto addAssign( DenseVector<VT,TF>& lhs,
const DVecDVecDivExpr& rhs )
687 -> EnableIf_t< UseAssign_v<VT> >
698 addAssign( ~lhs, tmp );
721 template<
typename VT >
722 friend inline auto subAssign( DenseVector<VT,TF>& lhs,
const DVecDVecDivExpr& rhs )
723 -> EnableIf_t< UseAssign_v<VT> >
734 subAssign( ~lhs, tmp );
757 template<
typename VT >
758 friend inline auto multAssign( DenseVector<VT,TF>& lhs,
const DVecDVecDivExpr& rhs )
759 -> EnableIf_t< UseAssign_v<VT> >
770 multAssign( ~lhs, tmp );
793 template<
typename VT >
794 friend inline auto divAssign( DenseVector<VT,TF>& lhs,
const DVecDVecDivExpr& rhs )
795 -> EnableIf_t< UseAssign_v<VT> >
806 divAssign( ~lhs, tmp );
829 template<
typename VT >
831 -> EnableIf_t< UseSMPAssign_v<VT> >
835 using ET = ElementType_t<VT>;
843 if( !IsComputation_v<VT1> &&
isSame( ~lhs, rhs.lhs_ ) ) {
846 else if( ( IsSame_v<VT,ResultType> || IsSame_v<ET,ET1> ) && !rhs.rhs_.isAliased( &(~lhs) ) ) {
872 template<
typename VT >
874 -> EnableIf_t< UseSMPAssign_v<VT> >
904 template<
typename VT >
906 -> EnableIf_t< UseSMPAssign_v<VT> >
940 template<
typename VT >
942 -> EnableIf_t< UseSMPAssign_v<VT> >
976 template<
typename VT >
978 -> EnableIf_t< UseSMPAssign_v<VT> >
1012 template<
typename VT >
1014 -> EnableIf_t< UseSMPAssign_v<VT> >
1080 template<
typename VT1
1083 inline decltype(
auto)
1088 if( (~lhs).
size() != (~rhs).
size() ) {
1093 return ReturnType( ~lhs, ~rhs );
1108 template<
typename VT1,
typename VT2,
bool TF >
1109 struct IsAligned< DVecDVecDivExpr<VT1,VT2,TF> >
1110 :
public BoolConstant< IsAligned_v<VT1> && IsAligned_v<VT2> >
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecDVecDivExpr.h:428
#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.
Header file for auxiliary alias declarations.
ReturnType_t< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecDivExpr.h:103
Header file for the VecVecDivExpr base class.
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:992
Header file for basic type definitions.
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the division expression.
Definition: DVecDVecDivExpr.h:131
ResultType_t< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecDivExpr.h:101
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecDivExpr.h:186
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecDivExpr.h:246
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias template for the If class template.The If_t alias template provides a convenient shor...
Definition: If.h:109
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecDivExpr.h:190
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
Header file for the serial shim.
typename DivTrait< T1, T2 >::Type DivTrait_t
Auxiliary alias declaration for the DivTrait class template.The DivTrait_t alias declaration provides...
Definition: DivTrait.h:239
ReturnType_t< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecDivExpr.h:102
Header file for the IsSame and IsStrictlySame type traits.
ConstIterator_t< VT1 > LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecDivExpr.h:197
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecDivExpr.h:499
Iterator over the elements of the dense vector.
Definition: DVecDVecDivExpr.h:179
Header file for the DenseVector base class.
Header file for the Computation base class.
RightOperand rhs_
Right-hand side dense vector of the division expression.
Definition: DVecDVecDivExpr.h:593
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DVecDVecDivExpr.h:421
Constraint on the data type.
If_t< IsExpression_v< VT2 >, const VT2, const VT2 & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecDivExpr.h:173
Header file for the RequiresEvaluation type trait.
ReferenceType reference
Reference return type.
Definition: DVecDVecDivExpr.h:193
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
BLAZE_DEVICE_CALLABLE ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DVecDVecDivExpr.h:209
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
auto smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:220
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DVecDVecDivExpr.h:161
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecDivExpr.h:460
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecDivExpr.h:183
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecDVecDivExpr.h:519
CompositeType_t< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecDivExpr.h:104
Expression object for dense vector-dense vector divisions.The DVecDVecDivExpr class represents the co...
Definition: DVecDVecDivExpr.h:94
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecDivExpr.h:234
Header file for the IsTemporary type trait class.
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
DivTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: DVecDVecDivExpr.h:159
Header file for the If class template.
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DVecDVecDivExpr.h:437
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecDivExpr.h:420
ElementType * PointerType
Pointer return type.
Definition: DVecDVecDivExpr.h:185
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecDivExpr.h:268
CompositeType_t< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecDivExpr.h:105
#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: DVecDVecDivExpr.h:529
Base class for all vector/vector division expression templates.The VecVecDivExpr class serves as a ta...
Definition: VecVecDivExpr.h:66
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecDivExpr.h:160
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecDivExpr.h:389
Header file for all SIMD functionality.
PointerType pointer
Pointer return type.
Definition: DVecDVecDivExpr.h:192
ConstIterator_t< VT2 > RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecDivExpr.h:200
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.
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecDivExpr.h:413
BLAZE_DEVICE_CALLABLE bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecDivExpr.h:355
Constraint on the data type.
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecDivExpr.h:574
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecDivExpr.h:564
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecDVecDivExpr.h:164
Constraint on the data type.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecDVecDivExpr.h:187
Header file for the exception macros of the math module.
BLAZE_DEVICE_CALLABLE bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecDivExpr.h:344
BLAZE_DEVICE_CALLABLE ReturnType operator *() const
Direct access to the element at the current iterator position.
Definition: DVecDVecDivExpr.h:290
Constraint on the data type.
Header file for the EnableIf class template.
BLAZE_DEVICE_CALLABLE bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecDivExpr.h:333
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecDivExpr.h:300
decltype(std::declval< RN1 >()/std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecDivExpr.h:120
ElementType_t< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecDivExpr.h:107
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecDVecDivExpr.h:432
If_t< useAssign, const ResultType, const DVecDVecDivExpr & > CompositeType
Data type for composite expression templates.
Definition: DVecDVecDivExpr.h:167
ResultType_t< VT1 > RT1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecDivExpr.h:100
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
Header file for run time assertion macros.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: DVecDVecDivExpr.h:117
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecDivExpr.h:191
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
Header file for the division trait.
If_t< IsExpression_v< VT1 >, const VT1, const VT1 & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecDivExpr.h:170
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:295
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
Header file for all forward declarations for expression class templates.
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecDivExpr.h:258
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecDivExpr.h:280
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
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant alias template represents ...
Definition: IntegralConstant.h:110
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecDivExpr.h:473
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecDivExpr.h:487
BLAZE_DEVICE_CALLABLE bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecDivExpr.h:322
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecDivExpr.h:584
ElementType_t< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecDivExpr.h:106
#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
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecDivExpr.h:509
LeftOperand lhs_
Left-hand side dense vector of the division expression.
Definition: DVecDVecDivExpr.h:592
Macro for CUDA compatibility.
Header file for the HasSIMDDiv type trait.
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_VECVECDIVEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid vector/vector ...
Definition: VecVecDivExpr.h:104
Header file for the IsComputation type trait class.
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
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:66
BLAZE_DEVICE_CALLABLE bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecDivExpr.h:311
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:146
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecDivExpr.h:221
Header file for the IntegralConstant class template.
ElementType ValueType
Type of the underlying elements.
Definition: DVecDVecDivExpr.h:184
BLAZE_DEVICE_CALLABLE bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecDivExpr.h:366
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: DVecDVecDivExpr.h:539
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition: HostDevice.h:94
DVecDVecDivExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the DVecDVecDivExpr class.
Definition: DVecDVecDivExpr.h:446
BLAZE_DEVICE_CALLABLE DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecDVecDivExpr.h:377
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecDivExpr.h:401
System settings for the inline keywords.
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.In case the given data type T is not a dense or sparse vector type and in...
Definition: TransposeFlag.h:63
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector.
Definition: DenseVector.h:191
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecDivExpr.h:551
Header file for the IsExpression type trait class.
Header file for the function trace functionality.