35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATDMATMAPEXPR_H_ 36 #define _BLAZE_MATH_EXPRESSIONS_DMATDMATMAPEXPR_H_ 95 template<
typename MT1
100 :
public MatMatMapExpr< DenseMatrix< DMatDMatMapExpr<MT1,MT2,OP,SO>, SO > >
123 static constexpr
bool useAssign = ( RequiresEvaluation_v<MT1> || RequiresEvaluation_v<MT2> );
126 template<
typename MT >
128 static constexpr
bool UseAssign_v =
useAssign;
140 template<
typename MT >
141 static constexpr
bool UseSMPAssign_v =
156 using ReturnType = decltype( std::declval<OP>()( std::declval<RN1>(), std::declval<RN2>() ) );
303 inline auto load() const noexcept {
433 ( MT1::simdEnabled && MT2::simdEnabled &&
482 if( i >=
lhs_.rows() ) {
485 if( j >=
lhs_.columns() ) {
535 inline size_t rows() const noexcept {
546 return lhs_.columns();
586 template<
typename T >
587 inline bool canAlias(
const T* alias )
const noexcept {
588 return ( IsExpression_v<MT1> &&
lhs_.canAlias( alias ) ) ||
589 ( IsExpression_v<MT2> &&
rhs_.canAlias( alias ) );
599 template<
typename T >
600 inline bool isAliased(
const T* alias )
const noexcept {
601 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
611 return lhs_.isAligned() &&
rhs_.isAligned();
621 return lhs_.canSMPAssign() &&
rhs_.canSMPAssign();
646 template<
typename MT
666 assign( ~lhs,
map( A, B, rhs.op_ ) );
685 template<
typename MT
704 const TmpType tmp(
serial( rhs ) );
724 template<
typename MT
726 friend inline auto addAssign( DenseMatrix<MT,SO2>& lhs,
const DMatDMatMapExpr& rhs )
727 -> EnableIf_t< UseAssign_v<MT> >
744 addAssign( ~lhs,
map( A, B, rhs.op_ ) );
767 template<
typename MT
769 friend inline auto subAssign( DenseMatrix<MT,SO2>& lhs,
const DMatDMatMapExpr& rhs )
770 -> EnableIf_t< UseAssign_v<MT> >
787 subAssign( ~lhs,
map( A, B, rhs.op_ ) );
810 template<
typename MT
812 friend inline auto schurAssign( DenseMatrix<MT,SO2>& lhs,
const DMatDMatMapExpr& rhs )
813 -> EnableIf_t< UseAssign_v<MT> >
830 schurAssign( ~lhs,
map( A, B, rhs.op_ ) );
861 template<
typename MT
864 -> EnableIf_t< UseSMPAssign_v<MT> >
900 template<
typename MT
903 -> EnableIf_t< UseSMPAssign_v<MT> >
907 using TmpType = If_t< SO == SO2, ResultType, OppositeType >;
919 const TmpType tmp( rhs );
940 template<
typename MT
943 -> EnableIf_t< UseSMPAssign_v<MT> >
984 template<
typename MT
987 -> EnableIf_t< UseSMPAssign_v<MT> >
1028 template<
typename MT
1031 -> EnableIf_t< UseSMPAssign_v<MT> >
1105 template<
typename MT1
1109 inline decltype(
auto)
1142 template<
typename MT1
1146 inline decltype(
auto)
1151 return map( ~lhs, ~rhs,
Min() );
1174 template<
typename MT1
1178 inline decltype(
auto)
1183 return map( ~lhs, ~rhs,
Max() );
1206 template<
typename MT1
1210 inline decltype(
auto)
1238 template<
typename MT1
1242 inline decltype(
auto)
1247 return map( ~lhs, ~rhs,
Pow() );
1270 template<
typename MT1
1274 inline decltype(
auto)
1294 template<
typename MT1,
typename MT2,
typename OP,
bool SO >
1295 struct IsAligned< DMatDMatMapExpr<MT1,MT2,OP,SO> >
1296 :
public BoolConstant< IsAligned_v<MT1> && IsAligned_v<MT2> >
1312 template<
typename MT1,
typename MT2,
typename OP,
bool SO >
1313 struct IsPadded< DMatDMatMapExpr<MT1,MT2,OP,SO> >
1314 :
public BoolConstant< IsPadded_v<MT1> && IsPadded_v<MT2> && IsPaddingEnabled_v<OP> >
Header file for the Pow functor.
#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
Header file for the IsPaddingEnabled type trait.
Pointer difference type of the Blaze library.
IteratorCategory iterator_category
The iterator category.
Definition: DMatDMatMapExpr.h:191
Header file for auxiliary alias declarations.
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DMatDMatMapExpr.h:432
Base class for all binary matrix map expression templates.The MatMatMapExpr class serves as a tag for...
Definition: MatMatMapExpr.h:66
DMatDMatMapExpr(const MT1 &lhs, const MT2 &rhs, OP op) noexcept
Constructor for the DMatDMatMapExpr class.
Definition: DMatDMatMapExpr.h:452
Header file for the HasLoad type trait.
Header file for basic type definitions.
decltype(auto) hypot(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise hypotenous for the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1211
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias declaration for the If class template.The If_t alias declaration provides a convenien...
Definition: If.h:109
Operation operation() const
Returns a copy of the custom operation.
Definition: DMatDMatMapExpr.h:575
ResultType_t< MT1 > RT1
Result type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:105
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DMatDMatMapExpr.h:545
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
decltype(std::declval< OP >()(std::declval< RN1 >(), std::declval< RN2 >())) ReturnType
Return type for expression template evaluations.
Definition: DMatDMatMapExpr.h:156
Header file for the Hypot functor.
Header file for the serial shim.
Generic wrapper for the atan2() function.
Definition: Atan2.h:75
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:224
If_t< useAssign, const ResultType, const DMatDMatMapExpr &> CompositeType
Data type for composite expression templates.
Definition: DMatDMatMapExpr.h:159
typename MapTrait< Args... >::Type MapTrait_t
Auxiliary alias declaration for the MapTrait class template.The MapTrait_t alias declaration provides...
Definition: MapTrait.h:160
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DMatDMatMapExpr.h:153
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DMatDMatMapExpr.h:416
decltype(auto) pow(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise exponential value for the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1243
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatDMatMapExpr.h:610
LeftOperand lhs_
Left-hand side dense matrix of the map expression.
Definition: DMatDMatMapExpr.h:627
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DMatDMatMapExpr.h:293
Header file for the Computation base class.
ElementType * PointerType
Pointer return type.
Definition: DMatDMatMapExpr.h:186
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:325
ResultType_t< MT2 > RT2
Result type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:106
Header file for the RequiresEvaluation type trait.
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DMatDMatMapExpr.h:237
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
RightOperand rightOperand() const noexcept
Returns the right-hand side dense matrix operand.
Definition: DMatDMatMapExpr.h:565
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DMatDMatMapExpr.h:620
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:80
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:137
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
PointerType pointer
Pointer return type.
Definition: DMatDMatMapExpr.h:193
ElementType & ReferenceType
Reference return type.
Definition: DMatDMatMapExpr.h:187
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DMatDMatMapExpr.h:283
Constraint on the data type.
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_ALWAYS_INLINE auto load(size_t i, size_t j) const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatDMatMapExpr.h:499
ReturnType_t< MT2 > RN2
Return type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:110
OP Operation
Data type of the custom unary operation.
Definition: DMatDMatMapExpr.h:168
ConstIterator_t< MT2 > RightIteratorType
ConstIterator type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:201
Iterator over the elements of the dense matrix map expression.
Definition: DMatDMatMapExpr.h:180
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
Header file for the If class template.
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense matrix operand.
Definition: DMatDMatMapExpr.h:555
CompositeType_t< MT1 > CT1
Composite type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:111
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1147
#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
Header file for the DenseMatrix base class.
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:369
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
Header file for all SIMD functionality.
auto load() const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatDMatMapExpr.h:303
Header file for the IsAligned type trait.
ConstIterator & operator--()
Pre-decrement operator.
Definition: DMatDMatMapExpr.h:271
ConstIterator_t< MT1 > LeftIteratorType
ConstIterator type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:198
const ConstIterator operator++(int)
Post-increment operator.
Definition: DMatDMatMapExpr.h:261
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DMatDMatMapExpr.h:184
If_t< RequiresEvaluation_v< MT2 >, const RT2, CT2 > RT
Type for the assignment of the right-hand side dense matrix operand.
Definition: DMatDMatMapExpr.h:174
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DMatDMatMapExpr.h:442
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DMatDMatMapExpr.h:424
Constraints on the storage order of matrix types.
If_t< IsExpression_v< MT2 >, const MT2, const MT2 &> RightOperand
Composite type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:165
Header file for the exception macros of the math module.
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DMatDMatMapExpr.h:404
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1179
decltype(auto) atan2(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the multi-valued inverse tangent of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1275
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
ReturnType_t< MT1 > RN1
Return type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:109
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DMatDMatMapExpr.h:481
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.The OppositeType_t alias declaration provi...
Definition: Aliases.h:270
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DMatDMatMapExpr.h:437
OP op_
The custom unary operation.
Definition: DMatDMatMapExpr.h:425
Header file for the IsSIMDEnabled type trait.
ElementType ValueType
Type of the underlying elements.
Definition: DMatDMatMapExpr.h:185
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.
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatDMatMapExpr.h:466
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
MapTrait_t< RT1, RT2, OP > ResultType
Result type for expression template evaluations.
Definition: DMatDMatMapExpr.h:150
Generic wrapper for the pow() function.
Definition: Pow.h:62
Generic wrapper for the max() function.
Definition: Max.h:79
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
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DMatDMatMapExpr.h:423
Expression object for the dense matrix-dense matrix map() function.The DMatDMatMapExpr class represen...
Definition: DMatDMatMapExpr.h:99
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:314
ValueType value_type
Type of the underlying elements.
Definition: DMatDMatMapExpr.h:192
Header file for the Atan2 functor.
ElementType_t< MT1 > ET1
Element type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:107
RightOperand rhs_
Right-hand side dense matrix of the map expression.
Definition: DMatDMatMapExpr.h:628
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
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DMatDMatMapExpr.h:392
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the map expression.
Definition: DMatDMatMapExpr.h:123
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
Header file for the HasMember type traits.
#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
CompositeType_t< MT2 > CT2
Composite type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:112
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:101
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DMatDMatMapExpr.h:535
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
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
#define BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER(T1, T2)
Constraint on the data type.In case either of the two given data types T1 or T2 is not a matrix type ...
Definition: StorageOrder.h:84
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: DMatDMatMapExpr.h:525
Operation op_
The custom unary operation.
Definition: DMatDMatMapExpr.h:629
Generic wrapper for the min() function.
Definition: Min.h:79
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
Header file for the Min functor.
If_t< IsExpression_v< MT1 >, const MT1, const MT1 &> LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:162
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DMatDMatMapExpr.h:152
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatDMatMapExpr.h:151
ReferenceType reference
Reference return type.
Definition: DMatDMatMapExpr.h:194
ElementType_t< MT2 > ET2
Element type of the right-hand side dense matrix expression.
Definition: DMatDMatMapExpr.h:108
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:336
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DMatDMatMapExpr.h:380
Header file for the MatMatMapExpr base 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
ConstIterator(LeftIteratorType left, RightIteratorType right, OP op)
Constructor for the ConstIterator class.
Definition: DMatDMatMapExpr.h:211
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:66
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:347
Generic wrapper for the hypot() function.
Definition: Hypot.h:75
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DMatDMatMapExpr.h:587
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: DMatDMatMapExpr.h:514
Header file for the IntegralConstant class template.
Header file for the map trait.
Header file for the Max functor.
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DMatDMatMapExpr.h:224
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatDMatMapExpr.h:358
System settings for the inline keywords.
#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
If_t< RequiresEvaluation_v< MT1 >, const RT1, CT1 > LT
Type for the assignment of the left-hand side dense matrix operand.
Definition: DMatDMatMapExpr.h:171
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DMatDMatMapExpr.h:600
Header file for the IsExpression type trait class.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DMatDMatMapExpr.h:188
Header file for the function trace functionality.
decltype(auto) map(const DenseMatrix< MT1, SO > &lhs, const DenseMatrix< MT2, SO > &rhs, OP op)
Evaluates the given binary operation on each single element of the dense matrices lhs and rhs...
Definition: DMatDMatMapExpr.h:1110
ConstIterator & operator++()
Pre-increment operator.
Definition: DMatDMatMapExpr.h:249