35#ifndef _BLAZE_MATH_EXPRESSIONS_SMATDVECMULTEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_SMATDVECMULTEXPR_H_
95 :
public MatVecMultExpr< DenseVector< SMatDVecMultExpr<MT,VT>, false > >
113 static constexpr bool evaluateVector = ( IsComputation_v<VT> || RequiresEvaluation_v<VT> );
130 template<
typename VT2 >
131 static constexpr bool UseAssign_v =
useAssign;
141 template<
typename T1 >
142 static constexpr bool UseSMPAssign_v =
useAssign;
218 if( index >=
mat_.rows() ) {
221 return (*
this)[index];
230 inline size_t size() const noexcept {
261 template<
typename T >
262 inline bool canAlias(
const T* alias )
const noexcept {
263 return (
mat_.isAliased( alias ) ||
vec_.isAliased( alias ) );
273 template<
typename T >
274 inline bool isAliased(
const T* alias )
const noexcept {
275 return (
mat_.isAliased( alias ) ||
vec_.isAliased( alias ) );
285 return vec_.isAligned();
295 return (
size() > SMP_SMATDVECMULT_THRESHOLD );
321 template<
typename VT1 >
329 if( rhs.mat_.columns() == 0UL ) {
342 assign( *lhs, A * x );
363 template<
typename VT1 >
397 template<
typename VT1 >
398 friend inline auto addAssign( DenseVector<VT1,false>& lhs,
const SMatDVecMultExpr& rhs )
399 -> EnableIf_t< UseAssign_v<VT1> >
405 if( rhs.mat_.columns() == 0UL ) {
417 addAssign( *lhs, A * x );
442 template<
typename VT1 >
443 friend inline auto subAssign( DenseVector<VT1,false>& lhs,
const SMatDVecMultExpr& rhs )
444 -> EnableIf_t< UseAssign_v<VT1> >
450 if( rhs.mat_.columns() == 0UL ) {
462 subAssign( *lhs, A * x );
487 template<
typename VT1 >
488 friend inline auto multAssign( DenseVector<VT1,false>& lhs,
const SMatDVecMultExpr& rhs )
489 -> EnableIf_t< UseAssign_v<VT1> >
500 multAssign( *lhs, tmp );
525 template<
typename VT1 >
526 friend inline auto divAssign( DenseVector<VT1,false>& lhs,
const SMatDVecMultExpr& rhs )
527 -> EnableIf_t< UseAssign_v<VT1> >
538 divAssign( *lhs, tmp );
562 template<
typename VT1 >
564 -> EnableIf_t< UseSMPAssign_v<VT1> >
570 if( rhs.mat_.columns() == 0UL ) {
603 template<
typename VT1 >
605 -> EnableIf_t< UseSMPAssign_v<VT1> >
636 template<
typename VT1 >
638 -> EnableIf_t< UseSMPAssign_v<VT1> >
644 if( rhs.mat_.columns() == 0UL ) {
680 template<
typename VT1 >
682 -> EnableIf_t< UseSMPAssign_v<VT1> >
688 if( rhs.mat_.columns() == 0UL ) {
724 template<
typename VT1 >
726 -> EnableIf_t< UseSMPAssign_v<VT1> >
761 template<
typename VT1 >
763 -> EnableIf_t< UseSMPAssign_v<VT1> >
821 IsSame_v< ElementType_t<MT>, ElementType_t<VT> > ) ||
822 IsZero_v<MT> >* =
nullptr >
823inline const SMatDVecMultExpr<MT,VT>
824 smatdvecmult(
const SparseMatrix<MT,false>& mat,
const DenseVector<VT,false>& vec )
830 return SMatDVecMultExpr<MT,VT>( *mat, *vec );
852 , EnableIf_t< IsIdentity_v<MT> &&
853 IsSame_v< ElementType_t<MT>, ElementType_t<VT> > >* =
nullptr >
855 smatdvecmult(
const SparseMatrix<MT,false>& mat,
const DenseVector<VT,false>& vec )
884 , EnableIf_t< IsZero_v<MT> >* =
nullptr >
886 smatdvecmult(
const SparseMatrix<MT,false>& mat,
const DenseVector<VT,false>& vec )
894 using ReturnType =
const MultTrait_t< ResultType_t<MT>, ResultType_t<VT> >;
899 return ReturnType( (*mat).rows() );
945 if( (*mat).columns() != (*vec).size() ) {
949 return smatdvecmult( *mat, *vec );
964template<
typename MT,
typename VT >
965struct IsAligned< SMatDVecMultExpr<MT,VT> >
966 :
public IsAligned<VT>
Header file for auxiliary alias declarations.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition: Aliases.h:110
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::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition: Aliases.h:550
Header file for run time assertion macros.
Header file for the blaze::checked and blaze::unchecked instances.
Constraint on the transpose flag of vector types.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Header file for the If class template.
Header file for the IsAligned type trait.
Header file for the IsComputation type trait class.
Header file for the IsExpression type trait class.
Header file for the IsIdentity type trait.
Deactivation of problematic macros.
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.
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
Expression object for sparse matrix-dense vector multiplications.
Definition: SMatDVecMultExpr.h:97
If_t< useAssign, const ResultType, const SMatDVecMultExpr & > CompositeType
Data type for composite expression templates.
Definition: SMatDVecMultExpr.h:160
If_t< IsExpression_v< MT >, const MT, const MT & > LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: SMatDVecMultExpr.h:163
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse matrix operand.
Definition: SMatDVecMultExpr.h:240
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SMatDVecMultExpr.h:204
ResultType_t< MT > MRT
Result type of the left-hand side sparse matrix expression.
Definition: SMatDVecMultExpr.h:100
If_t< IsExpression_v< VT >, const VT, const VT & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: SMatDVecMultExpr.h:166
static constexpr bool evaluateVector
Compilation switch for the composite type of the right-hand side dense vector expression.
Definition: SMatDVecMultExpr.h:113
SMatDVecMultExpr(const MT &mat, const VT &vec) noexcept
Constructor for the SMatDVecMultExpr class.
Definition: SMatDVecMultExpr.h:190
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatDVecMultExpr.h:274
If_t< evaluateMatrix, const MRT, MCT > LT
Type for the assignment of the left-hand side sparse matrix operand.
Definition: SMatDVecMultExpr.h:169
If_t< evaluateVector, const VRT, VCT > RT
Type for the assignment of the right-hand side dense matrix operand.
Definition: SMatDVecMultExpr.h:172
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: SMatDVecMultExpr.h:284
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatDVecMultExpr.h:155
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: SMatDVecMultExpr.h:177
static constexpr bool useAssign
Compilation switch for the evaluation strategy of the multiplication expression.
Definition: SMatDVecMultExpr.h:124
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SMatDVecMultExpr.h:217
RightOperand vec_
Right-hand side dense vector of the multiplication expression.
Definition: SMatDVecMultExpr.h:302
MultTrait_t< MRT, VRT > ResultType
Result type for expression template evaluations.
Definition: SMatDVecMultExpr.h:154
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: SMatDVecMultExpr.h:250
static constexpr bool evaluateMatrix
Compilation switch for the composite type of the left-hand side sparse matrix expression.
Definition: SMatDVecMultExpr.h:108
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatDVecMultExpr.h:294
CompositeType_t< MT > MCT
Composite type of the left-hand side sparse matrix expression.
Definition: SMatDVecMultExpr.h:102
const ElementType ReturnType
Return type for expression template evaluations.
Definition: SMatDVecMultExpr.h:157
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SMatDVecMultExpr.h:180
LeftOperand mat_
Left-hand side sparse matrix of the multiplication expression.
Definition: SMatDVecMultExpr.h:301
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: SMatDVecMultExpr.h:156
CompositeType_t< VT > VCT
Composite type of the right-hand side dense vector expression.
Definition: SMatDVecMultExpr.h:103
ResultType_t< VT > VRT
Result type of the right-hand side dense vector expression.
Definition: SMatDVecMultExpr.h:101
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SMatDVecMultExpr.h:230
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatDVecMultExpr.h:262
Base class for sparse matrices.
Definition: SparseMatrix.h:77
Base class for sparse vectors.
Definition: SparseVector.h:72
Constraint on the data type.
Constraint on the data type.
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 DenseVector base class.
Header file for the MatVecMultExpr 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_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_NOT_BE_MATMATMULTEXPR_TYPE(T)
Constraint on the data type.
Definition: MatMatMultExpr.h:83
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ZERO_TYPE(T)
Constraint on the data type.
Definition: Zero.h:81
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_MATVECMULTEXPR(T1, T2)
Constraint on the data type.
Definition: MatVecMultExpr.h:104
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: SparseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: DenseVector.h:61
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE(T)
Constraint on the data type.
Definition: ColumnVector.h:61
#define BLAZE_CONSTRAINT_MUST_BE_ZERO_TYPE(T)
Constraint on the data type.
Definition: Zero.h:61
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.
Definition: MultTrait.h:165
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition: Matrix.h:806
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 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:221
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 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:192
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
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
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 reset shim.
Header file for the serial shim.
Base class for all compute expression templates.
Definition: Computation.h:68
Base class for all matrix/vector multiplication expression templates.
Definition: MatVecMultExpr.h:69
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.