35 #ifndef _BLAZE_MATH_EXPRESSIONS_SVECREALEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SVECREALEXPR_H_
98 class SVecRealExpr :
public SparseVector< SVecRealExpr<VT,TF>, TF >
100 ,
private Computation
135 template<
typename VT2 >
138 enum { value = useAssign };
151 template<
typename VT2 >
152 struct UseSMPAssign {
153 enum { value = ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign };
177 enum { smpAssignable = VT::smpAssignable };
232 return Element(
real( it_->value() ), it_->index() );
252 return real( it_->value() );
273 return it_ == rhs.
it_;
284 return it_ != rhs.
it_;
295 return it_ - rhs.
it_;
335 inline ReturnType
at(
size_t index )
const {
336 if( index >=
sv_.size() ) {
339 return (*
this)[index];
379 return sv_.nonZeros();
435 template<
typename T >
437 return sv_.canAlias( alias );
447 template<
typename T >
449 return sv_.isAliased( alias );
459 return sv_.canSMPAssign();
483 template<
typename VT2 >
495 const RT tmp(
serial( rhs.sv_ ) );
496 assign( ~lhs,
real( tmp ) );
515 template<
typename VT2 >
527 const RT tmp(
serial( rhs.sv_ ) );
528 (~lhs).reserve( tmp.nonZeros() );
529 assign( ~lhs,
real( tmp ) );
548 template<
typename VT2 >
549 friend inline typename EnableIf< UseAssign<VT2> >::Type
550 addAssign( DenseVector<VT2,TF>& lhs,
const SVecRealExpr& rhs )
560 const RT tmp(
serial( rhs.sv_ ) );
561 addAssign( ~lhs,
real( tmp ) );
584 template<
typename VT2 >
585 friend inline typename EnableIf< UseAssign<VT2> >::Type
586 subAssign( DenseVector<VT2,TF>& lhs,
const SVecRealExpr& rhs )
596 const RT tmp(
serial( rhs.sv_ ) );
597 subAssign( ~lhs,
real( tmp ) );
620 template<
typename VT2 >
621 friend inline typename EnableIf< UseAssign<VT2> >::Type
622 multAssign( DenseVector<VT2,TF>& lhs,
const SVecRealExpr& rhs )
632 const RT tmp(
serial( rhs.sv_ ) );
633 multAssign( ~lhs,
real( tmp ) );
656 template<
typename VT2 >
657 friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
668 const RT tmp( rhs.sv_ );
692 template<
typename VT2 >
693 friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
704 const RT tmp( rhs.sv_ );
728 template<
typename VT2 >
729 friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
740 const RT tmp( rhs.sv_ );
764 template<
typename VT2 >
765 friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
776 const RT tmp( rhs.sv_ );
822 template<
typename VT
852 template<
typename VT
854 inline const SVecRealExpr<VT,TF>&
real(
const SVecRealExpr<VT,TF>& sv )
874 template<
typename VT,
bool TF >
891 template<
typename VT >
896 typedef typename SelectType< IsSparseVector<VT>::value && IsColumnVector<VT>::value
897 , SVecRealExpr<VT,false>
898 , INVALID_TYPE >::Type Type;
907 template<
typename VT >
912 typedef typename SelectType< IsSparseVector<VT>::value && IsRowVector<VT>::value
913 , SVecRealExpr<VT,true>
914 , INVALID_TYPE >::Type Type;
923 template<
typename VT,
bool TF,
bool AF >
928 typedef typename RealExprTrait< typename SubvectorExprTrait<const VT,AF>::Type >::Type Type;
VT::ReturnType RN
Return type of the sparse vector expression.
Definition: SVecRealExpr.h:105
Header file for the UnderlyingNumeric type trait.
Pointer difference type of the Blaze library.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SVecRealExpr.h:197
ConstIterator find(size_t index) const
Searches for a specific vector element.
Definition: SVecRealExpr.h:389
Header file for the VecRealExpr base class.
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
const Element operator*() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecRealExpr.h:231
Header file for basic type definitions.
Header file for the SparseVector base class.
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SVecRealExpr.h:193
ConstIterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition: SVecRealExpr.h:401
SelectType< IsExpression< VT >::value, const VT, const VT & >::Type Operand
Composite data type of the sparse vector expression.
Definition: SVecRealExpr.h:172
Element ValueType
Type of the underlying pointers.
Definition: SVecRealExpr.h:194
RealExprTrait< RN >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: SVecRealExpr.h:121
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecRealExpr.h:322
IteratorType it_
Iterator over the elements of the sparse vector expression.
Definition: SVecRealExpr.h:301
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
Header file for the IsRowVector type trait.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:259
ReturnType value() const
Access to the current value of the sparse element.
Definition: SVecRealExpr.h:251
PointerType pointer
Pointer return type.
Definition: SVecRealExpr.h:202
Header file for the RealExprTrait class template.
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SVecRealExpr.h:294
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.
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: SVecRealExpr.h:458
Header file for the RequiresEvaluation type trait.
Constraint on the data type.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SVecRealExpr.h:283
ConstIterator end() const
Returns an iterator just past the last non-zero element of the sparse vector.
Definition: SVecRealExpr.h:358
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: SVecRealExpr.h:166
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecRealExpr.h:335
Header file for the ValueIndexPair class.
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the IsTemporary type trait class.
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SVecRealExpr.h:272
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
RemoveReference< Operand >::Type::ConstIterator IteratorType
Iterator type of the sparse vector expression.
Definition: SVecRealExpr.h:191
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
ResultType::ElementType ElementType
Resulting element type.
Definition: SVecRealExpr.h:163
VT::TransposeType TT
Transpose type of the sparse vector expression.
Definition: SVecRealExpr.h:107
VT::CompositeType CT
Composite type of the sparse vector expression.
Definition: SVecRealExpr.h:106
#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
Header file for the SVecRealExprTrait class template.
Iterator over the elements of the sparse vector real part expression.
Definition: SVecRealExpr.h:183
SVecRealExpr(const VT &sv)
Constructor for the SVecRealExpr class.
Definition: SVecRealExpr.h:311
size_t index() const
Access to the current index of the sparse element.
Definition: SVecRealExpr.h:261
SelectType< useAssign, const ResultType, const SVecRealExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: SVecRealExpr.h:169
Header file for the TSVecRealExprTrait class template.
const RealExprTrait< MT >::Type real(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the real part of each single element of dm.
Definition: DMatRealExpr.h:920
ConstIterator begin() const
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecRealExpr.h:348
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
Expression object for the sparse vector real() function.The SVecRealExpr class represents the compile...
Definition: Forward.h:126
#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
Constraint on the data type.
Header file for the real trait.
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:78
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2585
Header file for the real shim.
ValueIndexPair< ElementType > Element
Element type of the sparse vector expression.
Definition: SVecRealExpr.h:188
ConstIterator(IteratorType it)
Constructor for the ConstIterator class.
Definition: SVecRealExpr.h:210
DifferenceType difference_type
Difference between two iterators.
Definition: SVecRealExpr.h:204
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
Constraint on the data type.
Header file for the SelectType class template.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SVecRealExpr.h:436
Header file for the EnableIf class template.
Header file for the serial shim.
SVecRealExpr< VT, TF > This
Type of this SVecRealExpr instance.
Definition: SVecRealExpr.h:160
IteratorCategory iterator_category
The iterator category.
Definition: SVecRealExpr.h:200
ConstIterator & operator++()
Pre-increment operator.
Definition: SVecRealExpr.h:220
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
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SVecRealExpr.h:448
VT::ElementType ET
Element type of the sparse vector expression.
Definition: SVecRealExpr.h:108
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.
size_t nonZeros() const
Returns the number of non-zero elements in the sparse vector.
Definition: SVecRealExpr.h:378
const ConstIterator * operator->() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecRealExpr.h:241
ValueType & ReferenceType
Reference return type.
Definition: SVecRealExpr.h:196
Base template for the RealTrait class.The RealTrait class template offers the possibility to select t...
Definition: RealTrait.h:78
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
RealTrait< RT >::Type ResultType
Result type for expression template evaluations.
Definition: SVecRealExpr.h:161
#define BLAZE_CONSTRAINT_MUST_NOT_BE_BUILTIN_TYPE(T)
Constraint on the data type.In case the given data type T is a built-in data type, a compilation error is created.
Definition: Builtin.h:116
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SVecRealExpr.h:162
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:118
Header file for the RemoveReference type trait.
ValueType value_type
Type of the underlying pointers.
Definition: SVecRealExpr.h:201
ValueType * PointerType
Pointer return type.
Definition: SVecRealExpr.h:195
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:70
size_t size() const
Returns the current size/dimension of the vector.
Definition: SVecRealExpr.h:368
Header file for the IsComputation type trait class.
Evaluation of the return type of a real part expression.Via this type trait it is possible to evaluat...
Definition: RealExprTrait.h:88
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
VT::ResultType RT
Result type of the sparse vector expression.
Definition: SVecRealExpr.h:104
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
Operand operand() const
Returns the sparse vector operand.
Definition: SVecRealExpr.h:424
Header file for the SubvectorExprTrait class template.
Operand sv_
Sparse vector of the real part expression.
Definition: SVecRealExpr.h:465
Header file for exception macros.
ReferenceType reference
Reference return type.
Definition: SVecRealExpr.h:203
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
Constraint on the data type.
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
ConstIterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition: SVecRealExpr.h:413