35#ifndef _BLAZE_MATH_EXPRESSIONS_DMATDMATSCHUREXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_DMATDMATSCHUREXPR_H_
102template<
typename MT1
106 :
public SchurExpr< DenseMatrix< DMatDMatSchurExpr<MT1,MT2,SO>, SO > >
147 template<
typename MT >
148 static constexpr bool UseAssign_v =
useAssign;
160 template<
typename MT >
161 static constexpr bool UseSMPAssign_v =
162 ( ( !MT1::smpAssignable || !MT2::smpAssignable ) &&
useAssign );
307 return (*
left_) * (*right_);
316 inline auto load() const noexcept {
448 static constexpr bool smpAssignable = ( MT1::smpAssignable && MT2::smpAssignable );
494 if( i >=
lhs_.rows() ) {
497 if( j >=
lhs_.columns() ) {
516 return lhs_.load(i,j) *
rhs_.load(i,j);
547 inline size_t rows() const noexcept {
558 return lhs_.columns();
588 template<
typename T >
589 inline bool canAlias(
const T* alias )
const noexcept {
601 template<
typename T >
602 inline bool isAliased(
const T* alias )
const noexcept {
603 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
613 return lhs_.isAligned() &&
rhs_.isAligned();
623 return lhs_.canSMPAssign() ||
rhs_.canSMPAssign() ||
624 (
rows() *
columns() >= SMP_DMATDMATSCHUR_THRESHOLD );
649 template<
typename MT
660 schurAssign( *lhs, rhs.rhs_ );
665 assign( *lhs, A % B );
685 template<
typename MT
696 schurAssign( *lhs, rhs.rhs_ );
699 schurAssign( *lhs, rhs.lhs_ );
702 assign ( *lhs, rhs.rhs_ );
703 schurAssign( *lhs, rhs.lhs_ );
706 assign ( *lhs, rhs.lhs_ );
707 schurAssign( *lhs, rhs.rhs_ );
727 template<
typename MT
729 friend inline auto assign( SparseMatrix<MT,SO2>& lhs,
const DMatDMatSchurExpr& rhs )
746 const TmpType tmp(
serial( rhs ) );
766 template<
typename MT
768 friend inline auto addAssign( DenseMatrix<MT,SO2>& lhs,
const DMatDMatSchurExpr& rhs )
781 addAssign( *lhs, tmp );
804 template<
typename MT
806 friend inline auto subAssign( DenseMatrix<MT,SO2>& lhs,
const DMatDMatSchurExpr& rhs )
819 subAssign( *lhs, tmp );
843 template<
typename MT
845 friend inline auto schurAssign( DenseMatrix<MT,SO2>& lhs,
const DMatDMatSchurExpr& rhs )
858 schurAssign( *lhs, tmp );
878 template<
typename MT
880 friend inline auto schurAssign( DenseMatrix<MT,SO2>& lhs,
const DMatDMatSchurExpr& rhs )
889 schurAssign( *lhs, rhs.rhs_ );
890 schurAssign( *lhs, rhs.lhs_ );
893 schurAssign( *lhs, rhs.lhs_ );
894 schurAssign( *lhs, rhs.rhs_ );
927 template<
typename MT
964 template<
typename MT
1006 template<
typename MT
1025 const TmpType tmp( rhs );
1045 template<
typename MT
1084 template<
typename MT
1123 template<
typename MT
1158 template<
typename MT
1224template<
typename MT1
1260template<
typename MT1
1265inline decltype(
auto)
1280 return ReturnType( (*lhs).rows() );
1299template<
typename MT1
1306inline decltype(
auto)
1321 return ReturnType( (*lhs).rows(), (*lhs).columns() );
1352template<
typename MT1
1355inline decltype(
auto)
1360 if( (*lhs).rows() != (*rhs).rows() || (*lhs).columns() != (*rhs).columns() ) {
1364 return dmatdmatschur( *lhs, *rhs );
1379template<
typename MT1,
typename MT2,
bool SO >
1380struct IsAligned< DMatDMatSchurExpr<MT1,MT2,SO> >
1381 :
public BoolConstant< IsAligned_v<MT1> && IsAligned_v<MT2> >
1397template<
typename MT1,
typename MT2,
bool SO >
1399 :
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 HasSIMDMult type trait.
Macro for CUDA compatibility.
Constraint on the data type.
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 IsCommutative type trait.
Header file for the IsExpression type trait class.
Header file for the IsLower type trait.
Header file for the IsOperation type trait class.
Header file for the IsPadded type trait.
Header file for the IsStrictlyLower type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsTemporary type trait class.
Header file for the IsUniLower type trait.
Header file for the IsUniUpper type trait.
Header file for the IsUpper type trait.
Header file for the MAYBE_UNUSED function template.
Header file for all SIMD functionality.
Header file for the Schur product trait.
Constraint on the data type.
Iterator over the elements of the dense matrix.
Definition DMatDMatSchurExpr.h:196
BLAZE_DEVICE_CALLABLE bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition DMatDMatSchurExpr.h:371
BLAZE_DEVICE_CALLABLE bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition DMatDMatSchurExpr.h:360
BLAZE_DEVICE_CALLABLE DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition DMatDMatSchurExpr.h:393
ReferenceType reference
Reference return type.
Definition DMatDMatSchurExpr.h:209
ValueType value_type
Type of the underlying elements.
Definition DMatDMatSchurExpr.h:207
DifferenceType difference_type
Difference between two iterators.
Definition DMatDMatSchurExpr.h:210
ptrdiff_t DifferenceType
Difference between two iterators.
Definition DMatDMatSchurExpr.h:203
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition DMatDMatSchurExpr.h:262
ConstIterator_t< MT1 > LeftIteratorType
ConstIterator type of the left-hand side dense matrix expression.
Definition DMatDMatSchurExpr.h:213
BLAZE_DEVICE_CALLABLE ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition DMatDMatSchurExpr.h:225
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition DMatDMatSchurExpr.h:250
ElementType & ReferenceType
Reference return type.
Definition DMatDMatSchurExpr.h:202
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition DMatDMatSchurExpr.h:199
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition DMatDMatSchurExpr.h:306
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition DMatDMatSchurExpr.h:405
BLAZE_DEVICE_CALLABLE bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition DMatDMatSchurExpr.h:338
BLAZE_DEVICE_CALLABLE bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition DMatDMatSchurExpr.h:349
PointerType pointer
Pointer return type.
Definition DMatDMatSchurExpr.h:208
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition DMatDMatSchurExpr.h:417
BLAZE_DEVICE_CALLABLE bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition DMatDMatSchurExpr.h:382
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition DMatDMatSchurExpr.h:436
ElementType * PointerType
Pointer return type.
Definition DMatDMatSchurExpr.h:201
auto load() const noexcept
Access to the SIMD elements of the matrix.
Definition DMatDMatSchurExpr.h:316
ElementType ValueType
Type of the underlying elements.
Definition DMatDMatSchurExpr.h:200
ConstIterator_t< MT2 > RightIteratorType
ConstIterator type of the right-hand side dense matrix expression.
Definition DMatDMatSchurExpr.h:216
RightIteratorType right_
Iterator to the current right-hand side element.
Definition DMatDMatSchurExpr.h:437
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition DMatDMatSchurExpr.h:284
IteratorCategory iterator_category
The iterator category.
Definition DMatDMatSchurExpr.h:206
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition DMatDMatSchurExpr.h:237
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition DMatDMatSchurExpr.h:429
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition DMatDMatSchurExpr.h:274
BLAZE_DEVICE_CALLABLE bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition DMatDMatSchurExpr.h:327
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition DMatDMatSchurExpr.h:296
Expression object for dense matrix-dense matrix Schur products.
Definition DMatDMatSchurExpr.h:108
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition DMatDMatSchurExpr.h:453
CompositeType_t< MT2 > CT2
Composite type of the right-hand side dense matrix expression.
Definition DMatDMatSchurExpr.h:116
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition DMatDMatSchurExpr.h:128
ElementType_t< MT1 > ET1
Element type of the left-hand side dense matrix expression.
Definition DMatDMatSchurExpr.h:117
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition DMatDMatSchurExpr.h:448
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition DMatDMatSchurExpr.h:493
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition DMatDMatSchurExpr.h:444
DMatDMatSchurExpr< MT1, MT2, SO > This
Type of this DMatDMatSchurExpr instance.
Definition DMatDMatSchurExpr.h:169
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition DMatDMatSchurExpr.h:478
SchurExpr< DenseMatrix< This, SO > > BaseType
Base type of this DMatDMatSchurExpr instance.
Definition DMatDMatSchurExpr.h:172
LeftOperand lhs_
Left-hand side dense matrix of the Schur product expression.
Definition DMatDMatSchurExpr.h:630
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the Schur product expression.
Definition DMatDMatSchurExpr.h:142
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition DMatDMatSchurExpr.h:612
DMatDMatSchurExpr(const MT1 &lhs, const MT2 &rhs) noexcept
Constructor for the DMatDMatSchurExpr class.
Definition DMatDMatSchurExpr.h:462
ElementType_t< MT2 > ET2
Element type of the right-hand side dense matrix expression.
Definition DMatDMatSchurExpr.h:118
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition DMatDMatSchurExpr.h:622
ReturnType_t< MT1 > RN1
Return type of the left-hand side dense matrix expression.
Definition DMatDMatSchurExpr.h:113
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition DMatDMatSchurExpr.h:602
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition DMatDMatSchurExpr.h:175
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense matrix operand.
Definition DMatDMatSchurExpr.h:567
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition DMatDMatSchurExpr.h:547
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition DMatDMatSchurExpr.h:526
ElementType_t< ResultType > ElementType
Resulting element type.
Definition DMatDMatSchurExpr.h:177
BLAZE_ALWAYS_INLINE auto load(size_t i, size_t j) const noexcept
Access to the SIMD elements of the matrix.
Definition DMatDMatSchurExpr.h:511
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition DMatDMatSchurExpr.h:557
If_t< IsExpression_v< MT1 >, const MT1, const MT1 & > LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition DMatDMatSchurExpr.h:186
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition DMatDMatSchurExpr.h:180
RightOperand rightOperand() const noexcept
Returns the right-hand side dense matrix operand.
Definition DMatDMatSchurExpr.h:577
SchurTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition DMatDMatSchurExpr.h:174
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition DMatDMatSchurExpr.h:589
ResultType_t< MT2 > RT2
Result type of the right-hand side dense matrix expression.
Definition DMatDMatSchurExpr.h:112
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition DMatDMatSchurExpr.h:537
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition DMatDMatSchurExpr.h:176
CompositeType_t< MT1 > CT1
Composite type of the left-hand side dense matrix expression.
Definition DMatDMatSchurExpr.h:115
If_t< useAssign, const ResultType, const DMatDMatSchurExpr & > CompositeType
Data type for composite expression templates.
Definition DMatDMatSchurExpr.h:183
If_t< IsExpression_v< MT2 >, const MT2, const MT2 & > RightOperand
Composite type of the right-hand side dense matrix expression.
Definition DMatDMatSchurExpr.h:189
ResultType_t< MT1 > RT1
Result type of the left-hand side dense matrix expression.
Definition DMatDMatSchurExpr.h:111
decltype(std::declval< RN1 >() *std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition DMatDMatSchurExpr.h:131
ReturnType_t< MT2 > RN2
Return type of the right-hand side dense matrix expression.
Definition DMatDMatSchurExpr.h:114
RightOperand rhs_
Right-hand side dense matrix of the Schur product expression.
Definition DMatDMatSchurExpr.h:631
Base class for dense matrices.
Definition DenseMatrix.h:82
SIMD characteristics of data types.
Definition SIMDTrait.h:297
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 SchurExpr 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_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_IDENTITY_MATRIX_TYPE(T)
Constraint on the data type.
Definition Identity.h:60
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_SCHUREXPR(T1, T2)
Constraint on the data type.
Definition SchurExpr.h:103
#define BLAZE_CONSTRAINT_MUST_BE_ZERO_TYPE(T)
Constraint on the data type.
Definition Zero.h:61
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.
Definition StorageOrder.h:63
typename SchurTrait< T1, T2 >::Type SchurTrait_t
Auxiliary alias declaration for the SchurTrait class template.
Definition SchurTrait.h:137
constexpr bool RequiresEvaluation_v
Auxiliary variable template for the RequiresEvaluation type trait.
Definition RequiresEvaluation.h:91
constexpr bool IsStrictlyUpper_v
Auxiliary variable template for the IsStrictlyUpper type trait.
Definition IsStrictlyUpper.h:173
constexpr bool IsExpression_v
Auxiliary variable template for the IsExpression type trait.
Definition IsExpression.h:114
constexpr bool IsUniUpper_v
Auxiliary variable template for the IsUniUpper type trait.
Definition IsUniUpper.h:173
constexpr bool IsStrictlyLower_v
Auxiliary variable template for the IsStrictlyLower type trait.
Definition IsStrictlyLower.h:173
constexpr bool IsUpper_v
Auxiliary variable template for the IsUpper type trait.
Definition IsUpper.h:175
constexpr bool IsCommutative_v
Auxiliary variable template for the IsCommutative type trait.
Definition IsCommutative.h:117
constexpr bool IsOperation_v
Auxiliary variable template for the IsOperation type trait.
Definition IsOperation.h:89
constexpr bool HasSIMDMult_v
Auxiliary variable template for the HasSIMDMult type trait.
Definition HasSIMDMult.h:188
constexpr bool IsTemporary_v
Auxiliary variable template for the IsTemporary type trait.
Definition IsTemporary.h:88
constexpr bool IsLower_v
Auxiliary variable template for the IsLower type trait.
Definition IsLower.h:175
constexpr bool IsUniLower_v
Auxiliary variable template for the IsUniLower type trait.
Definition IsUniLower.h:173
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
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition MaybeUnused.h:81
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
typename EnableIf<!Condition, T >::Type DisableIf_t
Auxiliary type for the EnableIf class template.
Definition EnableIf.h:175
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 all forward declarations for sparse vectors and matrices.
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 Schur product expression templates.
Definition SchurExpr.h:68
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.