35 #ifndef _BLAZE_MATH_EXPRESSIONS_DVECSCALARDIVEXPR_H_ 36 #define _BLAZE_MATH_EXPRESSIONS_DVECSCALARDIVEXPR_H_ 106 template<
typename VT
145 template<
typename VT2 >
148 enum :
bool { value = useAssign };
161 template<
typename VT2 >
162 struct UseSMPAssign {
163 enum :
bool { value = ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign };
219 : iterator_( iterator )
305 inline auto load() const noexcept {
306 return iterator_.load() /
set(
scalar_ );
433 enum :
bool { simdEnabled = VT::simdEnabled &&
439 enum :
bool { smpAssignable = VT::smpAssignable };
478 inline ReturnType
at(
size_t index )
const {
479 if( index >=
vector_.size() ) {
482 return (*
this)[index];
524 inline size_t size() const noexcept {
555 template<
typename T >
556 inline bool canAlias(
const T* alias )
const noexcept {
567 template<
typename T >
568 inline bool isAliased(
const T* alias )
const noexcept {
569 return vector_.isAliased( alias );
589 return vector_.canSMPAssign() || (
size() > SMP_DVECSCALARMULT_THRESHOLD );
613 template<
typename VT2 >
622 assign( ~lhs, (~lhs) / rhs.
scalar_ );
641 template<
typename VT2 >
669 template<
typename VT2 >
681 const ResultType tmp(
serial( rhs ) );
682 addAssign( ~lhs, tmp );
705 template<
typename VT2 >
717 const ResultType tmp(
serial( rhs ) );
718 subAssign( ~lhs, tmp );
741 template<
typename VT2 >
753 const ResultType tmp(
serial( rhs ) );
754 multAssign( ~lhs, tmp );
777 template<
typename VT2 >
789 const ResultType tmp(
serial( rhs ) );
790 divAssign( ~lhs, tmp );
813 template<
typename VT2 >
841 template<
typename VT2 >
869 template<
typename VT2 >
881 const ResultType tmp( rhs );
905 template<
typename VT2 >
917 const ResultType tmp( rhs );
941 template<
typename VT2 >
953 const ResultType tmp( rhs );
977 template<
typename VT2 >
989 const ResultType tmp( rhs );
1045 template<
typename T1
1059 return ReturnType( ~vec, ScalarType(1)/ScalarType(scalar) );
1089 template<
typename VT
1118 template<
typename ST1
1147 template<
typename VT
1184 template<
typename VT,
typename ST,
bool TF >
1185 struct Size< DVecScalarDivExpr<VT,ST,TF> > :
public Size<VT>
1201 template<
typename VT,
typename ST,
bool TF >
1202 struct IsAligned< DVecScalarDivExpr<VT,ST,TF> >
1219 template<
typename VT,
typename ST,
bool TF >
1220 struct IsPadded< DVecScalarDivExpr<VT,ST,TF> >
1237 template<
typename VT,
typename ST1,
typename ST2 >
1269 template<
typename VT,
typename ST1,
typename ST2 >
1301 template<
typename VT,
typename ST,
bool TF,
bool AF >
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: DVecScalarDivExpr.h:596
Pointer difference type of the Blaze library.
Compile time check for row vector types.This type trait tests whether or not the given template argum...
Definition: IsRowVector.h:80
Header file for auxiliary alias declarations.
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecScalarDivExpr.h:578
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:72
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:79
Constraint on the data type.
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecScalarDivExpr.h:172
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:70
Evaluation of the expression type type of a subvector operation.Via this type trait it is possible to...
Definition: SubvectorExprTrait.h:79
Evaluation of the expression type of a transpose dense vector/scalar multiplication.Via this type trait it is possible to evaluate the resulting expression type of a transpose dense vector/scalar multiplication. Given the transpose dense vector type VT and the scalar type ST, the nested type Type corresponds to the resulting expression type. In case either VT is not a transpose dense vector type or ST is not a scalar type, the resulting Type is set to INVALID_TYPE.
Definition: TDVecScalarMultExprTrait.h:126
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecScalarDivExpr.h:568
Header file for basic type definitions.
typename DVecScalarMultExprTrait< VT, ST >::Type DVecScalarMultExprTrait_
Auxiliary alias declaration for the DVecScalarMultExprTrait class template.The DVecScalarMultExprTrai...
Definition: DVecScalarMultExprTrait.h:164
Compile time check whether the given type is a multiplication expression template.This type trait class tests whether or not the given type Type is a multiplication expression template (i.e. an expression representing an element-wise vector multiplication, a matrix/vector multiplication, a vector/matrix multiplication, or a matrix multiplication). In order to qualify as a valid multiplication expression template, the given type has to derive (publicly or privately) from the MultExpr base class. In case the given type is a valid multiplication expression template, the value member constant is set to true, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to false, Type is FalseType, and the class derives from FalseType.
Definition: IsMultExpr.h:73
ElementType & ReferenceType
Reference return type.
Definition: DVecScalarDivExpr.h:198
RightOperand scalar_
Scalar of the division expression.
Definition: DVecScalarDivExpr.h:426
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.
LeftOperand vector_
Left-hand side dense vector of the division expression.
Definition: DVecScalarDivExpr.h:595
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
Evaluation of the expression type of a dense vector/scalar multiplication.Via this type trait it is p...
Definition: DVecScalarMultExprTrait.h:126
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecScalarDivExpr.h:176
If_< IsExpression< VT >, const VT, const VT &> LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecScalarDivExpr.h:182
Header file for the IsRowVector type trait.
Header file for the VecScalarDivExpr base class.
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
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecScalarDivExpr.h:199
ConstIterator(IteratorType iterator, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: DVecScalarDivExpr.h:218
Header file for the And class template.
Header file for the DenseVector base class.
DVecScalarDivExpr(const VT &vector, ST scalar) noexcept
Constructor for the DVecScalarDivExpr class.
Definition: DVecScalarDivExpr.h:453
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:245
Header file for the Computation base class.
Header file for the UnderlyingElement type trait.
Header file for the RequiresEvaluation type trait.
Base class for all vector/scalar division expression templates.The VecScalarDivExpr class serves as a...
Definition: VecScalarDivExpr.h:65
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
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecScalarDivExpr.h:253
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
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecScalarDivExpr.h:195
Header file for the DivExprTrait class template.
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecScalarDivExpr.h:406
Compile time check for the alignment of data types.This type trait tests whether the given data type ...
Definition: IsAligned.h:87
DifferenceType difference_type
Difference between two iterators.
Definition: DVecScalarDivExpr.h:206
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecScalarDivExpr.h:264
typename MultExprTrait< T1, T2 >::Type MultExprTrait_
Auxiliary alias declaration for the MultExprTrait class template.The MultExprTrait_ alias declaration...
Definition: MultExprTrait.h:344
Header file for the MultExprTrait class template.
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecScalarDivExpr.h:534
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:72
IfTrue_< useAssign, const ResultType, const DVecScalarDivExpr &> CompositeType
Data type for composite expression templates.
Definition: DVecScalarDivExpr.h:179
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
const EnableIf_< IsNumeric< T2 >, DivExprTrait_< T1, T2 > > operator/(const DenseMatrix< T1, SO > &mat, T2 scalar)
Division operator for the division of a dense matrix by a scalar value ( ).
Definition: DMatScalarDivExpr.h:966
Header file for the IsTemporary type trait class.
Header file for the multiplication trait.
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.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecScalarDivExpr.h:465
Header file for the IsMultExpr type trait class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2939
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:98
Header file for the Or class template.
Iterator over the elements of the dense vector.
Definition: DVecScalarDivExpr.h:191
#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
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecScalarDivExpr.h:382
ElementType ValueType
Type of the underlying elements.
Definition: DVecScalarDivExpr.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.
Availability of a SIMD division for the given data types.Depending on the available instruction set (...
Definition: HasSIMDDiv.h:144
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecScalarDivExpr.h:492
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE(A, B)
Data type constraint.In case the two types A and B are not the same (ignoring all cv-qualifiers of bo...
Definition: SameType.h:71
Header file for the IsAligned type trait.
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: DVecScalarDivExpr.h:185
Constraint on the data type.
DivExprTrait_< RN, ST > ExprReturnType
Expression return type for the subscript operator.
Definition: DVecScalarDivExpr.h:131
#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
ConstIterator_< VT > IteratorType
ConstIterator type of the dense vector expression.
Definition: DVecScalarDivExpr.h:209
Compile time check for column vector types.This type trait tests whether or not the given template ar...
Definition: IsColumnVector.h:80
ReturnType_< VT > RN
Return type of the dense vector expression.
Definition: DVecScalarDivExpr.h:116
Constraint on the data type.
Header file for the exception macros of the math module.
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecScalarDivExpr.h:230
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:349
IteratorType iterator_
Iterator to the current element.
Definition: DVecScalarDivExpr.h:425
Header file for all forward declarations for expression class templates.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:327
ValueType value_type
Type of the underlying elements.
Definition: DVecScalarDivExpr.h:203
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
ElementType_< ResultType > ElementType
Resulting element type.
Definition: DVecScalarDivExpr.h:173
typename DivTrait< T1, T2 >::Type DivTrait_
Auxiliary alias declaration for the DivTrait class template.The DivTrait_ alias declaration provides ...
Definition: DivTrait.h:245
Header file for the IsNumeric type trait.
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecScalarDivExpr.h:524
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecScalarDivExpr.h:305
PointerType pointer
Pointer return type.
Definition: DVecScalarDivExpr.h:204
Header file for run time assertion macros.
Utility type for generic codes.
DVecScalarDivExpr< VT, ST, TF > This
Type of this DVecScalarDivExpr instance.
Definition: DVecScalarDivExpr.h:170
DivTrait_< RT, ST > ResultType
Result type for expression template evaluations.
Definition: DVecScalarDivExpr.h:171
Header file for the division trait.
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecScalarDivExpr.h:514
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:360
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:371
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecScalarDivExpr.h:504
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
Constraint on the data type.
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: DVecScalarDivExpr.h:544
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecScalarDivExpr.h:274
IteratorCategory iterator_category
The iterator category.
Definition: DVecScalarDivExpr.h:202
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:93
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecScalarDivExpr.h:418
Compile time check for data types.This type trait tests whether or not the given template parameter i...
Definition: IsInvertible.h:83
Header file for the IsInvertible type trait.
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecScalarDivExpr.h:295
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
Header file for the IsDenseVector type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_FLOATING_POINT_TYPE(T)
Constraint on the data type.In case the given data type T is a floating point data type...
Definition: FloatingPoint.h:81
ElementType_< VT > ET
Element type of the dense vector expression.
Definition: DVecScalarDivExpr.h:117
Expression object for divisions of a dense vector by a scalar.The DVecScalarDivExpr class represents ...
Definition: DVecScalarDivExpr.h:109
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
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecScalarDivExpr.h:242
Header file for the HasSIMDDiv type trait.
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecScalarDivExpr.h:394
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecScalarDivExpr.h:478
Header file for the IsComputation type trait class.
Expression object for dense vector-scalar multiplications.The DVecScalarMultExpr class represents the...
Definition: DVecScalarMultExpr.h:117
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecScalarDivExpr.h:556
typename DivExprTrait< T1, T2 >::Type DivExprTrait_
Auxiliary alias declaration for the DivExprTrait class template.The DivExprTrait_ alias declaration p...
Definition: DivExprTrait.h:196
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:59
Compile time logical or evaluation.The Or class template performs at compile time a logical or ('&&')...
Definition: Or.h:101
Compile time evaluation of the size of a vector.The Size type trait evaluates the size of the given v...
Definition: Size.h:75
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:120
Header file for the IntegralConstant class template.
ResultType_< VT > RT
Result type of the dense vector expression.
Definition: DVecScalarDivExpr.h:115
ElementType * PointerType
Pointer return type.
Definition: DVecScalarDivExpr.h:197
Header file for the SubvectorExprTrait class template.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecScalarDivExpr.h:588
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecScalarDivExpr.h:285
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:316
typename T::RightOperand RightOperand_
Alias declaration for nested RightOperand type definitions.The RightOperand_ alias declaration provid...
Definition: Aliases.h:363
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
Header file for the IsColumnVector type trait.
const DMatDMatMultExpr< T1, T2, false, false, false, false > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7505
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.
#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 operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:338
CompositeType_< VT > CT
Composite type of the dense vector expression.
Definition: DVecScalarDivExpr.h:118
Header file for the IsExpression type trait class.
ReferenceType reference
Reference return type.
Definition: DVecScalarDivExpr.h:205
Header file for the function trace functionality.