35#ifndef _BLAZE_MATH_EXPRESSIONS_DMATSCALARMULTEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_DMATSCALARMULTEXPR_H_
133 static constexpr bool useAssign = ( IsComputation_v<MT> && RequiresEvaluation_v<MT> );
137 template<
typename MT2 >
138 static constexpr bool UseAssign_v =
useAssign;
150 template<
typename MT2 >
151 static constexpr bool UseSMPAssign_v =
152 ( ( !MT2::smpAssignable || !MT::smpAssignable ) &&
useAssign );
299 inline auto load() const noexcept {
428 ( MT::simdEnabled && IsNumeric_v<ET> &&
429 ( HasSIMDMult_v<ET,ST> || HasSIMDMult_v<UnderlyingElement_t<ET>,ST> ) );
528 inline size_t rows() const noexcept {
569 template<
typename T >
570 inline bool canAlias(
const T* alias )
const noexcept {
571 return IsExpression_v<MT> &&
matrix_.canAlias( alias );
581 template<
typename T >
582 inline bool isAliased(
const T* alias )
const noexcept {
583 return matrix_.isAliased( alias );
603 return matrix_.canSMPAssign() ||
604 (
rows() *
columns() >= SMP_DMATSCALARMULT_THRESHOLD );
628 template<
typename MT2
638 assign( *lhs, rhs.matrix_ );
639 assign( *lhs, (*lhs) * rhs.scalar_ );
658 template<
typename MT2
668 assign( *lhs, rhs.matrix_ );
669 (*lhs) *= rhs.scalar_;
688 template<
typename MT2
690 friend inline auto addAssign( DenseMatrix<MT2,SO2>& lhs,
const DMatScalarMultExpr& rhs )
691 -> EnableIf_t< UseAssign_v<MT2> >
703 addAssign( *lhs, tmp );
726 template<
typename MT2
728 friend inline auto subAssign( DenseMatrix<MT2,SO2>& lhs,
const DMatScalarMultExpr& rhs )
729 -> EnableIf_t< UseAssign_v<MT2> >
741 subAssign( *lhs, tmp );
764 template<
typename MT2
766 friend inline auto schurAssign( DenseMatrix<MT2,SO2>& lhs,
const DMatScalarMultExpr& rhs )
767 -> EnableIf_t< UseAssign_v<MT2> >
779 schurAssign( *lhs, tmp );
810 template<
typename MT2
813 -> EnableIf_t< UseSMPAssign_v<MT2> >
840 template<
typename MT2
843 -> EnableIf_t< UseSMPAssign_v<MT2> >
851 (*lhs) *= rhs.scalar_;
870 template<
typename MT2
873 -> EnableIf_t< UseSMPAssign_v<MT2> >
908 template<
typename MT2
911 -> EnableIf_t< UseSMPAssign_v<MT2> >
946 template<
typename MT2
949 -> EnableIf_t< UseSMPAssign_v<MT2> >
1015template<
typename MT
1023 return ReturnType( *dm, ScalarType(-1) );
1057template<
typename MT
1060 , EnableIf_t< IsScalar_v<ST> >* =
nullptr >
1067 return ReturnType( *mat, scalar );
1093template<
typename ST
1096 , EnableIf_t< IsScalar_v<ST> >* =
nullptr >
1103 return ReturnType( *mat, scalar );
1118template<
typename MT,
typename ST,
bool SO >
1119struct IsAligned< DMatScalarMultExpr<MT,ST,SO> >
1120 :
public IsAligned<MT>
1136template<
typename MT,
typename ST,
bool SO >
1137struct IsPadded< DMatScalarMultExpr<MT,ST,SO> >
1138 :
public IsPadded<MT>
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::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.
Definition: Aliases.h:310
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 EnableIf class template.
Header file for the function trace functionality.
Header file for the HasSIMDMult type trait.
Macro for CUDA compatibility.
Header file for the If class template.
Header file for the IsAligned type trait.
Header file for the IsComputation type trait class.
Header file for the IsExpression type trait class.
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.
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 matrix.
Definition: DMatScalarMultExpr.h:186
ElementType * PointerType
Pointer return type.
Definition: DMatScalarMultExpr.h:191
ElementType ValueType
Type of the underlying elements.
Definition: DMatScalarMultExpr.h:190
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition: DMatScalarMultExpr.h:268
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatScalarMultExpr.h:354
RightOperand scalar_
Scalar of the multiplication expression.
Definition: DMatScalarMultExpr.h:420
ConstIterator(IteratorType iterator, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: DMatScalarMultExpr.h:212
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition: DMatScalarMultExpr.h:258
ElementType & ReferenceType
Reference return type.
Definition: DMatScalarMultExpr.h:192
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DMatScalarMultExpr.h:376
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DMatScalarMultExpr.h:321
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatScalarMultExpr.h:343
IteratorType iterator_
Iterator to the current element.
Definition: DMatScalarMultExpr.h:419
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition: DMatScalarMultExpr.h:279
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DMatScalarMultExpr.h:388
ConstIterator_t< MT > IteratorType
ConstIterator type of the dense matrix expression.
Definition: DMatScalarMultExpr.h:203
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DMatScalarMultExpr.h:289
ReferenceType reference
Reference return type.
Definition: DMatScalarMultExpr.h:199
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DMatScalarMultExpr.h:189
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DMatScalarMultExpr.h:412
PointerType pointer
Pointer return type.
Definition: DMatScalarMultExpr.h:198
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatScalarMultExpr.h:365
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DMatScalarMultExpr.h:400
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DMatScalarMultExpr.h:310
IteratorCategory iterator_category
The iterator category.
Definition: DMatScalarMultExpr.h:196
ValueType value_type
Type of the underlying elements.
Definition: DMatScalarMultExpr.h:197
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition: DMatScalarMultExpr.h:247
DifferenceType difference_type
Difference between two iterators.
Definition: DMatScalarMultExpr.h:200
auto load() const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatScalarMultExpr.h:299
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DMatScalarMultExpr.h:193
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DMatScalarMultExpr.h:236
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DMatScalarMultExpr.h:224
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatScalarMultExpr.h:332
Expression object for dense matrix-scalar multiplications.
Definition: DMatScalarMultExpr.h:103
CompositeType_t< MT > CT
Composite type of the dense matrix expression.
Definition: DMatScalarMultExpr.h:109
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatScalarMultExpr.h:592
ReturnType_t< MT > RN
Return type of the dense matrix expression.
Definition: DMatScalarMultExpr.h:107
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense matrix operand.
Definition: DMatScalarMultExpr.h:548
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DMatScalarMultExpr.h:170
ElementType_t< MT > ET
Element type of the dense matrix expression.
Definition: DMatScalarMultExpr.h:108
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DMatScalarMultExpr.h:602
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DMatScalarMultExpr.h:167
If_t< IsExpression_v< MT >, const MT, const MT & > LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: DMatScalarMultExpr.h:176
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DMatScalarMultExpr.h:474
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DMatScalarMultExpr.h:570
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DMatScalarMultExpr.h:538
ResultType_t< MT > RT
Result type of the dense matrix expression.
Definition: DMatScalarMultExpr.h:106
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: DMatScalarMultExpr.h:518
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: DMatScalarMultExpr.h:179
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: DMatScalarMultExpr.h:507
If_t< useAssign, const ResultType, const DMatScalarMultExpr & > CompositeType
Data type for composite expression templates.
Definition: DMatScalarMultExpr.h:173
RightOperand scalar_
Right-hand side scalar of the multiplication expression.
Definition: DMatScalarMultExpr.h:611
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DMatScalarMultExpr.h:427
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: DMatScalarMultExpr.h:558
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DMatScalarMultExpr.h:437
BLAZE_ALWAYS_INLINE auto load(size_t i, size_t j) const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatScalarMultExpr.h:492
DMatScalarMultExpr(const MT &matrix, ST scalar) noexcept
Constructor for the DMatScalarMultExpr class.
Definition: DMatScalarMultExpr.h:446
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatScalarMultExpr.h:165
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DMatScalarMultExpr.h:582
MultTrait_t< RT, ST > ResultType
Result type for expression template evaluations.
Definition: DMatScalarMultExpr.h:164
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DMatScalarMultExpr.h:528
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatScalarMultExpr.h:459
decltype(std::declval< RN >() *std::declval< ST >()) ExprReturnType
Expression return type for the subscript operator.
Definition: DMatScalarMultExpr.h:122
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DMatScalarMultExpr.h:166
LeftOperand matrix_
Left-hand side dense matrix of the multiplication expression.
Definition: DMatScalarMultExpr.h:610
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DMatScalarMultExpr.h:432
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the multiplication expression.
Definition: DMatScalarMultExpr.h:133
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: DMatScalarMultExpr.h:119
Base class for dense matrices.
Definition: DenseMatrix.h:82
SIMD characteristics of data types.
Definition: SIMDTrait.h:297
Base class for sparse matrices.
Definition: SparseMatrix.h:77
Constraint on the data type.
Constraint on the data type.
Header file for the Computation base class.
Header file for the DenseMatrix base class.
Header file for the DenseVector base class.
Header file for the MatScalarMultExpr base class.
#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
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: DenseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_BE_SCALAR_TYPE(T)
Constraint on the data type.
Definition: Scalar.h:61
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.
Definition: StorageOrder.h:63
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.
Definition: MultTrait.h:165
typename UnderlyingBuiltin< T >::Type UnderlyingBuiltin_t
Auxiliary alias declaration for the UnderlyingBuiltin type trait.
Definition: UnderlyingBuiltin.h:117
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
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 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 smpSchurAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP Schur product assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:194
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.
Constraints on the storage order of matrix types.
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 matrix/scalar multiplication expression templates.
Definition: MatScalarMultExpr.h:77
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.