35 #ifndef _BLAZE_MATH_EXPRESSIONS_TSMATSMATSCHUREXPR_H_ 36 #define _BLAZE_MATH_EXPRESSIONS_TSMATSMATSCHUREXPR_H_ 99 template<
typename MT1
101 class TSMatSMatSchurExpr
102 :
public SchurExpr< SparseMatrix< TSMatSMatSchurExpr<MT1,MT2>, false > >
103 ,
private Computation
122 static constexpr
bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );
135 template<
typename T1,
typename T2 >
136 static constexpr
bool UseSymmetricKernel_v =
137 ( IsVoid_v< EnableIf_t< StorageOrder_v<T1> != StorageOrder_v<T2> > > && IsSymmetric_v<T2> );
206 if( i >=
lhs_.rows() ) {
209 if( j >=
lhs_.columns() ) {
221 inline size_t rows() const noexcept {
232 return lhs_.columns();
283 template<
typename T >
284 inline bool canAlias(
const T* alias )
const noexcept {
285 return (
lhs_.canAlias( alias ) ||
rhs_.canAlias( alias ) );
295 template<
typename T >
296 inline bool isAliased(
const T* alias )
const noexcept {
297 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
320 template<
typename MT >
342 assign( ~lhs, A % B );
360 template<
typename MT >
384 assign( ~lhs, A % B );
402 template<
typename MT >
403 friend inline auto assign( SparseMatrix<MT,false>& lhs,
const TSMatSMatSchurExpr& rhs )
404 -> DisableIf_t< UseSymmetricKernel_v<MT,MT1> >
412 const OppositeType_t<RT1> A(
serial( rhs.lhs_ ) );
424 assign( ~lhs, A % B );
442 template<
typename MT >
443 friend inline auto assign( SparseMatrix<MT,true>& lhs,
const TSMatSMatSchurExpr& rhs )
444 -> DisableIf_t< UseSymmetricKernel_v<MT,MT2> >
457 const OppositeType_t<RT2> B(
serial( rhs.rhs_ ) );
466 assign( ~lhs, A % B );
484 template<
typename MT >
486 -> EnableIf_t< UseSymmetricKernel_v<MT,MT1> >
493 assign( ~lhs,
trans( rhs.lhs_ ) % rhs.rhs_ );
511 template<
typename MT >
513 -> EnableIf_t< UseSymmetricKernel_v<MT,MT2> >
522 assign( ~lhs, rhs.lhs_ %
trans( rhs.rhs_ ) );
540 template<
typename MT >
541 friend inline auto addAssign( DenseMatrix<MT,false>& lhs,
const TSMatSMatSchurExpr& rhs )
542 -> DisableIf_t< UseSymmetricKernel_v<MT,MT1> >
550 const OppositeType_t<RT1> A(
serial( rhs.lhs_ ) );
562 addAssign( ~lhs, A % B );
580 template<
typename MT >
581 friend inline auto addAssign( DenseMatrix<MT,true>& lhs,
const TSMatSMatSchurExpr& rhs )
582 -> DisableIf_t< UseSymmetricKernel_v<MT,MT2> >
595 const OppositeType_t<RT2> B(
serial( rhs.rhs_ ) );
604 addAssign( ~lhs, A % B );
622 template<
typename MT >
624 -> EnableIf_t< UseSymmetricKernel_v<MT,MT1> >
631 addAssign( ~lhs,
trans( rhs.lhs_ ) % rhs.rhs_ );
649 template<
typename MT >
651 -> EnableIf_t< UseSymmetricKernel_v<MT,MT2> >
660 addAssign( ~lhs, rhs.lhs_ %
trans( rhs.rhs_ ) );
682 template<
typename MT >
683 friend inline auto subAssign( DenseMatrix<MT,false>& lhs,
const TSMatSMatSchurExpr& rhs )
684 -> DisableIf_t< UseSymmetricKernel_v<MT,MT1> >
692 const OppositeType_t<RT1> A(
serial( rhs.lhs_ ) );
704 subAssign( ~lhs, A % B );
722 template<
typename MT >
723 friend inline auto subAssign( DenseMatrix<MT,true>& lhs,
const TSMatSMatSchurExpr& rhs )
724 -> DisableIf_t< UseSymmetricKernel_v<MT,MT2> >
737 const OppositeType_t<RT2> B(
serial( rhs.rhs_ ) );
746 subAssign( ~lhs, A % B );
764 template<
typename MT >
766 -> EnableIf_t< UseSymmetricKernel_v<MT,MT1> >
773 subAssign( ~lhs,
trans( rhs.lhs_ ) % rhs.rhs_ );
791 template<
typename MT >
793 -> EnableIf_t< UseSymmetricKernel_v<MT,MT2> >
802 subAssign( ~lhs, rhs.lhs_ %
trans( rhs.rhs_ ) );
824 template<
typename MT >
825 friend inline auto schurAssign( DenseMatrix<MT,false>& lhs,
const TSMatSMatSchurExpr& rhs )
826 -> DisableIf_t< UseSymmetricKernel_v<MT,MT1> >
834 const OppositeType_t<RT1> A(
serial( rhs.lhs_ ) );
846 schurAssign( ~lhs, A % B );
864 template<
typename MT >
865 friend inline auto schurAssign( DenseMatrix<MT,true>& lhs,
const TSMatSMatSchurExpr& rhs )
866 -> DisableIf_t< UseSymmetricKernel_v<MT,MT2> >
879 const OppositeType_t<RT2> B(
serial( rhs.rhs_ ) );
888 schurAssign( ~lhs, A % B );
906 template<
typename MT >
907 friend inline auto schurAssign( Matrix<MT,false>& lhs,
const TSMatSMatSchurExpr& rhs )
908 -> EnableIf_t< UseSymmetricKernel_v<MT,MT1> >
915 schurAssign( ~lhs,
trans( rhs.lhs_ ) % rhs.rhs_ );
933 template<
typename MT >
935 -> EnableIf_t< UseSymmetricKernel_v<MT,MT2> >
944 schurAssign( ~lhs, rhs.lhs_ %
trans( rhs.rhs_ ) );
994 template<
typename MT
1057 template<
typename MT1
1059 , DisableIf_t< ( IsUniLower_v<MT1> && IsUniUpper_v<MT2> ) ||
1060 ( IsUniUpper_v<MT1> && IsUniLower_v<MT2> ) ||
1061 ( IsStrictlyLower_v<MT1> && IsUpper_v<MT2> ) ||
1062 ( IsStrictlyUpper_v<MT1> && IsLower_v<MT2> ) ||
1063 ( IsLower_v<MT1> && IsStrictlyUpper_v<MT2> ) ||
1064 ( IsUpper_v<MT1> && IsStrictlyLower_v<MT2> ) ||
1065 ( IsZero_v<MT1> || IsZero_v<MT2> ) >* =
nullptr >
1066 inline const TSMatSMatSchurExpr<MT1,MT2>
1067 tsmatsmatschur(
const SparseMatrix<MT1,true>& lhs,
const SparseMatrix<MT2,false>& rhs )
1074 return TSMatSMatSchurExpr<MT1,MT2>( ~lhs, ~rhs );
1094 template<
typename MT1
1096 , EnableIf_t< ( IsUniLower_v<MT1> && IsUniUpper_v<MT2> ) ||
1097 ( IsUniUpper_v<MT1> && IsUniLower_v<MT2> ) >* =
nullptr >
1098 inline decltype(
auto)
1099 tsmatsmatschur( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,false>& rhs )
1108 using ReturnType =
const SchurTrait_t< ResultType_t<MT1>, ResultType_t<MT2> >;
1133 template<
typename MT1
1135 , EnableIf_t< ( IsStrictlyLower_v<MT1> && IsUpper_v<MT2> ) ||
1136 ( IsStrictlyUpper_v<MT1> && IsLower_v<MT2> ) ||
1137 ( IsLower_v<MT1> && IsStrictlyUpper_v<MT2> ) ||
1138 ( IsUpper_v<MT1> && IsStrictlyLower_v<MT2> ) ||
1139 ( IsZero_v<MT1> || IsZero_v<MT2> ) >* =
nullptr >
1140 inline decltype(
auto)
1141 tsmatsmatschur(
const SparseMatrix<MT1,true>& lhs,
const SparseMatrix<MT2,false>& rhs )
1150 using ReturnType =
const SchurTrait_t< ResultType_t<MT1>, ResultType_t<MT2> >;
1190 template<
typename MT1
1192 inline decltype(
auto)
1201 return tsmatsmatschur( ~lhs, ~rhs );
Constraint on the data type.
#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 auxiliary alias declarations.
Headerfile for the generic min algorithm.
#define BLAZE_CONSTRAINT_MUST_BE_IDENTITY_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not an identity matrix type...
Definition: Identity.h:60
Header file for the Schur product trait.
Header file for the UNUSED_PARAMETER function template.
Header file for the IsUniUpper type trait.
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: TSMatSMatSchurExpr.h:165
Header file for basic type definitions.
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
ResultType_t< MT1 > RT1
Result type of the left-hand side sparse matrix expression.
Definition: TSMatSMatSchurExpr.h:107
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
Header file for the serial shim.
Constraint on the data type.
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: TSMatSMatSchurExpr.h:231
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: TSMatSMatSchurExpr.h:146
Header file for the Computation base class.
Constraints on the storage order of matrix types.
ReturnType_t< MT2 > RN2
Return type of the right-hand side sparse matrix expression.
Definition: TSMatSMatSchurExpr.h:110
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: TSMatSMatSchurExpr.h:221
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
LeftOperand lhs_
Left-hand side sparse matrix of the Schur product expression.
Definition: TSMatSMatSchurExpr.h:303
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
Header file for the IsUniLower type trait.
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: TSMatSMatSchurExpr.h:252
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_SCHUREXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid matrix/matrix ...
Definition: SchurExpr.h:103
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
RightOperand rhs_
Right-hand side sparse matrix of the Schur product expression.
Definition: TSMatSMatSchurExpr.h:304
RightOperand rightOperand() const noexcept
Returns the right-hand side sparse matrix operand.
Definition: TSMatSMatSchurExpr.h:272
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
Header file for all forward declarations for sparse vectors and matrices.
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: TSMatSMatSchurExpr.h:148
Header file for the IsVoid type trait.
Header file for the SparseMatrix base class.
Constraint on the data type.
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TSMatSMatSchurExpr.h:147
Header file for the DisableIf class template.
Header file for the IsTemporary type trait class.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
CompositeType_t< MT1 > CT1
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatSMatSchurExpr.h:111
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: ColumnMajorMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_BE_ZERO_TYPE(T)
Constraint on the data type.In case the given data type T is not a zero vector or matrix type...
Definition: Zero.h:61
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
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: TSMatSMatSchurExpr.h:190
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TSMatSMatSchurExpr.h:296
Header file for the IsLower type trait.
If_t< IsExpression_v< MT1 >, const MT1, const MT1 &> LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatSMatSchurExpr.h:157
Header file for the exception macros of the math module.
ResultType_t< MT2 > RT2
Result type of the right-hand side sparse matrix expression.
Definition: TSMatSMatSchurExpr.h:108
Header file for all forward declarations for expression class templates.
If_t< IsExpression_v< MT2 >, const MT2, const MT2 &> RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: TSMatSMatSchurExpr.h:160
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.The OppositeType_t alias declaration provi...
Definition: Aliases.h:270
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: TSMatSMatSchurExpr.h:241
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: RowMajorMatrix.h:61
TSMatSMatSchurExpr(const MT1 &lhs, const MT2 &rhs) noexcept
Constructor for the TSMatSMatSchurExpr class.
Definition: TSMatSMatSchurExpr.h:174
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.
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSMatSMatSchurExpr.h:154
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
SchurTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: TSMatSMatSchurExpr.h:145
LeftOperand leftOperand() const noexcept
Returns the left-hand side transpose sparse matrix operand.
Definition: TSMatSMatSchurExpr.h:262
Header file for the SchurExpr base class.
typename SchurTrait< T1, T2 >::Type SchurTrait_t
Auxiliary alias declaration for the SchurTrait class template.The SchurTrait_t alias declaration prov...
Definition: SchurTrait.h:164
Header file for the IsZero type trait.
#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
Constraint on the data type.
Constraints on the storage order of matrix types.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
ReturnType_t< MT1 > RN1
Return type of the left-hand side sparse matrix expression.
Definition: TSMatSMatSchurExpr.h:109
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
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: TSMatSMatSchurExpr.h:122
decltype(std::declval< RN1 >() *std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: TSMatSMatSchurExpr.h:125
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
CompositeType_t< MT2 > CT2
Composite type of the right-hand side sparse matrix expression.
Definition: TSMatSMatSchurExpr.h:112
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: TSMatSMatSchurExpr.h:205
Header file for the IsComputation type trait class.
Header file for the StorageOrder type trait.
Header file for the IntegralConstant class template.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TSMatSMatSchurExpr.h:284
Header file for the IsUpper type trait.
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ZERO_TYPE(T)
Constraint on the data type.In case the given data type T is a zero vector or matrix type...
Definition: Zero.h:81
#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
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:61
Expression object for transpose sparse matrix-sparse matrix Schur products.The TSMatSMatSchurExpr cla...
Definition: Forward.h:174
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: TSMatSMatSchurExpr.h:151
Header file for the IsExpression type trait class.
Header file for the function trace functionality.
Constraint on the data type.