35#ifndef _BLAZE_MATH_EXPRESSIONS_DVECSCALARDIVEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_DVECSCALARDIVEXPR_H_
138 static constexpr bool useAssign = IsComputation_v<VT> && RequiresEvaluation_v<VT>;
142 template<
typename VT2 >
143 static constexpr bool UseAssign_v =
useAssign;
155 template<
typename VT2 >
156 static constexpr bool UseSMPAssign_v =
157 ( ( !VT2::smpAssignable || !VT::smpAssignable ) &&
useAssign );
303 inline auto load() const noexcept {
432 ( VT::simdEnabled && IsNumeric_v<ET> &&
433 ( HasSIMDDiv_v<ET,ST> || HasSIMDDiv_v<UnderlyingElement_t<ET>,ST> ) );
476 if( index >=
vector_.size() ) {
479 return (*
this)[index];
521 inline size_t size() const noexcept {
552 template<
typename T >
553 inline bool canAlias(
const T* alias )
const noexcept {
554 return IsExpression_v<VT> &&
vector_.canAlias( alias );
564 template<
typename T >
565 inline bool isAliased(
const T* alias )
const noexcept {
566 return vector_.isAliased( alias );
586 return vector_.canSMPAssign() || (
size() > SMP_DVECSCALARMULT_THRESHOLD );
610 template<
typename VT2 >
618 assign( *lhs, rhs.vector_ );
619 assign( *lhs, (*lhs) / rhs.scalar_ );
638 template<
typename VT2 >
646 assign( *lhs, rhs.vector_ );
647 (*lhs) /= rhs.scalar_;
666 template<
typename VT2 >
667 friend inline auto addAssign( DenseVector<VT2,TF>& lhs,
const DVecScalarDivExpr& rhs )
668 -> EnableIf_t< UseAssign_v<VT2> >
679 addAssign( *lhs, tmp );
702 template<
typename VT2 >
703 friend inline auto subAssign( DenseVector<VT2,TF>& lhs,
const DVecScalarDivExpr& rhs )
704 -> EnableIf_t< UseAssign_v<VT2> >
715 subAssign( *lhs, tmp );
738 template<
typename VT2 >
739 friend inline auto multAssign( DenseVector<VT2,TF>& lhs,
const DVecScalarDivExpr& rhs )
740 -> EnableIf_t< UseAssign_v<VT2> >
751 multAssign( *lhs, tmp );
774 template<
typename VT2 >
775 friend inline auto divAssign( DenseVector<VT2,TF>& lhs,
const DVecScalarDivExpr& rhs )
776 -> EnableIf_t< UseAssign_v<VT2> >
787 divAssign( *lhs, tmp );
810 template<
typename VT2 >
812 -> EnableIf_t< UseSMPAssign_v<VT2> >
838 template<
typename VT2 >
840 -> EnableIf_t< UseSMPAssign_v<VT2> >
847 (*lhs) /= rhs.scalar_;
866 template<
typename VT2 >
868 -> EnableIf_t< UseSMPAssign_v<VT2> >
902 template<
typename VT2 >
904 -> EnableIf_t< UseSMPAssign_v<VT2> >
938 template<
typename VT2 >
940 -> EnableIf_t< UseSMPAssign_v<VT2> >
974 template<
typename VT2 >
976 -> EnableIf_t< UseSMPAssign_v<VT2> >
1023template<
typename VT
1025using DVecScalarDivExprHelper_t =
1026 If_t< IsFloatingPoint_v< UnderlyingBuiltin_t<VT> > ||
1027 IsFloatingPoint_v< UnderlyingBuiltin_t<ST> >
1028 , If_t< IsBuiltin_v<ST>
1029 , DivTrait_t< UnderlyingBuiltin_t<VT>, ST >
1030 ,
decltype(
inv( std::declval<ST>() ) ) >
1048template<
typename VT
1051 , EnableIf_t< !IsInvertible_v< DVecScalarDivExprHelper_t<VT,ST> > >* =
nullptr >
1052inline decltype(
auto) dvecscalardiv(
const DenseVector<VT,TF>& vec, ST scalar )
1056 using ScalarType = DVecScalarDivExprHelper_t<VT,ST>;
1057 using ReturnType =
const DVecScalarDivExpr<VT,ScalarType,TF>;
1059 return ReturnType( *vec, scalar );
1077template<
typename VT
1080 , EnableIf_t< IsInvertible_v< DVecScalarDivExprHelper_t<VT,ST> > >* =
nullptr >
1081inline decltype(
auto) dvecscalardiv(
const DenseVector<VT,TF>& vec, ST scalar )
1085 using ScalarType = DVecScalarDivExprHelper_t<VT,ST>;
1086 using ReturnType =
const DVecScalarMultExpr<VT,ScalarType,TF>;
1088 return ReturnType( *vec,
inv(scalar) );
1118template<
typename VT
1121 , EnableIf_t< IsScalar_v<ST> >* =
nullptr >
1128 return dvecscalardiv( *vec, scalar );
1143template<
typename VT,
typename ST,
bool TF >
1144struct IsAligned< DVecScalarDivExpr<VT,ST,TF> >
1145 :
public IsAligned<VT>
1161template<
typename VT,
typename ST,
bool TF >
1162struct IsPadded< DVecScalarDivExpr<VT,ST,TF> >
1163 :
public IsPadded<VT>
Header file for auxiliary alias declarations.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition: Aliases.h:110
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.
Constraint on the data type.
Header file for the function trace functionality.
Header file for the HasSIMDDiv type trait.
Macro for CUDA compatibility.
Header file for the If class template.
Header file for the invert shim.
Header file for the IsAligned type trait.
Header file for the IsBuiltin type trait.
Header file for the IsComputation type trait class.
Header file for the IsExpression type trait class.
Header file for the IsFloatingPoint type trait.
Header file for the IsInvertible type trait.
Header file for the IsNumeric type trait.
Header file for the IsPadded type trait.
Header file for the IsScalar type trait.
Header file for the IsTemporary type trait class.
Deactivation of problematic macros.
Header file for the multiplication trait.
Header file for all SIMD functionality.
Constraint on the data type.
Header file for the UnderlyingBuiltin type trait.
Header file for the UnderlyingElement type trait.
Iterator over the elements of the dense vector.
Definition: DVecScalarDivExpr.h:190
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:369
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecScalarDivExpr.h:240
DifferenceType difference_type
Difference between two iterators.
Definition: DVecScalarDivExpr.h:204
ElementType ValueType
Type of the underlying elements.
Definition: DVecScalarDivExpr.h:194
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:314
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:325
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecScalarDivExpr.h:293
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:336
ConstIterator_t< VT > IteratorType
ConstIterator type of the dense vector expression.
Definition: DVecScalarDivExpr.h:207
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecScalarDivExpr.h:197
PointerType pointer
Pointer return type.
Definition: DVecScalarDivExpr.h:202
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecScalarDivExpr.h:303
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecScalarDivExpr.h:262
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecScalarDivExpr.h:392
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecScalarDivExpr.h:228
IteratorType iterator_
Iterator to the current element.
Definition: DVecScalarDivExpr.h:423
IteratorCategory iterator_category
The iterator category.
Definition: DVecScalarDivExpr.h:200
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecScalarDivExpr.h:416
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition: DVecScalarDivExpr.h:251
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecScalarDivExpr.h:272
ReferenceType reference
Reference return type.
Definition: DVecScalarDivExpr.h:203
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecScalarDivExpr.h:404
ElementType * PointerType
Pointer return type.
Definition: DVecScalarDivExpr.h:195
RightOperand scalar_
Scalar of the division expression.
Definition: DVecScalarDivExpr.h:424
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecScalarDivExpr.h:380
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecScalarDivExpr.h:283
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:347
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecScalarDivExpr.h:193
ElementType & ReferenceType
Reference return type.
Definition: DVecScalarDivExpr.h:196
ValueType value_type
Type of the underlying elements.
Definition: DVecScalarDivExpr.h:201
ConstIterator(IteratorType iterator, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: DVecScalarDivExpr.h:216
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:358
Expression object for divisions of a dense vector by a scalar.
Definition: DVecScalarDivExpr.h:108
CompositeType_t< VT > CT
Composite type of the dense vector expression.
Definition: DVecScalarDivExpr.h:114
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecScalarDivExpr.h:565
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecScalarDivExpr.h:431
DVecScalarDivExpr(const VT &vector, ST scalar) noexcept
Constructor for the DVecScalarDivExpr class.
Definition: DVecScalarDivExpr.h:450
ReturnType_t< VT > RN
Return type of the dense vector expression.
Definition: DVecScalarDivExpr.h:112
LeftOperand vector_
Left-hand side dense vector of the division expression.
Definition: DVecScalarDivExpr.h:592
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: DVecScalarDivExpr.h:541
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the division expression.
Definition: DVecScalarDivExpr.h:138
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecScalarDivExpr.h:436
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecScalarDivExpr.h:521
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecScalarDivExpr.h:531
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DVecScalarDivExpr.h:171
ElementType_t< VT > ET
Element type of the dense vector expression.
Definition: DVecScalarDivExpr.h:113
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecScalarDivExpr.h:489
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecScalarDivExpr.h:462
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecScalarDivExpr.h:575
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: DVecScalarDivExpr.h:593
decltype(std::declval< RN >()/std::declval< ST >()) ExprReturnType
Expression return type for the subscript operator.
Definition: DVecScalarDivExpr.h:127
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecScalarDivExpr.h:511
ResultType_t< VT > RT
Result type of the dense vector expression.
Definition: DVecScalarDivExpr.h:111
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: DVecScalarDivExpr.h:183
DivTrait_t< RT, ST > ResultType
Result type for expression template evaluations.
Definition: DVecScalarDivExpr.h:169
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DVecScalarDivExpr.h:441
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecScalarDivExpr.h:174
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecScalarDivExpr.h:501
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecScalarDivExpr.h:475
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecScalarDivExpr.h:170
If_t< useAssign, const ResultType, const DVecScalarDivExpr & > CompositeType
Data type for composite expression templates.
Definition: DVecScalarDivExpr.h:177
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecScalarDivExpr.h:585
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: DVecScalarDivExpr.h:124
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecScalarDivExpr.h:553
If_t< IsExpression_v< VT >, const VT, const VT & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecScalarDivExpr.h:180
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
SIMD characteristics of data types.
Definition: SIMDTrait.h:297
Base class for sparse vectors.
Definition: SparseVector.h:72
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 VecScalarDivExpr base class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_FLOATING_POINT_TYPE(T)
Constraint on the data type.
Definition: FloatingPoint.h:81
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE(A, B)
Data type constraint.
Definition: SameType.h:71
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) inv(const DenseMatrix< MT, SO > &dm)
Calculation of the inverse of the given dense matrix.
Definition: DMatInvExpr.h:405
#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
#define BLAZE_CONSTRAINT_MUST_BE_SCALAR_TYPE(T)
Constraint on the data type.
Definition: Scalar.h:61
typename DivTrait< T1, T2 >::Type DivTrait_t
Auxiliary alias declaration for the DivTrait class template.
Definition: DivTrait.h:164
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition: Assert.h:117
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:75
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
#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.
Base class for all compute expression templates.
Definition: Computation.h:68
Base class for all vector/scalar division expression templates.
Definition: VecScalarDivExpr.h:75
System settings for the inline keywords.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
Header file for the RequiresEvaluation type trait.
Header file for basic type definitions.