35 #ifndef _BLAZE_MATH_EXPRESSIONS_SVECSERIALEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SVECSERIALEXPR_H_
86 class SVecSerialExpr :
public SparseVector< SVecSerialExpr<VT,TF>, TF >
87 ,
private VecSerialExpr
107 enum { smpAssignable = VT::smpAssignable };
139 inline ReturnType
at(
size_t index )
const {
140 if( index >=
sv_.size() ) {
143 return (*
this)[index];
163 return sv_.nonZeros();
193 template<
typename T >
195 return sv_.canAlias( alias );
205 template<
typename T >
207 return sv_.isAliased( alias );
217 return sv_.canSMPAssign();
238 template<
typename VT2 >
245 assign( ~lhs, rhs.sv_ );
262 template<
typename VT2 >
269 assign( ~lhs, rhs.sv_ );
286 template<
typename VT2 >
287 friend inline void addAssign( DenseVector<VT2,TF>& lhs,
const SVecSerialExpr& rhs )
293 addAssign( ~lhs, rhs.sv_ );
310 template<
typename VT2 >
311 friend inline void addAssign( SparseVector<VT2,TF>& lhs,
const SVecSerialExpr& rhs )
317 addAssign( ~lhs, rhs.sv_ );
335 template<
typename VT2 >
336 friend inline void subAssign( DenseVector<VT2,TF>& lhs,
const SVecSerialExpr& rhs )
342 subAssign( ~lhs, rhs.sv_ );
360 template<
typename VT2 >
361 friend inline void subAssign( SparseVector<VT2,TF>& lhs,
const SVecSerialExpr& rhs )
367 subAssign( ~lhs, rhs.sv_ );
385 template<
typename VT2 >
386 friend inline void multAssign( DenseVector<VT2,TF>& lhs,
const SVecSerialExpr& rhs )
392 multAssign( ~lhs, rhs.sv_ );
410 template<
typename VT2 >
411 friend inline void multAssign( SparseVector<VT2,TF>& lhs,
const SVecSerialExpr& rhs )
417 multAssign( ~lhs, rhs.sv_ );
434 template<
typename VT2 >
441 assign( ~lhs, rhs.sv_ );
458 template<
typename VT2 >
465 assign( ~lhs, rhs.sv_ );
483 template<
typename VT2 >
490 addAssign( ~lhs, rhs.sv_ );
508 template<
typename VT2 >
515 addAssign( ~lhs, rhs.sv_ );
533 template<
typename VT2 >
540 subAssign( ~lhs, rhs.sv_ );
558 template<
typename VT2 >
565 subAssign( ~lhs, rhs.sv_ );
583 template<
typename VT2 >
590 multAssign( ~lhs, rhs.sv_ );
608 template<
typename VT2 >
615 multAssign( ~lhs, rhs.sv_ );
655 template<
typename VT
685 template<
typename VT
687 inline const SVecSerialExpr<VT,TF>
serial(
const SVecSerialExpr<VT,TF>& sv )
705 template<
typename VT,
bool TF >
706 struct Size< SVecSerialExpr<VT,TF> > :
public Size<VT>
722 template<
typename VT >
723 struct SVecSerialExprTrait< SVecSerialExpr<VT,false> >
727 typedef typename SelectType< IsSparseVector<VT>::value && IsColumnVector<VT>::value
728 , SVecSerialExpr<VT,false>
729 , INVALID_TYPE >::Type Type;
738 template<
typename VT >
739 struct TSVecSerialExprTrait< SVecSerialExpr<VT,true> >
743 typedef typename SelectType< IsSparseVector<VT>::value && IsRowVector<VT>::value
744 , SVecSerialExpr<VT,true>
745 , INVALID_TYPE >::Type Type;
754 template<
typename VT,
bool TF,
bool AF >
755 struct SubvectorExprTrait< SVecSerialExpr<VT,TF>, AF >
759 typedef typename SerialExprTrait< typename SubvectorExprTrait<const VT,AF>::Type >::Type Type;
VT::ElementType ElementType
Resulting element type.
Definition: SVecSerialExpr.h:95
SVecSerialExpr< VT, TF > This
Type of this SVecSerialExpr instance.
Definition: SVecSerialExpr.h:92
Header file for basic type definitions.
Header file for the SparseVector base class.
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SVecSerialExpr.h:194
VT::ResultType ResultType
Result type for expression template evaluations.
Definition: SVecSerialExpr.h:93
Header file for the IsRowVector type trait.
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecSerialExpr.h:139
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecSerialExpr.h:126
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
Header file for the Computation base class.
Constraint on the data type.
VT::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SVecSerialExpr.h:94
SelectType< IsExpression< VT >::value, const VT, const VT & >::Type Operand
Composite data type of the sparse vector expression.
Definition: SVecSerialExpr.h:102
Operand operand() const
Returns the sparse vector operand.
Definition: SVecSerialExpr.h:172
const ResultType CompositeType
Data type for composite expression templates.
Definition: SVecSerialExpr.h:99
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
#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:79
Header file for the SerialExprTrait class template.
Constraint on the data type.
Header file for the SVecSerialExprTrait class template.
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: SVecSerialExpr.h:216
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2585
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
Header file for the SelectType class template.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
Expression object for the forced serial evaluation of sparse vectors.The SVecSerialExpr class represe...
Definition: Forward.h:129
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SVecSerialExpr.h:206
size_t nonZeros() const
Returns the number of non-zero elements in the sparse vector.
Definition: SVecSerialExpr.h:162
Header file for the VecSerialExpr base class.
EnableIf< IsDenseMatrix< MT1 > >::Type smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
Header file for the IsSparseVector type trait.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Header file for run time assertion macros.
EnableIf< IsDenseMatrix< MT1 > >::Type smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
Utility type for generic codes.
Header file for the TSVecSerialExprTrait class template.
Operand sv_
Sparse vector of the serial evaluation expression.
Definition: SVecSerialExpr.h:223
Header file for the IsComputation type trait class.
EnableIf< IsDenseMatrix< MT1 > >::Type smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:118
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
SVecSerialExpr(const VT &sv)
Constructor for the SVecSerialExpr class.
Definition: SVecSerialExpr.h:115
Header file for the SubvectorExprTrait class template.
VT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: SVecSerialExpr.h:96
Header file for exception macros.
Header file for the IsColumnVector type trait.
EnableIf< IsDenseVector< VT1 > >::Type smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:189
Header file for the Size type trait.
#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:81
#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
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
size_t size() const
Returns the current size/dimension of the vector.
Definition: SVecSerialExpr.h:152