35#ifndef _BLAZE_MATH_EXPRESSIONS_DMATDMATSUBEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_DMATDMATSUBEXPR_H_
95 :
public MatMatSubExpr< DenseMatrix< DMatDMatSubExpr<MT1,MT2,SO>, SO > >
136 template<
typename MT >
137 static constexpr bool UseAssign_v =
useAssign;
149 template<
typename MT >
150 static constexpr bool UseSMPAssign_v =
151 ( ( !MT1::smpAssignable || !MT2::smpAssignable ) &&
useAssign );
296 return (*
left_) - (*right_);
305 inline auto load() const noexcept {
437 static constexpr bool smpAssignable = ( MT1::smpAssignable && MT2::smpAssignable );
483 if( i >=
lhs_.rows() ) {
486 if( j >=
lhs_.columns() ) {
505 return lhs_.load(i,j) -
rhs_.load(i,j);
536 inline size_t rows() const noexcept {
547 return lhs_.columns();
577 template<
typename T >
578 inline bool canAlias(
const T* alias )
const noexcept {
590 template<
typename T >
591 inline bool isAliased(
const T* alias )
const noexcept {
592 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
602 return lhs_.isAligned() &&
rhs_.isAligned();
612 return lhs_.canSMPAssign() ||
rhs_.canSMPAssign() ||
613 (
rows() *
columns() >= SMP_DMATDMATSUB_THRESHOLD );
637 template<
typename MT
648 subAssign( *lhs, rhs.rhs_ );
652 assign ( *lhs, -rhs.rhs_ );
653 addAssign( *lhs, rhs.lhs_ );
656 assign ( *lhs, rhs.lhs_ );
657 subAssign( *lhs, rhs.rhs_ );
677 template<
typename MT
696 const TmpType tmp(
serial( rhs ) );
716 template<
typename MT
718 friend inline auto addAssign( DenseMatrix<MT,SO2>& lhs,
const DMatDMatSubExpr& rhs )
727 subAssign( *lhs, rhs.rhs_ );
728 addAssign( *lhs, rhs.lhs_ );
731 addAssign( *lhs, rhs.lhs_ );
732 subAssign( *lhs, rhs.rhs_ );
756 template<
typename MT
758 friend inline auto subAssign( DenseMatrix<MT,SO2>& lhs,
const DMatDMatSubExpr& rhs )
767 addAssign( *lhs, rhs.rhs_ );
768 subAssign( *lhs, rhs.lhs_ );
771 subAssign( *lhs, rhs.lhs_ );
772 addAssign( *lhs, rhs.rhs_ );
796 template<
typename MT
798 friend inline auto schurAssign( DenseMatrix<MT,SO2>& lhs,
const DMatDMatSubExpr& rhs )
811 schurAssign( *lhs, tmp );
842 template<
typename MT
882 template<
typename MT
901 const TmpType tmp( rhs );
921 template<
typename MT
961 template<
typename MT
1002 template<
typename MT
1078template<
typename MT1
1081inline decltype(
auto)
1086 if( (*lhs).rows() != (*rhs).rows() || (*lhs).columns() != (*rhs).columns() ) {
1091 return ReturnType( *lhs, *rhs );
1106template<
typename MT1,
typename MT2,
bool SO >
1107struct IsAligned< DMatDMatSubExpr<MT1,MT2,SO> >
1108 :
public BoolConstant< IsAligned_v<MT1> && IsAligned_v<MT2> >
1124template<
typename MT1,
typename MT2,
bool SO >
1126 :
public BoolConstant< IsPadded_v<MT1> && IsPadded_v<MT2> >
Header file for auxiliary alias declarations.
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition Aliases.h:470
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::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition Aliases.h:110
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition Aliases.h:550
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition Aliases.h:190
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition Aliases.h:450
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 HasSIMDSub type trait.
Macro for CUDA compatibility.
Header file for the If class template.
Header file for the IntegralConstant class template.
Header file for the IsAligned type trait.
Header file for the IsExpression type trait class.
Header file for the IsOperation type trait class.
Header file for the IsPadded type trait.
Header file for the IsTemporary type trait class.
Header file for all SIMD functionality.
Header file for the subtraction trait.
Iterator over the elements of the dense matrix.
Definition DMatDMatSubExpr.h:185
ptrdiff_t DifferenceType
Difference between two iterators.
Definition DMatDMatSubExpr.h:192
IteratorCategory iterator_category
The iterator category.
Definition DMatDMatSubExpr.h:195
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition DMatDMatSubExpr.h:295
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition DMatDMatSubExpr.h:285
ConstIterator_t< MT2 > RightIteratorType
ConstIterator type of the right-hand side dense matrix expression.
Definition DMatDMatSubExpr.h:205
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition DMatDMatSubExpr.h:251
BLAZE_DEVICE_CALLABLE bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition DMatDMatSubExpr.h:349
BLAZE_DEVICE_CALLABLE bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition DMatDMatSubExpr.h:371
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition DMatDMatSubExpr.h:273
PointerType pointer
Pointer return type.
Definition DMatDMatSubExpr.h:197
ConstIterator_t< MT1 > LeftIteratorType
ConstIterator type of the left-hand side dense matrix expression.
Definition DMatDMatSubExpr.h:202
ElementType ValueType
Type of the underlying elements.
Definition DMatDMatSubExpr.h:189
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition DMatDMatSubExpr.h:263
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition DMatDMatSubExpr.h:394
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition DMatDMatSubExpr.h:239
BLAZE_DEVICE_CALLABLE bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition DMatDMatSubExpr.h:316
RightIteratorType right_
Iterator to the current right-hand side element.
Definition DMatDMatSubExpr.h:426
BLAZE_DEVICE_CALLABLE DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition DMatDMatSubExpr.h:382
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition DMatDMatSubExpr.h:188
ElementType & ReferenceType
Reference return type.
Definition DMatDMatSubExpr.h:191
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition DMatDMatSubExpr.h:406
DifferenceType difference_type
Difference between two iterators.
Definition DMatDMatSubExpr.h:199
BLAZE_DEVICE_CALLABLE ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition DMatDMatSubExpr.h:214
ValueType value_type
Type of the underlying elements.
Definition DMatDMatSubExpr.h:196
BLAZE_DEVICE_CALLABLE bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition DMatDMatSubExpr.h:338
auto load() const noexcept
Access to the SIMD elements of the matrix.
Definition DMatDMatSubExpr.h:305
ElementType * PointerType
Pointer return type.
Definition DMatDMatSubExpr.h:190
BLAZE_DEVICE_CALLABLE bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition DMatDMatSubExpr.h:360
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition DMatDMatSubExpr.h:425
ReferenceType reference
Reference return type.
Definition DMatDMatSubExpr.h:198
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition DMatDMatSubExpr.h:226
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition DMatDMatSubExpr.h:418
BLAZE_DEVICE_CALLABLE bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition DMatDMatSubExpr.h:327
Expression object for dense matrix-dense matrix subtractions.
Definition DMatDMatSubExpr.h:97
CompositeType_t< MT2 > CT2
Composite type of the right-hand side dense matrix expression.
Definition DMatDMatSubExpr.h:105
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition DMatDMatSubExpr.h:164
If_t< IsExpression_v< MT2 >, const MT2, const MT2 & > RightOperand
Composite type of the right-hand side dense matrix expression.
Definition DMatDMatSubExpr.h:178
SubTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition DMatDMatSubExpr.h:163
ReturnType_t< MT1 > RN1
Return type of the left-hand side dense matrix expression.
Definition DMatDMatSubExpr.h:102
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition DMatDMatSubExpr.h:482
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition DMatDMatSubExpr.h:546
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition DMatDMatSubExpr.h:117
ResultType_t< MT1 > RT1
Result type of the left-hand side dense matrix expression.
Definition DMatDMatSubExpr.h:100
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition DMatDMatSubExpr.h:515
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense matrix operand.
Definition DMatDMatSubExpr.h:556
ReturnType_t< MT2 > RN2
Return type of the right-hand side dense matrix expression.
Definition DMatDMatSubExpr.h:103
If_t< useAssign, const ResultType, const DMatDMatSubExpr & > CompositeType
Data type for composite expression templates.
Definition DMatDMatSubExpr.h:172
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition DMatDMatSubExpr.h:536
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition DMatDMatSubExpr.h:437
ElementType_t< MT1 > ET1
Element type of the left-hand side dense matrix expression.
Definition DMatDMatSubExpr.h:106
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition DMatDMatSubExpr.h:591
RightOperand rhs_
Right-hand side dense matrix of the subtraction expression.
Definition DMatDMatSubExpr.h:620
CompositeType_t< MT1 > CT1
Composite type of the left-hand side dense matrix expression.
Definition DMatDMatSubExpr.h:104
decltype(std::declval< RN1 >() - std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition DMatDMatSubExpr.h:120
DMatDMatSubExpr(const MT1 &lhs, const MT2 &rhs) noexcept
Constructor for the DMatDMatSubExpr class.
Definition DMatDMatSubExpr.h:451
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition DMatDMatSubExpr.h:578
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition DMatDMatSubExpr.h:611
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition DMatDMatSubExpr.h:467
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition DMatDMatSubExpr.h:165
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition DMatDMatSubExpr.h:433
ElementType_t< MT2 > ET2
Element type of the right-hand side dense matrix expression.
Definition DMatDMatSubExpr.h:107
If_t< IsExpression_v< MT1 >, const MT1, const MT1 & > LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition DMatDMatSubExpr.h:175
ElementType_t< ResultType > ElementType
Resulting element type.
Definition DMatDMatSubExpr.h:166
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition DMatDMatSubExpr.h:169
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition DMatDMatSubExpr.h:526
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition DMatDMatSubExpr.h:601
RightOperand rightOperand() const noexcept
Returns the right-hand side dense matrix operand.
Definition DMatDMatSubExpr.h:566
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition DMatDMatSubExpr.h:442
DMatDMatSubExpr< MT1, MT2, SO > This
Type of this DMatDMatSubExpr instance.
Definition DMatDMatSubExpr.h:158
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the subtraction expression.
Definition DMatDMatSubExpr.h:131
MatMatSubExpr< DenseMatrix< This, SO > > BaseType
Base type of this DMatDMatSubExpr instance.
Definition DMatDMatSubExpr.h:161
BLAZE_ALWAYS_INLINE auto load(size_t i, size_t j) const noexcept
Access to the SIMD elements of the matrix.
Definition DMatDMatSubExpr.h:500
LeftOperand lhs_
Left-hand side dense matrix of the subtraction expression.
Definition DMatDMatSubExpr.h:619
ResultType_t< MT2 > RT2
Result type of the right-hand side dense matrix expression.
Definition DMatDMatSubExpr.h:101
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
Pointer difference type of the Blaze library.
Constraint on the data type.
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 MatMatSubExpr base class.
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_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER(T1, T2)
Constraint on the data type.
Definition StorageOrder.h:84
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_MATMATSUBEXPR(T1, T2)
Constraint on the data type.
Definition MatMatSubExpr.h:103
#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_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.
Definition StorageOrder.h:63
typename SubTrait< T1, T2 >::Type SubTrait_t
Auxiliary alias declaration for the SubTrait class template.
Definition SubTrait.h:163
constexpr bool RequiresEvaluation_v
Auxiliary variable template for the RequiresEvaluation type trait.
Definition RequiresEvaluation.h:91
constexpr bool HasSIMDSub_v
Auxiliary variable template for the HasSIMDSub type trait.
Definition HasSIMDSub.h:187
constexpr bool IsExpression_v
Auxiliary variable template for the IsExpression type trait.
Definition IsExpression.h:114
constexpr bool IsOperation_v
Auxiliary variable template for the IsOperation type trait.
Definition IsOperation.h:89
constexpr bool IsTemporary_v
Auxiliary variable template for the IsTemporary type trait.
Definition IsTemporary.h:88
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:1424
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition Assert.h:101
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
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition Exception.h:235
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition FunctionTrace.h:94
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition If.h:108
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.
Definition IntegralConstant.h:110
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
Compile time check for data types with padding.
Definition IsPadded.h:77
Base class for all matrix/matrix subtraction expression templates.
Definition MatMatSubExpr.h:69
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.