35#ifndef _BLAZE_MATH_EXPRESSIONS_TSVECTDMATMULTEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_TSVECTDMATMULTEXPR_H_
102 :
public TVecMatMultExpr< DenseVector< TSVecTDMatMultExpr<VT,MT>, true > >
115 static constexpr bool evaluateVector = ( IsComputation_v<VT> || RequiresEvaluation_v<VT> );
137 template<
typename VT2 >
138 static constexpr bool UseAssign_v =
useAssign;
148 template<
typename T1 >
149 static constexpr bool UseSMPAssign_v =
useAssign;
214 if( IsDiagonal_v<MT> )
216 return vec_[index] *
mat_(index,index);
218 else if( IsLower_v<MT> )
220 const size_t begin( IsStrictlyLower_v<MT> ? index+1UL : index );
225 else if( IsUpper_v<MT> )
227 const size_t n( IsStrictlyUpper_v<MT> ? index : index+1UL );
246 if( index >=
mat_.columns() ) {
249 return (*
this)[index];
258 inline size_t size() const noexcept {
259 return mat_.columns();
289 template<
typename T >
290 inline bool canAlias(
const T* alias )
const noexcept {
291 return vec_.isAliased( alias ) ||
mat_.isAliased( alias );
301 template<
typename T >
302 inline bool isAliased(
const T* alias )
const noexcept {
303 return vec_.isAliased( alias ) ||
mat_.isAliased( alias );
313 return mat_.isAligned();
323 return (
size() > SMP_TSVECTDMATMULT_THRESHOLD );
349 template<
typename VT2 >
359 if( x.nonZeros() == 0UL ) {
374 assign( *lhs, x * A );
395 template<
typename VT2 >
428 template<
typename VT2 >
438 if( x.nonZeros() == 0UL )
return;
473 template<
typename VT2 >
483 if( x.nonZeros() == 0UL )
return;
518 template<
typename VT2 >
554 template<
typename VT2 >
590 template<
typename VT2 >
600 if( x.nonZeros() == 0UL ) {
635 template<
typename VT2 >
637 -> EnableIf_t< UseSMPAssign_v<VT2> >
667 template<
typename VT2 >
677 if( x.nonZeros() == 0UL )
return;
711 template<
typename VT2 >
721 if( x.nonZeros() == 0UL )
return;
756 template<
typename VT2 >
791 template<
typename VT2 >
850 , DisableIf_t< IsSymmetric_v<MT> || IsZero_v<VT> >* =
nullptr >
851inline const TSVecTDMatMultExpr<VT,MT>
852 tsvectdmatmult(
const SparseVector<VT,true>& vec,
const DenseMatrix<MT,true>& mat )
858 return TSVecTDMatMultExpr<VT,MT>( *vec, *mat );
880 , EnableIf_t< IsSymmetric_v<MT> && !IsZero_v<VT> >* =
nullptr >
882 tsvectdmatmult(
const SparseVector<VT,true>& vec,
const DenseMatrix<MT,true>& mat )
888 return (*vec) *
trans( *mat );
909 , EnableIf_t< IsZero_v<VT> >* =
nullptr >
911 tsvectdmatmult(
const SparseVector<VT,true>& vec,
const DenseMatrix<MT,true>& mat )
919 using ReturnType =
const MultTrait_t< ResultType_t<VT>, ResultType_t<MT> >;
924 return ReturnType( (*mat).columns() );
970 if( (*vec).size() != (*mat).rows() ) {
974 return tsvectdmatmult( *vec, *mat );
989template<
typename VT,
typename MT >
990struct IsAligned< TSVecTDMatMultExpr<VT,MT> >
991 :
public IsAligned<MT>
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.
Constraints on the storage order of matrix 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 IsDiagonal type trait.
Header file for the IsExpression type trait class.
Header file for the IsLower 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 transpose flag of vector types.
Constraint on the data type.
Constraint on the data type.
Base class for dense matrices.
Definition: DenseMatrix.h:82
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
Base class for sparse vectors.
Definition: SparseVector.h:72
Expression object for transpose sparse vector-transpose dense matrix multiplications.
Definition: TSVecTDMatMultExpr.h:104
ResultType_t< MT > MRT
Result type of the right-hand side dense matrix expression.
Definition: TSVecTDMatMultExpr.h:108
RightOperand rightOperand() const noexcept
Returns the right-hand side transpose dense matrix operand.
Definition: TSVecTDMatMultExpr.h:278
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TSVecTDMatMultExpr.h:164
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TSVecTDMatMultExpr.h:302
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TSVecTDMatMultExpr.h:290
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: TSVecTDMatMultExpr.h:184
static constexpr bool evaluateMatrix
Compilation switch for the composite type of the right-hand side dense matrix expression.
Definition: TSVecTDMatMultExpr.h:120
If_t< evaluateMatrix, const MRT, MCT > RT
Type for the assignment of the left-hand side dense matrix operand.
Definition: TSVecTDMatMultExpr.h:179
If_t< IsExpression_v< MT >, const MT, const MT & > RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: TSVecTDMatMultExpr.h:173
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TSVecTDMatMultExpr.h:162
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: TSVecTDMatMultExpr.h:211
static constexpr bool evaluateVector
Compilation switch for the composite type of the left-hand side sparse vector expression.
Definition: TSVecTDMatMultExpr.h:115
ResultType_t< VT > VRT
Result type of the left-hand side sparse vector expression.
Definition: TSVecTDMatMultExpr.h:107
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: TSVecTDMatMultExpr.h:187
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: TSVecTDMatMultExpr.h:258
If_t< evaluateVector, const VRT, VCT > LT
Type for the assignment of the left-hand side sparse vector operand.
Definition: TSVecTDMatMultExpr.h:176
CompositeType_t< VT > VCT
Composite type of the left-hand side sparse vector expression.
Definition: TSVecTDMatMultExpr.h:109
LeftOperand vec_
Left-hand side sparse vector of the multiplication expression.
Definition: TSVecTDMatMultExpr.h:329
MultTrait_t< VRT, MRT > ResultType
Result type for expression template evaluations.
Definition: TSVecTDMatMultExpr.h:161
TSVecTDMatMultExpr(const VT &vec, const MT &mat) noexcept
Constructor for the TSVecTDMatMultExpr class.
Definition: TSVecTDMatMultExpr.h:197
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse vector operand.
Definition: TSVecTDMatMultExpr.h:268
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: TSVecTDMatMultExpr.h:163
RightOperand mat_
Right-hand side dense matrix of the multiplication expression.
Definition: TSVecTDMatMultExpr.h:330
static constexpr bool useAssign
Compilation switch for the evaluation strategy of the multiplication expression.
Definition: TSVecTDMatMultExpr.h:131
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: TSVecTDMatMultExpr.h:322
CompositeType_t< MT > MCT
Composite type of the right-hand side dense matrix expression.
Definition: TSVecTDMatMultExpr.h:110
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: TSVecTDMatMultExpr.h:245
If_t< IsExpression_v< VT >, const VT, const VT & > LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: TSVecTDMatMultExpr.h:170
If_t< useAssign, const ResultType, const TSVecTDMatMultExpr & > CompositeType
Data type for composite expression templates.
Definition: TSVecTDMatMultExpr.h:167
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: TSVecTDMatMultExpr.h:312
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 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 addAssign(DenseVector< VT2, true > &lhs, const TSVecTDMatMultExpr &rhs) -> EnableIf_t< UseAssign_v< VT2 > >
Addition assignment of a transpose sparse vector-transpose dense matrix multiplication to a dense vec...
Definition: TSVecTDMatMultExpr.h:429
friend auto multAssign(DenseVector< VT2, true > &lhs, const TSVecTDMatMultExpr &rhs) -> EnableIf_t< UseAssign_v< VT2 > >
Multiplication assignment of a transpose sparse vector-transpose dense matrix multiplication to a den...
Definition: TSVecTDMatMultExpr.h:519
friend auto subAssign(DenseVector< VT2, true > &lhs, const TSVecTDMatMultExpr &rhs) -> EnableIf_t< UseAssign_v< VT2 > >
Subtraction assignment of a transpose sparse vector-transpose dense matrix multiplication to a dense ...
Definition: TSVecTDMatMultExpr.h:474
friend auto smpDivAssign(DenseVector< VT2, true > &lhs, const TSVecTDMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP division assignment of a transpose sparse vector-transpose dense matrix multiplication to a dense...
Definition: TSVecTDMatMultExpr.h:792
friend auto smpSubAssign(DenseVector< VT2, true > &lhs, const TSVecTDMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP subtraction assignment of a transpose sparse vector-transpose dense matrix multiplication to a de...
Definition: TSVecTDMatMultExpr.h:712
friend auto smpMultAssign(DenseVector< VT2, true > &lhs, const TSVecTDMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP multiplication assignment of a transpose sparse vector-transpose dense matrix multiplication to a...
Definition: TSVecTDMatMultExpr.h:757
friend auto smpAddAssign(DenseVector< VT2, true > &lhs, const TSVecTDMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP addition assignment of a transpose sparse vector-transpose dense matrix multiplication to a dense...
Definition: TSVecTDMatMultExpr.h:668
friend auto divAssign(DenseVector< VT2, true > &lhs, const TSVecTDMatMultExpr &rhs) -> EnableIf_t< UseAssign_v< VT2 > >
Division assignment of a transpose sparse vector-transpose dense matrix multiplication to a dense vec...
Definition: TSVecTDMatMultExpr.h:555
#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_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_DENSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: DenseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: SparseVector.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_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 void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition: Matrix.h:806
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
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) subvector(Vector< VT, TF > &, RSAs...)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:158
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
#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 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.