35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATDVECMULTEXPR_H_ 36 #define _BLAZE_MATH_EXPRESSIONS_SMATDVECMULTEXPR_H_ 94 class SMatDVecMultExpr
95 :
public MatVecMultExpr< DenseVector< SMatDVecMultExpr<MT,VT>, false > >
113 static constexpr
bool evaluateVector = ( IsComputation_v<VT> || RequiresEvaluation_v<VT> );
129 template<
typename VT2 >
131 static constexpr
bool UseAssign_v =
useAssign;
141 template<
typename T1 >
142 static constexpr
bool UseSMPAssign_v =
useAssign;
214 if( index >=
mat_.rows() ) {
217 return (*
this)[index];
226 inline size_t size() const noexcept {
257 template<
typename T >
258 inline bool canAlias(
const T* alias )
const noexcept {
259 return (
mat_.isAliased( alias ) ||
vec_.isAliased( alias ) );
269 template<
typename T >
270 inline bool isAliased(
const T* alias )
const noexcept {
271 return (
mat_.isAliased( alias ) ||
vec_.isAliased( alias ) );
281 return vec_.isAligned();
291 return (
size() > SMP_SMATDVECMULT_THRESHOLD );
317 template<
typename VT1 >
325 if( rhs.mat_.columns() == 0UL ) {
338 assign( ~lhs, A * x );
359 template<
typename VT1 >
393 template<
typename VT1 >
394 friend inline auto addAssign( DenseVector<VT1,false>& lhs,
const SMatDVecMultExpr& rhs )
395 -> EnableIf_t< UseAssign_v<VT1> >
401 if( rhs.mat_.columns() == 0UL ) {
413 addAssign( ~lhs, A * x );
438 template<
typename VT1 >
439 friend inline auto subAssign( DenseVector<VT1,false>& lhs,
const SMatDVecMultExpr& rhs )
440 -> EnableIf_t< UseAssign_v<VT1> >
446 if( rhs.mat_.columns() == 0UL ) {
458 subAssign( ~lhs, A * x );
483 template<
typename VT1 >
484 friend inline auto multAssign( DenseVector<VT1,false>& lhs,
const SMatDVecMultExpr& rhs )
485 -> EnableIf_t< UseAssign_v<VT1> >
496 multAssign( ~lhs, tmp );
521 template<
typename VT1 >
522 friend inline auto divAssign( DenseVector<VT1,false>& lhs,
const SMatDVecMultExpr& rhs )
523 -> EnableIf_t< UseAssign_v<VT1> >
534 divAssign( ~lhs, tmp );
558 template<
typename VT1 >
560 -> EnableIf_t< UseSMPAssign_v<VT1> >
566 if( rhs.mat_.columns() == 0UL ) {
599 template<
typename VT1 >
601 -> EnableIf_t< UseSMPAssign_v<VT1> >
632 template<
typename VT1 >
634 -> EnableIf_t< UseSMPAssign_v<VT1> >
640 if( rhs.mat_.columns() == 0UL ) {
676 template<
typename VT1 >
678 -> EnableIf_t< UseSMPAssign_v<VT1> >
684 if( rhs.mat_.columns() == 0UL ) {
720 template<
typename VT1 >
722 -> EnableIf_t< UseSMPAssign_v<VT1> >
757 template<
typename VT1 >
759 -> EnableIf_t< UseSMPAssign_v<VT1> >
814 template<
typename MT
817 IsSame_v< ElementType_t<MT>, ElementType_t<VT> > ) ||
818 IsZero_v<MT> >* =
nullptr >
819 inline const SMatDVecMultExpr<MT,VT>
820 smatdvecmult(
const SparseMatrix<MT,false>& mat,
const DenseVector<VT,false>& vec )
826 return SMatDVecMultExpr<MT,VT>( ~mat, ~vec );
846 template<
typename MT
848 , EnableIf_t< IsIdentity_v<MT> &&
849 IsSame_v< ElementType_t<MT>, ElementType_t<VT> > >* =
nullptr >
851 smatdvecmult(
const SparseMatrix<MT,false>& mat,
const DenseVector<VT,false>& vec )
878 template<
typename MT
880 , EnableIf_t< IsZero_v<MT> >* =
nullptr >
881 inline decltype(
auto)
882 smatdvecmult( const SparseMatrix<MT,false>& mat, const DenseVector<VT,false>& vec )
890 using ReturnType =
const MultTrait_t< ResultType_t<MT>, ResultType_t<VT> >;
895 return ReturnType( (~mat).
rows() );
932 template<
typename MT
934 inline decltype(
auto)
945 return smatdvecmult( ~mat, ~vec );
960 template<
typename MT,
typename VT >
961 struct IsAligned< SMatDVecMultExpr<MT,VT> >
962 :
public IsAligned<VT>
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatDVecMultExpr.h:151
#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.
Header file for the blaze::checked and blaze::unchecked instances.
Header file for basic type definitions.
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias template for the If class template.The If_t alias template provides a convenient shor...
Definition: If.h:109
MultTrait_t< MRT, VRT > ResultType
Result type for expression template evaluations.
Definition: SMatDVecMultExpr.h:150
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: SMatDVecMultExpr.h:173
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a column dense or sparse vector type...
Definition: ColumnVector.h:61
Header file for the serial shim.
Expression object for sparse matrix-dense vector multiplications.The SMatDVecMultExpr class represent...
Definition: Forward.h:124
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SMatDVecMultExpr.h:213
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
Constraint on the data type.
Header file for the DenseVector base class.
Header file for the MAYBE_UNUSED function template.
Header file for the IsIdentity type trait.
ResultType_t< MT > MRT
Result type of the left-hand side sparse matrix expression.
Definition: SMatDVecMultExpr.h:100
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatDVecMultExpr.h:258
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SMatDVecMultExpr.h:226
Header file for the Computation base class.
Header file for the reset shim.
SMatDVecMultExpr(const MT &mat, const VT &vec) noexcept
Constructor for the SMatDVecMultExpr class.
Definition: SMatDVecMultExpr.h:186
Constraints on the storage order of matrix types.
Header file for the RequiresEvaluation type trait.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
const ElementType ReturnType
Return type for expression template evaluations.
Definition: SMatDVecMultExpr.h:153
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes....
Definition: Forward.h:145
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
auto smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:220
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SMatDVecMultExpr.h:200
Constraint on the transpose flag of vector types.
Constraint on the data type.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
static constexpr bool evaluateMatrix
Compilation switch for the composite type of the left-hand side sparse matrix expression.
Definition: SMatDVecMultExpr.h:108
Header file for the DisableIf class template.
Header file for the multiplication trait.
If_t< useAssign, const ResultType, const SMatDVecMultExpr & > CompositeType
Data type for composite expression templates.
Definition: SMatDVecMultExpr.h:156
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatDVecMultExpr.h:270
Header file for the If class template.
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: SMatDVecMultExpr.h:280
#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
If_t< evaluateMatrix, const MRT, MCT > LT
Type for the assignment of the left-hand side sparse matrix operand.
Definition: SMatDVecMultExpr.h:165
static constexpr bool evaluateVector
Compilation switch for the composite type of the right-hand side dense vector expression.
Definition: SMatDVecMultExpr.h:113
RightOperand vec_
Right-hand side dense vector of the multiplication expression.
Definition: SMatDVecMultExpr.h:298
#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
LeftOperand mat_
Left-hand side sparse matrix of the multiplication expression.
Definition: SMatDVecMultExpr.h:297
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
ResultType_t< VT > VRT
Result type of the right-hand side dense vector expression.
Definition: SMatDVecMultExpr.h:101
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the IsAligned type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_MATMATMULTEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a matrix/matrix multiplication expressio...
Definition: MatMatMultExpr.h:83
static constexpr bool useAssign
Compilation switch for the evaluation strategy of the multiplication expression.
Definition: SMatDVecMultExpr.h:124
If_t< IsExpression_v< VT >, const VT, const VT & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: SMatDVecMultExpr.h:162
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_MATVECMULTEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid matrix/vector ...
Definition: MatVecMultExpr.h:104
Constraint on the data type.
Header file for the exception macros of the math module.
CompositeType_t< MT > MCT
Composite type of the left-hand side sparse matrix expression.
Definition: SMatDVecMultExpr.h:102
Constraint on the data type.
Header file for the EnableIf class template.
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.The MultTrait_t alias declaration provid...
Definition: MultTrait.h:240
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatDVecMultExpr.h:290
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: SMatDVecMultExpr.h:152
#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
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.
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse matrix operand.
Definition: SMatDVecMultExpr.h:236
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: SMatDVecMultExpr.h:246
CompositeType_t< VT > VCT
Composite type of the right-hand side dense vector expression.
Definition: SMatDVecMultExpr.h:103
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
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SMatDVecMultExpr.h:176
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
Header file for all forward declarations for expression class templates.
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
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
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type,...
Definition: DenseVector.h:61
Header file for the IsComputation type trait class.
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
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:146
If_t< IsExpression_v< MT >, const MT, const MT & > LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: SMatDVecMultExpr.h:159
Constraint on the data type.
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
Header file for the MatVecMultExpr base class.
Constraint on the data type.
#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
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
If_t< evaluateVector, const VRT, VCT > RT
Type for the assignment of the right-hand side dense matrix operand.
Definition: SMatDVecMultExpr.h:168
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector.
Definition: DenseVector.h:191
#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
Header file for the IsExpression type trait class.
Header file for the function trace functionality.