35#ifndef _BLAZE_MATH_EXPRESSIONS_TDVECSMATMULTEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_TDVECSMATMULTEXPR_H_
104 :
public TVecMatMultExpr< DenseVector< TDVecSMatMultExpr<VT,MT>, true > >
131 template<
typename T1 >
194 return vec_[index] *
mat_(index,index);
224 if( index >=
mat_.columns() ) {
227 return (*
this)[index];
236 inline size_t size() const noexcept {
237 return mat_.columns();
267 template<
typename T >
268 inline bool canAlias(
const T* alias )
const noexcept {
269 return (
vec_.isAliased( alias ) ||
mat_.isAliased( alias ) );
279 template<
typename T >
280 inline bool isAliased(
const T* alias )
const noexcept {
281 return (
vec_.isAliased( alias ) ||
mat_.isAliased( alias ) );
291 return vec_.isAligned();
301 return (
size() > SMP_TDVECSMATMULT_THRESHOLD );
323 template<
typename VT2 >
332 if( rhs.
mat_.rows() == 0UL )
return;
342 TDVecSMatMultExpr::selectAssignKernel( *lhs, x, A );
360 template<
typename VT1
363 static inline void selectAssignKernel( VT1& y,
const VT2& x,
const MT1& A )
365 for(
size_t i=0UL; i<x.size(); ++i )
367 const auto end( A.end(i) );
368 auto element( A.begin(i) );
370 for( ; element!=
end; ++element ) {
373 y[element->index()] = x[i] * element->value();
375 y[element->index()] += x[i] * element->value();
394 template<
typename VT2 >
422 template<
typename VT2 >
429 if( rhs.
mat_.rows() == 0UL ) {
441 TDVecSMatMultExpr::selectAddAssignKernel( *lhs, x, A );
459 template<
typename VT1
462 static inline void selectAddAssignKernel( VT1& y,
const VT2& x,
const MT1& A )
464 for(
size_t i=0UL; i<x.size(); ++i )
466 const auto end( A.end(i) );
467 auto element( A.begin(i) );
469 for( ; element!=
end; ++element ) {
470 y[element->index()] += x[i] * element->value();
493 template<
typename VT2 >
500 if( rhs.
mat_.rows() == 0UL ) {
512 TDVecSMatMultExpr::selectSubAssignKernel( *lhs, x, A );
530 template<
typename VT1
533 static inline void selectSubAssignKernel( VT1& y,
const VT2& x,
const MT1& A )
535 for(
size_t i=0UL; i<x.size(); ++i )
537 const auto end( A.end(i) );
538 auto element( A.begin(i) );
540 for( ; element!=
end; ++element ) {
541 y[element->index()] -= x[i] * element->value();
564 template<
typename VT2 >
596 template<
typename VT2 >
630 template<
typename VT2 >
640 if( rhs.mat_.rows() == 0UL )
return;
668 template<
typename VT2 >
699 template<
typename VT2 >
707 if( rhs.mat_.rows() == 0UL ) {
741 template<
typename VT2 >
749 if( rhs.mat_.rows() == 0UL ) {
783 template<
typename VT2 >
818 template<
typename VT2 >
881inline const TDVecSMatMultExpr<VT,MT>
882 tdvecsmatmult(
const DenseVector<VT,true>& vec,
const SparseMatrix<MT,false>& mat )
921 return (*vec) *
trans( *mat );
990 return ReturnType( (*mat).columns() );
1027template<
typename VT
1029inline decltype(
auto)
1036 if( (*vec).size() != (*mat).rows() ) {
1040 return tdvecsmatmult( *vec, *mat );
1055template<
typename VT,
typename MT >
1056struct IsAligned< TDVecSMatMultExpr<VT,MT> >
1057 :
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.
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.
Constraints on the storage order of matrix types.
Constraint on the transpose flag of vector types.
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
Base class for sparse vectors.
Definition SparseVector.h:72
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition TDVecSMatMultExpr.h:168
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition TDVecSMatMultExpr.h:236
const ResultType CompositeType
Data type for composite expression templates.
Definition TDVecSMatMultExpr.h:148
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition TDVecSMatMultExpr.h:145
If_t< evaluateMatrix, const MRT, MCT > RT
Composite type of the right-hand side sparse matrix expression.
Definition TDVecSMatMultExpr.h:160
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition TDVecSMatMultExpr.h:246
TDVecSMatMultExpr< VT, MT > This
Type of this TDVecSMatMultExpr instance.
Definition TDVecSMatMultExpr.h:139
ResultType_t< VT > VRT
Result type of the left-hand side dense vector expression.
Definition TDVecSMatMultExpr.h:109
static constexpr bool evaluateMatrix
Compilation switch for the composite type of the right-hand side sparse matrix expression.
Definition TDVecSMatMultExpr.h:122
If_t< IsExpression_v< MT >, const MT, const MT & > RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition TDVecSMatMultExpr.h:154
RightOperand mat_
Right-hand side sparse matrix of the multiplication expression.
Definition TDVecSMatMultExpr.h:308
ElementType_t< ResultType > ElementType
Resulting element type.
Definition TDVecSMatMultExpr.h:146
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition TDVecSMatMultExpr.h:165
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition TDVecSMatMultExpr.h:290
RightOperand rightOperand() const noexcept
Returns the right-hand side sparse matrix operand.
Definition TDVecSMatMultExpr.h:256
CompositeType_t< MT > MCT
Composite type of the right-hand side sparse matrix expression.
Definition TDVecSMatMultExpr.h:112
static constexpr bool evaluateVector
Compilation switch for the composite type of the left-hand side dense vector expression.
Definition TDVecSMatMultExpr.h:117
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition TDVecSMatMultExpr.h:189
const ElementType ReturnType
Return type for expression template evaluations.
Definition TDVecSMatMultExpr.h:147
TDVecSMatMultExpr(const VT &vec, const MT &mat) noexcept
Constructor for the TDVecSMatMultExpr class.
Definition TDVecSMatMultExpr.h:175
If_t< IsExpression_v< VT >, const VT, const VT & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition TDVecSMatMultExpr.h:151
ResultType_t< MT > MRT
Result type of the right-hand side sparse matrix expression.
Definition TDVecSMatMultExpr.h:110
If_t< evaluateVector, const VRT, VCT > LT
Composite type of the left-hand side dense vector expression.
Definition TDVecSMatMultExpr.h:157
LeftOperand vec_
Left-hand side dense vector of the multiplication expression.
Definition TDVecSMatMultExpr.h:307
MultTrait_t< VRT, MRT > ResultType
Result type for expression template evaluations.
Definition TDVecSMatMultExpr.h:144
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition TDVecSMatMultExpr.h:223
CompositeType_t< VT > VCT
Composite type of the left-hand side dense vector expression.
Definition TDVecSMatMultExpr.h:111
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition TDVecSMatMultExpr.h:280
TVecMatMultExpr< DenseVector< This, true > > BaseType
Base type of this TDVecSMatMultExpr instance.
Definition TDVecSMatMultExpr.h:142
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition TDVecSMatMultExpr.h:300
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition TDVecSMatMultExpr.h:268
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 TVecMatMultExpr 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
friend auto smpAssign(SparseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP assignment of a transpose dense vector-sparse matrix multiplication to a sparse vector ( ).
Definition TDVecSMatMultExpr.h:669
friend void multAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Multiplication assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ...
Definition TDVecSMatMultExpr.h:565
friend auto smpSubAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP subtraction assignment of a transpose dense vector-sparse matrix multiplication to a dense vector...
Definition TDVecSMatMultExpr.h:742
friend auto smpDivAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP division assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ...
Definition TDVecSMatMultExpr.h:819
friend auto smpMultAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP multiplication assignment of a transpose dense vector-sparse matrix multiplication to a dense vec...
Definition TDVecSMatMultExpr.h:784
friend auto smpAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ).
Definition TDVecSMatMultExpr.h:631
friend auto smpAddAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
Addition assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ).
Definition TDVecSMatMultExpr.h:700
friend void subAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Subtraction assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( )...
Definition TDVecSMatMultExpr.h:494
friend void addAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Addition assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ).
Definition TDVecSMatMultExpr.h:423
friend void assign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ).
Definition TDVecSMatMultExpr.h:324
friend void divAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Division assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ).
Definition TDVecSMatMultExpr.h:597
friend void assign(SparseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Assignment of a transpose dense vector-sparse matrix multiplication to a sparse vector ( ).
Definition TDVecSMatMultExpr.h:395
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_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_TVECMATMULTEXPR(T1, T2)
Constraint on the data type.
Definition TVecMatMultExpr.h:104
#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_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_ROW_VECTOR_TYPE(T)
Constraint on the data type.
Definition RowVector.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
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition Assert.h:101
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 vector/matrix multiplication expression templates.
Definition TVecMatMultExpr.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.