35#ifndef _BLAZE_MATH_EXPRESSIONS_SMATTSMATMULTEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_SMATTSMATMULTEXPR_H_
96 :
public MatMatMultExpr< SparseMatrix< SMatTSMatMultExpr<MT1,MT2>, IsIdentity_v<MT1> > >
116 template<
typename T1,
typename T2,
typename T3 >
117 static constexpr bool CanExploitSymmetry_v =
188 if( i >=
lhs_.rows() ) {
191 if( j >=
rhs_.columns() ) {
203 inline size_t rows() const noexcept {
214 return rhs_.columns();
234 inline size_t nonZeros(
size_t i )
const noexcept {
266 template<
typename T >
267 inline bool canAlias(
const T* alias )
const noexcept {
268 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
278 template<
typename T >
279 inline bool isAliased(
const T* alias )
const noexcept {
280 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
290 return (
rows() *
columns() >= SMP_SMATTSMATMULT_THRESHOLD );
313 template<
typename MT >
325 assign( *lhs, rhs.lhs_ * tmp );
345 template<
typename MT >
354 assign( *lhs, rhs.lhs_ *
trans( rhs.rhs_ ) );
372 template<
typename MT >
385 const OppositeType_t<MT1> tmp(
serial( rhs.lhs_ ) );
386 assign( *lhs, tmp * rhs.rhs_ );
406 template<
typename MT >
417 assign( *lhs,
trans( rhs.lhs_ ) * rhs.rhs_ );
435 template<
typename MT >
436 friend inline auto addAssign( DenseMatrix<MT,false>& lhs,
const SMatTSMatMultExpr& rhs )
446 const OppositeType_t<MT2> tmp(
serial( rhs.rhs_ ) );
447 addAssign( *lhs, rhs.lhs_ * tmp );
467 template<
typename MT >
468 friend inline auto addAssign( Matrix<MT,false>& lhs,
const SMatTSMatMultExpr& rhs )
476 addAssign( *lhs, rhs.lhs_ *
trans( rhs.rhs_ ) );
494 template<
typename MT >
495 friend inline auto addAssign( DenseMatrix<MT,true>& lhs,
const SMatTSMatMultExpr& rhs )
507 const OppositeType_t<MT1> tmp(
serial( rhs.lhs_ ) );
508 addAssign( *lhs, tmp * rhs.rhs_ );
528 template<
typename MT >
529 friend inline auto addAssign( Matrix<MT,true>& lhs,
const SMatTSMatMultExpr& rhs )
539 addAssign( *lhs,
trans( rhs.lhs_ ) * rhs.rhs_ );
561 template<
typename MT >
562 friend inline auto subAssign( DenseMatrix<MT,false>& lhs,
const SMatTSMatMultExpr& rhs )
572 const OppositeType_t<MT2> tmp(
serial( rhs.rhs_ ) );
573 subAssign( *lhs, rhs.lhs_ * tmp );
593 template<
typename MT >
594 friend inline auto subAssign( Matrix<MT,false>& lhs,
const SMatTSMatMultExpr& rhs )
602 subAssign( *lhs, rhs.lhs_ *
trans( rhs.rhs_ ) );
620 template<
typename MT >
621 friend inline auto subAssign( DenseMatrix<MT,true>& lhs,
const SMatTSMatMultExpr& rhs )
633 const OppositeType_t<MT1> tmp(
serial( rhs.lhs_ ) );
634 subAssign( *lhs, tmp * rhs.rhs_ );
654 template<
typename MT >
655 friend inline auto subAssign( Matrix<MT,true>& lhs,
const SMatTSMatMultExpr& rhs )
665 subAssign( *lhs,
trans( rhs.lhs_ ) * rhs.rhs_ );
687 template<
typename MT
689 friend inline void schurAssign( DenseMatrix<MT,SO>& lhs,
const SMatTSMatMultExpr& rhs )
700 schurAssign( *lhs, tmp );
732 template<
typename MT >
743 const OppositeType_t<MT2> tmp( rhs.rhs_ );
764 template<
typename MT >
793 template<
typename MT >
806 const OppositeType_t<MT1> tmp( rhs.lhs_ );
827 template<
typename MT >
858 template<
typename MT >
869 const OppositeType_t<MT2> tmp( rhs.rhs_ );
890 template<
typename MT >
903 const OppositeType_t<MT1> tmp( rhs.lhs_ );
924 template<
typename MT >
953 template<
typename MT >
988 template<
typename MT >
999 const OppositeType_t<MT2> tmp( rhs.rhs_ );
1020 template<
typename MT >
1033 const OppositeType_t<MT1> tmp( rhs.lhs_ );
1054 template<
typename MT >
1083 template<
typename MT >
1116 template<
typename MT
1182template<
typename MT1
1215template<
typename MT1
1248template<
typename MT1
1280template<
typename MT1
1283inline decltype(
auto)
1297 return ReturnType( (*lhs).rows() );
1317template<
typename MT1
1320inline decltype(
auto)
1332 return ReturnType( (*lhs).rows(), (*rhs).columns() );
1368template<
typename MT1
1370inline decltype(
auto)
1375 if( (*lhs).columns() != (*rhs).rows() ) {
1379 return smattsmatmult( *lhs, *rhs );
Header file for auxiliary alias declarations.
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.
Definition Aliases.h:310
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 blaze::checked and blaze::unchecked instances.
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 IsColumnMajorMatrix type trait.
Header file for the IsExpression type trait class.
Header file for the IsIdentity type trait.
Header file for the IsRowMajorMatrix type trait.
Header file for the IsSymmetric type trait.
Header file for the MAYBE_UNUSED function template.
Header file for the multiplication trait.
Constraints on the storage order of matrix types.
Constraint on the data type.
Constraint on the data type.
Base class for matrices.
Definition Matrix.h:85
Expression object for sparse matrix-transpose sparse matrix multiplications.
Definition SMatTSMatMultExpr.h:98
ResultType_t< MT1 > RT1
Result type of the left-hand side sparse matrix expression.
Definition SMatTSMatMultExpr.h:101
RightOperand rightOperand() const noexcept
Returns the right-hand side transpose sparse matrix operand.
Definition SMatTSMatMultExpr.h:255
ElementType_t< ResultType > ElementType
Resulting element type.
Definition SMatTSMatMultExpr.h:134
If_t< IsExpression_v< MT2 >, const MT2, const MT2 & > RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition SMatTSMatMultExpr.h:142
constexpr size_t nonZeros() const noexcept
Returns the number of non-zero elements in the sparse matrix.
Definition SMatTSMatMultExpr.h:223
CompositeType_t< MT2 > CT2
Composite type of the right-hand side sparse matrix expression.
Definition SMatTSMatMultExpr.h:104
size_t nonZeros(size_t i) const noexcept
Returns the number of non-zero elements in the specified row.
Definition SMatTSMatMultExpr.h:234
CompositeType_t< MT1 > CT1
Composite type of the left-hand side sparse matrix expression.
Definition SMatTSMatMultExpr.h:103
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition SMatTSMatMultExpr.h:171
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition SMatTSMatMultExpr.h:132
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition SMatTSMatMultExpr.h:279
RightOperand rhs_
Right-hand side sparse matrix of the multiplication expression.
Definition SMatTSMatMultExpr.h:297
MatMatMultExpr< SparseMatrix< This, IsIdentity_v< MT1 > > > BaseType
Base type of this SMatTSMatMultExpr instance.
Definition SMatTSMatMultExpr.h:129
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition SMatTSMatMultExpr.h:187
SMatTSMatMultExpr(const MT1 &lhs, const MT2 &rhs) noexcept
Constructor for the SMatTSMatMultExpr class.
Definition SMatTSMatMultExpr.h:156
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition SMatTSMatMultExpr.h:213
SMatTSMatMultExpr< MT1, MT2 > This
Type of this SMatTSMatMultExpr instance.
Definition SMatTSMatMultExpr.h:126
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition SMatTSMatMultExpr.h:133
If_t< IsExpression_v< MT1 >, const MT1, const MT1 & > LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition SMatTSMatMultExpr.h:139
MultTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition SMatTSMatMultExpr.h:131
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition SMatTSMatMultExpr.h:203
LeftOperand lhs_
Left-hand side sparse matrix of the multiplication expression.
Definition SMatTSMatMultExpr.h:296
const ElementType ReturnType
Return type for expression template evaluations.
Definition SMatTSMatMultExpr.h:135
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition SMatTSMatMultExpr.h:289
ResultType_t< MT2 > RT2
Result type of the right-hand side sparse matrix expression.
Definition SMatTSMatMultExpr.h:102
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition SMatTSMatMultExpr.h:147
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition SMatTSMatMultExpr.h:267
const ResultType CompositeType
Data type for composite expression templates.
Definition SMatTSMatMultExpr.h:136
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse matrix operand.
Definition SMatTSMatMultExpr.h:245
Base class for sparse matrices.
Definition SparseMatrix.h:77
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 MatMatMultExpr base class.
Header file for the SparseMatrix base class.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition Column.h:137
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_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_MATMATMULTEXPR(T1, T2)
Constraint on the data type.
Definition MatMatMultExpr.h:103
#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_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
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.
Definition StorageOrder.h:63
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.
Definition MultTrait.h:165
constexpr bool IsSymmetric_v
Auxiliary variable template for the IsSymmetric type trait.
Definition IsSymmetric.h:172
constexpr bool IsRowMajorMatrix_v
Auxiliary variable template for the IsRowMajorMatrix type trait.
Definition IsRowMajorMatrix.h:129
constexpr bool IsZero_v
Auxiliary variable template for the IsZero type trait.
Definition IsZero.h:166
constexpr bool IsColumnMajorMatrix_v
Auxiliary variable template for the IsColumnMajorMatrix type trait.
Definition IsColumnMajorMatrix.h:129
constexpr bool IsIdentity_v
Auxiliary variable template for the IsIdentity type trait.
Definition IsIdentity.h:137
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition Row.h:137
#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
constexpr bool IsSame_v
Auxiliary variable template for the IsSame type trait.
Definition IsSame.h:159
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
constexpr Unchecked unchecked
Global Unchecked instance.
Definition Check.h:146
Header file for the exception macros of the math module.
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
Base class for all matrix/matrix multiplication expression templates.
Definition MatMatMultExpr.h:71
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
Header file for the IsZero type trait.
Header file for the RequiresEvaluation type trait.
Header file for basic type definitions.
Header file for the generic min algorithm.