35 #ifndef _BLAZE_MATH_EXPRESSIONS_SVECSERIALEXPR_H_ 36 #define _BLAZE_MATH_EXPRESSIONS_SVECSERIALEXPR_H_ 77 :
public VecSerialExpr< SparseVector< SVecSerialExpr<VT,TF>, TF > >
131 if( index >=
sv_.size() ) {
134 return (*
this)[index];
143 inline size_t size() const noexcept {
154 return sv_.nonZeros();
184 template<
typename T >
185 inline bool canAlias(
const T* alias )
const noexcept {
186 return sv_.canAlias( alias );
196 template<
typename T >
197 inline bool isAliased(
const T* alias )
const noexcept {
198 return sv_.isAliased( alias );
208 return sv_.canSMPAssign();
229 template<
typename VT2 >
236 assign( ~lhs, rhs.sv_ );
253 template<
typename VT2 >
260 assign( ~lhs, rhs.sv_ );
277 template<
typename VT2 >
278 friend inline void addAssign( DenseVector<VT2,TF>& lhs,
const SVecSerialExpr& rhs )
284 addAssign( ~lhs, rhs.sv_ );
301 template<
typename VT2 >
302 friend inline void addAssign( SparseVector<VT2,TF>& lhs,
const SVecSerialExpr& rhs )
308 addAssign( ~lhs, rhs.sv_ );
326 template<
typename VT2 >
327 friend inline void subAssign( DenseVector<VT2,TF>& lhs,
const SVecSerialExpr& rhs )
333 subAssign( ~lhs, rhs.sv_ );
351 template<
typename VT2 >
352 friend inline void subAssign( SparseVector<VT2,TF>& lhs,
const SVecSerialExpr& rhs )
358 subAssign( ~lhs, rhs.sv_ );
376 template<
typename VT2 >
377 friend inline void multAssign( DenseVector<VT2,TF>& lhs,
const SVecSerialExpr& rhs )
383 multAssign( ~lhs, rhs.sv_ );
401 template<
typename VT2 >
402 friend inline void multAssign( SparseVector<VT2,TF>& lhs,
const SVecSerialExpr& rhs )
408 multAssign( ~lhs, rhs.sv_ );
425 template<
typename VT2 >
432 assign( ~lhs, rhs.sv_ );
449 template<
typename VT2 >
456 assign( ~lhs, rhs.sv_ );
474 template<
typename VT2 >
481 addAssign( ~lhs, rhs.sv_ );
499 template<
typename VT2 >
506 addAssign( ~lhs, rhs.sv_ );
524 template<
typename VT2 >
531 subAssign( ~lhs, rhs.sv_ );
549 template<
typename VT2 >
556 subAssign( ~lhs, rhs.sv_ );
574 template<
typename VT2 >
581 multAssign( ~lhs, rhs.sv_ );
599 template<
typename VT2 >
606 multAssign( ~lhs, rhs.sv_ );
646 template<
typename VT
677 template<
typename VT
679 inline decltype(
auto)
serial( const SVecSerialExpr<VT,TF>& sv )
Header file for auxiliary alias declarations.
Header file for basic type definitions.
Header file for the SparseVector base class.
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias declaration for the If class template.The If_t alias declaration provides a convenien...
Definition: If.h:109
const ResultType CompositeType
Data type for composite expression templates.
Definition: SVecSerialExpr.h:90
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
Header file for the Computation base class.
SVecSerialExpr(const VT &sv) noexcept
Constructor for the SVecSerialExpr class.
Definition: SVecSerialExpr.h:106
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SVecSerialExpr.h:197
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
size_t nonZeros() const
Returns the number of non-zero elements in the sparse vector.
Definition: SVecSerialExpr.h:153
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecSerialExpr.h:117
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecSerialExpr.h:130
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
Operand operand() const noexcept
Returns the sparse vector operand.
Definition: SVecSerialExpr.h:163
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type...
Definition: SparseVector.h:61
Constraint on the data type.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SVecSerialExpr.h:207
Header file for the exception macros of the math module.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SVecSerialExpr.h:98
Expression object for the forced serial evaluation of sparse vectors.The SVecSerialExpr class represe...
Definition: Forward.h:149
ReturnType_t< VT > ReturnType
Return type for expression template evaluations.
Definition: SVecSerialExpr.h:87
Header file for the VecSerialExpr base class.
TransposeType_t< VT > TransposeType
Transpose type for expression template evaluations.
Definition: SVecSerialExpr.h:85
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
Header file for run time assertion macros.
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_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
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) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SVecSerialExpr.h:185
Operand sv_
Sparse vector of the serial evaluation expression.
Definition: SVecSerialExpr.h:214
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
If_t< IsExpression_v< VT >, const VT, const VT &> Operand
Composite data type of the sparse vector expression.
Definition: SVecSerialExpr.h:93
Header file for the IsComputation type trait class.
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
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:138
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SVecSerialExpr.h:143
ResultType_t< VT > ResultType
Result type for expression template evaluations.
Definition: SVecSerialExpr.h:84
ElementType_t< VT > ElementType
Resulting element type.
Definition: SVecSerialExpr.h:86
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.In case the given data type T is not a dense or sparse vector type and in...
Definition: TransposeFlag.h:63
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
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:191
Header file for the IsExpression type trait class.
Header file for the function trace functionality.