35#ifndef _BLAZE_MATH_EXPRESSIONS_TSMATSMATSCHUREXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_TSMATSMATSCHUREXPR_H_
99 :
public SchurExpr< SparseMatrix< TSMatSMatSchurExpr<MT1,MT2>, false > >
119 static constexpr bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );
132 template<
typename T1,
typename T2 >
133 static constexpr bool UseSymmetricKernel_v =
134 ( ( StorageOrder_v<T1> != StorageOrder_v<T2> ) && IsSymmetric_v<T2> );
207 if( i >=
lhs_.rows() ) {
210 if( j >=
lhs_.columns() ) {
222 inline size_t rows() const noexcept {
233 return lhs_.columns();
284 template<
typename T >
285 inline bool canAlias(
const T* alias )
const noexcept {
286 return (
lhs_.canAlias( alias ) ||
rhs_.canAlias( alias ) );
296 template<
typename T >
297 inline bool isAliased(
const T* alias )
const noexcept {
298 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
321 template<
typename MT >
343 assign( *lhs, A % B );
361 template<
typename MT >
385 assign( *lhs, A % B );
403 template<
typename MT >
404 friend inline auto assign( SparseMatrix<MT,false>& lhs,
const TSMatSMatSchurExpr& rhs )
405 -> DisableIf_t< UseSymmetricKernel_v<MT,MT1> >
413 const OppositeType_t<RT1> A(
serial( rhs.lhs_ ) );
425 assign( *lhs, A % B );
443 template<
typename MT >
444 friend inline auto assign( SparseMatrix<MT,true>& lhs,
const TSMatSMatSchurExpr& rhs )
445 -> DisableIf_t< UseSymmetricKernel_v<MT,MT2> >
458 const OppositeType_t<RT2> B(
serial( rhs.rhs_ ) );
467 assign( *lhs, A % B );
485 template<
typename MT >
487 -> EnableIf_t< UseSymmetricKernel_v<MT,MT1> >
494 assign( *lhs,
trans( rhs.lhs_ ) % rhs.rhs_ );
512 template<
typename MT >
514 -> EnableIf_t< UseSymmetricKernel_v<MT,MT2> >
523 assign( *lhs, rhs.lhs_ %
trans( rhs.rhs_ ) );
541 template<
typename MT >
542 friend inline auto addAssign( DenseMatrix<MT,false>& lhs,
const TSMatSMatSchurExpr& rhs )
543 -> DisableIf_t< UseSymmetricKernel_v<MT,MT1> >
551 const OppositeType_t<RT1> A(
serial( rhs.lhs_ ) );
563 addAssign( *lhs, A % B );
581 template<
typename MT >
582 friend inline auto addAssign( DenseMatrix<MT,true>& lhs,
const TSMatSMatSchurExpr& rhs )
583 -> DisableIf_t< UseSymmetricKernel_v<MT,MT2> >
596 const OppositeType_t<RT2> B(
serial( rhs.rhs_ ) );
605 addAssign( *lhs, A % B );
623 template<
typename MT >
625 -> EnableIf_t< UseSymmetricKernel_v<MT,MT1> >
632 addAssign( *lhs,
trans( rhs.lhs_ ) % rhs.rhs_ );
650 template<
typename MT >
652 -> EnableIf_t< UseSymmetricKernel_v<MT,MT2> >
661 addAssign( *lhs, rhs.lhs_ %
trans( rhs.rhs_ ) );
683 template<
typename MT >
684 friend inline auto subAssign( DenseMatrix<MT,false>& lhs,
const TSMatSMatSchurExpr& rhs )
685 -> DisableIf_t< UseSymmetricKernel_v<MT,MT1> >
693 const OppositeType_t<RT1> A(
serial( rhs.lhs_ ) );
705 subAssign( *lhs, A % B );
723 template<
typename MT >
724 friend inline auto subAssign( DenseMatrix<MT,true>& lhs,
const TSMatSMatSchurExpr& rhs )
725 -> DisableIf_t< UseSymmetricKernel_v<MT,MT2> >
738 const OppositeType_t<RT2> B(
serial( rhs.rhs_ ) );
747 subAssign( *lhs, A % B );
765 template<
typename MT >
767 -> EnableIf_t< UseSymmetricKernel_v<MT,MT1> >
774 subAssign( *lhs,
trans( rhs.lhs_ ) % rhs.rhs_ );
792 template<
typename MT >
794 -> EnableIf_t< UseSymmetricKernel_v<MT,MT2> >
803 subAssign( *lhs, rhs.lhs_ %
trans( rhs.rhs_ ) );
825 template<
typename MT >
826 friend inline auto schurAssign( DenseMatrix<MT,false>& lhs,
const TSMatSMatSchurExpr& rhs )
827 -> DisableIf_t< UseSymmetricKernel_v<MT,MT1> >
835 const OppositeType_t<RT1> A(
serial( rhs.lhs_ ) );
847 schurAssign( *lhs, A % B );
865 template<
typename MT >
866 friend inline auto schurAssign( DenseMatrix<MT,true>& lhs,
const TSMatSMatSchurExpr& rhs )
867 -> DisableIf_t< UseSymmetricKernel_v<MT,MT2> >
880 const OppositeType_t<RT2> B(
serial( rhs.rhs_ ) );
889 schurAssign( *lhs, A % B );
907 template<
typename MT >
908 friend inline auto schurAssign( Matrix<MT,false>& lhs,
const TSMatSMatSchurExpr& rhs )
909 -> EnableIf_t< UseSymmetricKernel_v<MT,MT1> >
916 schurAssign( *lhs,
trans( rhs.lhs_ ) % rhs.rhs_ );
934 template<
typename MT >
936 -> EnableIf_t< UseSymmetricKernel_v<MT,MT2> >
945 schurAssign( *lhs, rhs.lhs_ %
trans( rhs.rhs_ ) );
995 template<
typename MT
1058template<
typename MT1
1060 ,
DisableIf_t< ( IsUniLower_v<MT1> && IsUniUpper_v<MT2> ) ||
1061 ( IsUniUpper_v<MT1> && IsUniLower_v<MT2> ) ||
1062 ( IsStrictlyLower_v<MT1> && IsUpper_v<MT2> ) ||
1063 ( IsStrictlyUpper_v<MT1> && IsLower_v<MT2> ) ||
1064 ( IsLower_v<MT1> && IsStrictlyUpper_v<MT2> ) ||
1065 ( IsUpper_v<MT1> && IsStrictlyLower_v<MT2> ) ||
1066 ( IsZero_v<MT1> || IsZero_v<MT2> ) >* =
nullptr >
1067inline const TSMatSMatSchurExpr<MT1,MT2>
1068 tsmatsmatschur(
const SparseMatrix<MT1,true>& lhs,
const SparseMatrix<MT2,false>& rhs )
1075 return TSMatSMatSchurExpr<MT1,MT2>( *lhs, *rhs );
1095template<
typename MT1
1097 ,
EnableIf_t< ( IsUniLower_v<MT1> && IsUniUpper_v<MT2> ) ||
1098 ( IsUniUpper_v<MT1> && IsUniLower_v<MT2> ) >* =
nullptr >
1099inline decltype(
auto)
1100 tsmatsmatschur(
const SparseMatrix<MT1,true>& lhs,
const SparseMatrix<MT2,false>& rhs )
1109 using ReturnType =
const SchurTrait_t< ResultType_t<MT1>, ResultType_t<MT2> >;
1114 return ReturnType( (*lhs).rows() );
1134template<
typename MT1
1136 ,
EnableIf_t< ( IsStrictlyLower_v<MT1> && IsUpper_v<MT2> ) ||
1137 ( IsStrictlyUpper_v<MT1> && IsLower_v<MT2> ) ||
1138 ( IsLower_v<MT1> && IsStrictlyUpper_v<MT2> ) ||
1139 ( IsUpper_v<MT1> && IsStrictlyLower_v<MT2> ) ||
1140 ( IsZero_v<MT1> || IsZero_v<MT2> ) >* =
nullptr >
1141inline decltype(
auto)
1142 tsmatsmatschur(
const SparseMatrix<MT1,true>& lhs,
const SparseMatrix<MT2,false>& rhs )
1151 using ReturnType =
const SchurTrait_t< ResultType_t<MT1>, ResultType_t<MT2> >;
1156 return ReturnType( (*lhs).rows(), (*lhs).columns() );
1191template<
typename MT1
1193inline decltype(
auto)
1198 if( (*lhs).rows() != (*rhs).rows() || (*lhs).columns() != (*rhs).columns() ) {
1202 return tsmatsmatschur( *lhs, *rhs );
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::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition: Aliases.h:550
Header file for run time assertion macros.
Constraints on the storage order of matrix types.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Constraint on the data type.
Header file for the If class template.
Header file for the IntegralConstant class template.
Header file for the IsExpression type trait class.
Header file for the IsLower type trait.
Header file for the IsStrictlyLower type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric 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.
Constraints on the storage order of matrix types.
Header file for the Schur product trait.
Constraint on the data type.
Constraint on the data type.
Base class for dense matrices.
Definition: DenseMatrix.h:82
Base class for sparse matrices.
Definition: SparseMatrix.h:77
Expression object for transpose sparse matrix-sparse matrix Schur products.
Definition: TSMatSMatSchurExpr.h:101
ReturnType_t< MT1 > RN1
Return type of the left-hand side sparse matrix expression.
Definition: TSMatSMatSchurExpr.h:106
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TSMatSMatSchurExpr.h:285
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSMatSMatSchurExpr.h:155
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: TSMatSMatSchurExpr.h:232
LeftOperand lhs_
Left-hand side sparse matrix of the Schur product expression.
Definition: TSMatSMatSchurExpr.h:304
LeftOperand leftOperand() const noexcept
Returns the left-hand side transpose sparse matrix operand.
Definition: TSMatSMatSchurExpr.h:263
RightOperand rhs_
Right-hand side sparse matrix of the Schur product expression.
Definition: TSMatSMatSchurExpr.h:305
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: TSMatSMatSchurExpr.h:253
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: TSMatSMatSchurExpr.h:119
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: TSMatSMatSchurExpr.h:222
CompositeType_t< MT2 > CT2
Composite type of the right-hand side sparse matrix expression.
Definition: TSMatSMatSchurExpr.h:109
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: TSMatSMatSchurExpr.h:147
decltype(std::declval< RN1 >() *std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: TSMatSMatSchurExpr.h:122
CompositeType_t< MT1 > CT1
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatSMatSchurExpr.h:108
ReturnType_t< MT2 > RN2
Return type of the right-hand side sparse matrix expression.
Definition: TSMatSMatSchurExpr.h:107
ResultType_t< MT2 > RT2
Result type of the right-hand side sparse matrix expression.
Definition: TSMatSMatSchurExpr.h:105
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TSMatSMatSchurExpr.h:297
If_t< IsExpression_v< MT1 >, const MT1, const MT1 & > LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatSMatSchurExpr.h:158
If_t< IsExpression_v< MT2 >, const MT2, const MT2 & > RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: TSMatSMatSchurExpr.h:161
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: TSMatSMatSchurExpr.h:206
TSMatSMatSchurExpr(const MT1 &lhs, const MT2 &rhs) noexcept
Constructor for the TSMatSMatSchurExpr class.
Definition: TSMatSMatSchurExpr.h:175
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: TSMatSMatSchurExpr.h:191
SchurTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: TSMatSMatSchurExpr.h:146
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: TSMatSMatSchurExpr.h:242
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: TSMatSMatSchurExpr.h:152
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TSMatSMatSchurExpr.h:148
RightOperand rightOperand() const noexcept
Returns the right-hand side sparse matrix operand.
Definition: TSMatSMatSchurExpr.h:273
ResultType_t< MT1 > RT1
Result type of the left-hand side sparse matrix expression.
Definition: TSMatSMatSchurExpr.h:104
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: TSMatSMatSchurExpr.h:149
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: TSMatSMatSchurExpr.h:166
Constraint on the data type.
Constraint on the data type.
Header file for the Computation base class.
Header file for the SchurExpr base class.
Header file for the SparseMatrix base class.
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:1339
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766
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_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: RowMajorMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ZERO_TYPE(T)
Constraint on the data type.
Definition: Zero.h:81
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: SparseMatrix.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_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: ColumnMajorMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_BE_ZERO_TYPE(T)
Constraint on the data type.
Definition: Zero.h:61
typename SchurTrait< T1, T2 >::Type SchurTrait_t
Auxiliary alias declaration for the SchurTrait class template.
Definition: SchurTrait.h:137
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
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
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
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_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
typename EnableIf<!Condition, T >::Type DisableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:175
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition: FunctionTrace.h:94
Header file for the exception macros of the math module.
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 StorageOrder type trait.
Header file for the serial shim.
Base class for all compute expression templates.
Definition: Computation.h:68
Base class for all Schur product expression templates.
Definition: SchurExpr.h:68
Header file for the IsZero type trait.
Header file for basic type definitions.
Header file for the generic min algorithm.