35#ifndef _BLAZE_MATH_EXPRESSIONS_SVECEVALEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_SVECEVALEXPR_H_
77 :
public VecEvalExpr< SparseVector< SVecEvalExpr<VT,TF>, TF > >
135 if( index >=
sv_.size() ) {
138 return (*
this)[index];
147 inline size_t size() const noexcept {
158 return sv_.nonZeros();
178 template<
typename T >
179 inline bool canAlias(
const T* alias )
const noexcept {
180 return sv_.canAlias( alias );
190 template<
typename T >
191 inline bool isAliased(
const T* alias )
const noexcept {
192 return sv_.isAliased( alias );
202 return sv_.canSMPAssign();
223 template<
typename VT2 >
230 assign( *lhs, rhs.
sv_ );
247 template<
typename VT2 >
254 assign( *lhs, rhs.
sv_ );
271 template<
typename VT2 >
272 friend inline void addAssign( DenseVector<VT2,TF>& lhs,
const SVecEvalExpr& rhs )
278 addAssign( *lhs, rhs.sv_ );
295 template<
typename VT2 >
296 friend inline void addAssign( SparseVector<VT2,TF>& lhs,
const SVecEvalExpr& rhs )
302 addAssign( *lhs, rhs.sv_ );
319 template<
typename VT2 >
320 friend inline void subAssign( DenseVector<VT2,TF>& lhs,
const SVecEvalExpr& rhs )
326 subAssign( *lhs, rhs.sv_ );
343 template<
typename VT2 >
344 friend inline void subAssign( SparseVector<VT2,TF>& lhs,
const SVecEvalExpr& rhs )
350 subAssign( *lhs, rhs.sv_ );
367 template<
typename VT2 >
368 friend inline void multAssign( DenseVector<VT2,TF>& lhs,
const SVecEvalExpr& rhs )
374 multAssign( *lhs, rhs.sv_ );
391 template<
typename VT2 >
392 friend inline void multAssign( SparseVector<VT2,TF>& lhs,
const SVecEvalExpr& rhs )
398 multAssign( *lhs, rhs.sv_ );
415 template<
typename VT2 >
439 template<
typename VT2 >
463 template<
typename VT2 >
487 template<
typename VT2 >
511 template<
typename VT2 >
535 template<
typename VT2 >
559 template<
typename VT2 >
583 template<
typename VT2 >
637 return ReturnType( *sv );
Header file for auxiliary alias declarations.
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition Aliases.h:470
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 function trace functionality.
Header file for the If class template.
Header file for the IsExpression type trait class.
Deactivation of problematic macros.
Base class for N-dimensional dense vectors.
Definition DenseVector.h:77
Expression object for the forced evaluation of sparse vectors.
Definition SVecEvalExpr.h:79
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition SVecEvalExpr.h:134
const ResultType CompositeType
Data type for composite expression templates.
Definition SVecEvalExpr.h:94
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition SVecEvalExpr.h:121
VecEvalExpr< SparseVector< This, TF > > BaseType
Base type of this SVecEvalExpr instance.
Definition SVecEvalExpr.h:86
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition SVecEvalExpr.h:179
size_t nonZeros() const
Returns the number of non-zero elements in the sparse vector.
Definition SVecEvalExpr.h:157
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition SVecEvalExpr.h:201
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition SVecEvalExpr.h:102
ReturnType_t< VT > ReturnType
Return type for expression template evaluations.
Definition SVecEvalExpr.h:91
If_t< IsExpression_v< VT >, const VT, const VT & > Operand
Composite data type of the sparse vector expression.
Definition SVecEvalExpr.h:97
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition SVecEvalExpr.h:191
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition SVecEvalExpr.h:147
SVecEvalExpr< VT, TF > This
Type of this SVecEvalExpr instance.
Definition SVecEvalExpr.h:83
ResultType_t< VT > ResultType
Result type for expression template evaluations.
Definition SVecEvalExpr.h:88
SVecEvalExpr(const VT &sv) noexcept
Constructor for the SVecEvalExpr class.
Definition SVecEvalExpr.h:110
ElementType_t< VT > ElementType
Resulting element type.
Definition SVecEvalExpr.h:90
Operand operand() const noexcept
Returns the sparse vector operand.
Definition SVecEvalExpr.h:167
TransposeType_t< VT > TransposeType
Transpose type for expression template evaluations.
Definition SVecEvalExpr.h:89
Operand sv_
Sparse vector of the evaluation expression.
Definition SVecEvalExpr.h:208
Base class for sparse vectors.
Definition SparseVector.h:72
Constraint on the data type.
Header file for the Computation base class.
Header file for the SparseVector base class.
Header file for the VecEvalExpr base class.
decltype(auto) eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition DMatEvalExpr.h:790
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.
Definition TransposeFlag.h:63
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition SparseVector.h:61
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition Assert.h:101
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
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition Exception.h:331
#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
Header file for the exception macros of the math module.
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Base class for all compute expression templates.
Definition Computation.h:68
Base class for all vector evaluation expression templates.
Definition VecEvalExpr.h:69
Header file for basic type definitions.