35#ifndef _BLAZE_MATH_EXPRESSIONS_TSMATDVECMULTEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_TSMATDVECMULTEXPR_H_
105 :
public MatVecMultExpr< DenseVector< TSMatDVecMultExpr<MT,VT>, false > >
132 template<
typename T1 >
198 return mat_(index,index) *
vec_[index];
209 const size_t n (
mat_.columns() -
begin );
228 if( index >=
mat_.rows() ) {
231 return (*
this)[index];
240 inline size_t size() const noexcept {
271 template<
typename T >
272 inline bool canAlias(
const T* alias )
const noexcept {
273 return (
mat_.isAliased( alias ) ||
vec_.isAliased( alias ) );
283 template<
typename T >
284 inline bool isAliased(
const T* alias )
const noexcept {
285 return (
mat_.isAliased( alias ) ||
vec_.isAliased( alias ) );
295 return vec_.isAligned();
305 return (
size() > SMP_TSMATDVECMULT_THRESHOLD );
328 template<
typename VT2 >
337 if( rhs.
mat_.columns() == 0UL )
return;
347 TSMatDVecMultExpr::selectAssignKernel( *lhs, A, x );
366 template<
typename VT1
369 static inline void selectAssignKernel( VT1& y,
const MT1& A,
const VT2& x )
371 for(
size_t j=0UL; j<A.columns(); ++j )
373 auto element( A.begin(j) );
374 const auto end( A.end(j) );
376 for( ; element!=
end; ++element ) {
379 y[element->index()] = element->value() * x[j];
381 y[element->index()] += element->value() * x[j];
401 template<
typename VT2 >
402 friend inline void assign( SparseVector<VT2,false>& lhs,
const TSMatDVecMultExpr& rhs )
431 template<
typename VT2 >
432 friend inline void addAssign( DenseVector<VT2,false>& lhs,
const TSMatDVecMultExpr& rhs )
438 if( rhs.mat_.columns() == 0UL )
return;
448 TSMatDVecMultExpr::selectAddAssignKernel( *lhs, A, x );
467 template<
typename VT1
470 static inline void selectAddAssignKernel( VT1& y,
const MT1& A,
const VT2& x )
472 for(
size_t j=0UL; j<A.columns(); ++j )
474 auto element( A.begin(j) );
475 const auto end( A.end(j) );
477 for( ; element!=
end; ++element ) {
478 y[element->index()] += element->value() * x[j];
502 template<
typename VT2 >
503 friend inline void subAssign( DenseVector<VT2,false>& lhs,
const TSMatDVecMultExpr& rhs )
509 if( rhs.mat_.columns() == 0UL )
return;
519 TSMatDVecMultExpr::selectSubAssignKernel( *lhs, A, x );
538 template<
typename VT1
541 static inline void selectSubAssignKernel( VT1& y,
const MT1& A,
const VT2& x )
543 for(
size_t j=0UL; j<A.columns(); ++j )
545 auto element( A.begin(j) );
546 const auto end( A.end(j) );
548 for( ; element!=
end; ++element ) {
549 y[element->index()] -= element->value() * x[j];
573 template<
typename VT2 >
574 friend inline void multAssign( DenseVector<VT2,false>& lhs,
const TSMatDVecMultExpr& rhs )
585 multAssign( *lhs, tmp );
607 template<
typename VT2 >
608 friend inline void divAssign( DenseVector<VT2,false>& lhs,
const TSMatDVecMultExpr& rhs )
619 divAssign( *lhs, tmp );
643 template<
typename VT2 >
653 if( rhs.mat_.columns() == 0UL )
return;
683 template<
typename VT2 >
716 template<
typename VT2 >
724 if( rhs.mat_.columns() == 0UL )
return;
758 template<
typename VT2 >
766 if( rhs.mat_.columns() == 0UL )
return;
800 template<
typename VT2 >
837 template<
typename VT2 >
941 return trans( *mat ) * (*vec);
1010 return ReturnType( (*mat).rows() );
1047template<
typename MT
1049inline decltype(
auto)
1056 if( (*mat).columns() != (*vec).size() ) {
1060 return tsmatdvecmult( *mat, *vec );
1075template<
typename MT,
typename VT >
1076struct IsAligned< TSMatDVecMultExpr<MT,VT> >
1077 :
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::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.
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 isDefault shim.
Header file for the IsDiagonal type trait.
Header file for the IsExpression type trait class.
Header file for the IsIdentity type trait.
Header file for the IsLower type trait.
Header file for the IsResizable 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 IsUpper type trait.
Deactivation of problematic macros.
Header file for the MAYBE_UNUSED function template.
Header file for the multiplication trait.
Constraint on the data type.
Constraint on the data type.
Base class for N-dimensional dense vectors.
Definition DenseVector.h:77
Base class for sparse matrices.
Definition SparseMatrix.h:77
Expression object for transpose sparse matrix-dense vector multiplications.
Definition TSMatDVecMultExpr.h:107
CompositeType_t< MT > MCT
Composite type of the left-hand side sparse matrix expression.
Definition TSMatDVecMultExpr.h:112
If_t< IsExpression_v< MT >, const MT, const MT & > LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition TSMatDVecMultExpr.h:152
If_t< IsExpression_v< VT >, const VT, const VT & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition TSMatDVecMultExpr.h:155
RightOperand vec_
Right-hand side dense vector of the multiplication expression.
Definition TSMatDVecMultExpr.h:312
TSMatDVecMultExpr(const MT &mat, const VT &vec) noexcept
Constructor for the TSMatDVecMultExpr class.
Definition TSMatDVecMultExpr.h:179
ElementType_t< ResultType > ElementType
Resulting element type.
Definition TSMatDVecMultExpr.h:147
ResultType_t< VT > VRT
Result type of the right-hand side dense vector expression.
Definition TSMatDVecMultExpr.h:111
const ElementType ReturnType
Return type for expression template evaluations.
Definition TSMatDVecMultExpr.h:148
const ResultType CompositeType
Data type for composite expression templates.
Definition TSMatDVecMultExpr.h:149
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition TSMatDVecMultExpr.h:272
CompositeType_t< VT > VCT
Composite type of the right-hand side dense vector expression.
Definition TSMatDVecMultExpr.h:113
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition TSMatDVecMultExpr.h:146
If_t< evaluateMatrix, const MRT, MCT > LT
Type for the assignment of the left-hand side sparse matrix operand.
Definition TSMatDVecMultExpr.h:158
If_t< evaluateVector, const VRT, VCT > RT
Type for the assignment of the right-hand side dense vector operand.
Definition TSMatDVecMultExpr.h:161
MatVecMultExpr< DenseVector< This, false > > BaseType
Base type of this TSMatDVecMultExpr instance.
Definition TSMatDVecMultExpr.h:143
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition TSMatDVecMultExpr.h:166
MultTrait_t< MRT, VRT > ResultType
Result type for expression template evaluations.
Definition TSMatDVecMultExpr.h:145
TSMatDVecMultExpr< MT, VT > This
Type of this TSMatDVecMultExpr instance.
Definition TSMatDVecMultExpr.h:140
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition TSMatDVecMultExpr.h:304
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition TSMatDVecMultExpr.h:240
ResultType_t< MT > MRT
Result type of the left-hand side sparse matrix expression.
Definition TSMatDVecMultExpr.h:110
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition TSMatDVecMultExpr.h:193
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition TSMatDVecMultExpr.h:260
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition TSMatDVecMultExpr.h:294
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition TSMatDVecMultExpr.h:169
static constexpr bool evaluateVector
Compilation switch for the composite type of the right-hand side dense vector expression.
Definition TSMatDVecMultExpr.h:123
LeftOperand leftOperand() const noexcept
Returns the left-hand side transpose sparse matrix operand.
Definition TSMatDVecMultExpr.h:250
LeftOperand mat_
Left-hand side sparse matrix of the multiplication expression.
Definition TSMatDVecMultExpr.h:311
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition TSMatDVecMultExpr.h:284
static constexpr bool evaluateMatrix
Compilation switch for the composite type of the left-hand side sparse matrix expression.
Definition TSMatDVecMultExpr.h:118
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition TSMatDVecMultExpr.h:227
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.
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) 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
bool isDefault(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the given diagonal matrix is in default state.
Definition DiagonalMatrix.h:169
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.
Definition Symmetric.h:79
#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_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 MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.
Definition MultTrait.h:165
constexpr bool RequiresEvaluation_v
Auxiliary variable template for the RequiresEvaluation type trait.
Definition RequiresEvaluation.h:91
constexpr bool IsStrictlyUpper_v
Auxiliary variable template for the IsStrictlyUpper type trait.
Definition IsStrictlyUpper.h:173
constexpr bool IsStrictlyLower_v
Auxiliary variable template for the IsStrictlyLower type trait.
Definition IsStrictlyLower.h:173
constexpr bool IsUpper_v
Auxiliary variable template for the IsUpper type trait.
Definition IsUpper.h:175
constexpr bool IsDiagonal_v
Auxiliary variable template for the IsDiagonal type trait.
Definition IsDiagonal.h:148
constexpr bool IsComputation_v
Auxiliary variable template for the IsComputation type trait.
Definition IsComputation.h:90
constexpr bool IsZero_v
Auxiliary variable template for the IsZero type trait.
Definition IsZero.h:166
constexpr bool IsIdentity_v
Auxiliary variable template for the IsIdentity type trait.
Definition IsIdentity.h:137
constexpr bool IsLower_v
Auxiliary variable template for the IsLower type trait.
Definition IsLower.h:175
constexpr bool IsResizable_v
Auxiliary variable template for the IsResizable type trait.
Definition IsResizable.h:136
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition Matrix.h:806
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition Matrix.h:584
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition Matrix.h:518
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
decltype(auto) subvector(Vector< VT, TF > &, RSAs...)
Creating a view on a specific subvector of the given vector.
Definition Subvector.h:158
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 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.