Classes | Public Types | Public Member Functions | Public Attributes | Private Types | Private Attributes | List of all members
blaze::SVecForEachExpr< VT, OP, TF > Class Template Reference

Expression object for the sparse vector forEach() function.The SVecForEachExpr class represents the compile time expression for the evaluation of a custom operation on each element of a sparse vector via the forEach() function. More...

#include <SVecForEachExpr.h>

Inherits blaze::SparseVector< SVecForEachExpr< VT, OP, TF >, TF >, blaze::VecForEachExpr, and blaze::Computation.

Classes

class  ConstIterator
 Iterator over the elements of the sparse vector for-each expression. More...
 

Public Types

enum  : bool { smpAssignable = VT::smpAssignable }
 Compilation switch for the expression template assignment strategy.
 
typedef SVecForEachExpr< VT, OP, TF > This
 Type of this SVecForEachExpr instance.
 
typedef ForEachTrait_< VT, OP > ResultType
 Result type for expression template evaluations.
 
typedef TransposeType_< ResultTypeTransposeType
 Transpose type for expression template evaluations.
 
typedef ElementType_< ResultTypeElementType
 Resulting element type.
 
typedef IfTrue_< useAssign, const ResultType, const SVecForEachExpr & > CompositeType
 Data type for composite expression templates.
 
typedef If_< IsExpression< VT >, const VT, const VT & > Operand
 Composite data type of the sparse vector expression.
 
typedef OP Operation
 Data type of the custom unary operation.
 
typedef SVecForEachExpr< VT, OP, TF > VectorType
 Type of the vector.
 

Public Member Functions

 SVecForEachExpr (const VT &sv, OP op) noexcept
 Constructor for the SVecForEachExpr class. More...
 
ReturnType operator[] (size_t index) const
 Subscript operator for the direct access to the vector elements. More...
 
ReturnType at (size_t index) const
 Checked access to the vector elements. More...
 
ConstIterator begin () const
 Returns an iterator to the first non-zero element of the sparse vector. More...
 
ConstIterator end () const
 Returns an iterator just past the last non-zero element of the sparse vector. More...
 
size_t size () const noexcept
 Returns the current size/dimension of the vector. More...
 
size_t nonZeros () const
 Returns the number of non-zero elements in the sparse vector. More...
 
ConstIterator find (size_t index) const
 Searches for a specific vector element. More...
 
ConstIterator lowerBound (size_t index) const
 Returns an iterator to the first index not less then the given index. More...
 
ConstIterator upperBound (size_t index) const
 Returns an iterator to the first index greater then the given index. More...
 
Operand operand () const noexcept
 Returns the sparse vector operand. More...
 
Operation operation () const
 Returns a copy of the custom operation. More...
 
template<typename T >
bool canAlias (const T *alias) const noexcept
 Returns whether the expression can alias with the given address alias. More...
 
template<typename T >
bool isAliased (const T *alias) const noexcept
 Returns whether the expression is aliased with the given address alias. More...
 
bool canSMPAssign () const noexcept
 Returns whether the expression can be used in SMP assignments. More...
 
BLAZE_ALWAYS_INLINE VectorTypeoperator~ () noexcept
 Conversion operator for non-constant vectors. More...
 
BLAZE_ALWAYS_INLINE const VectorTypeoperator~ () const noexcept
 Conversion operator for constant vectors. More...
 

Public Attributes

decltype(std::declval< OP >()(std::declval< RN >())) typedef ReturnType
 Return type for expression template evaluations.
 

Private Types

enum  : bool { useAssign = RequiresEvaluation<VT>::value }
 Compilation switch for the serial evaluation strategy of the for-each expression. More...
 
typedef ResultType_< VT > RT
 Result type of the sparse vector expression.
 
typedef ReturnType_< VT > RN
 Return type of the sparse vector expression.
 

Private Attributes

Operand sv_
 Sparse vector of the for-each expression.
 
Operation op_
 The custom unary operation.
 

Detailed Description

template<typename VT, typename OP, bool TF>
class blaze::SVecForEachExpr< VT, OP, TF >

Expression object for the sparse vector forEach() function.

The SVecForEachExpr class represents the compile time expression for the evaluation of a custom operation on each element of a sparse vector via the forEach() function.

Member Enumeration Documentation

template<typename VT , typename OP , bool TF>
anonymous enum : bool
private

Compilation switch for the serial evaluation strategy of the for-each expression.

The useAssign compile time constant expression represents a compilation switch for the serial evaluation strategy of the for-each expression. In case the given sparse vector expression of type VT requires an intermediate evaluation, useAssign will be set to 1 and the for-each expression will be evaluated via the assign function family. Otherwise useAssign will be set to 0 and the expression will be evaluated via the subscript operator.

Constructor & Destructor Documentation

template<typename VT , typename OP , bool TF>
blaze::SVecForEachExpr< VT, OP, TF >::SVecForEachExpr ( const VT &  sv,
OP  op 
)
inlineexplicitnoexcept

Constructor for the SVecForEachExpr class.

Parameters
svThe sparse vector operand of the for-each expression.
opThe custom unary operation.

Member Function Documentation

template<typename VT , typename OP , bool TF>
ReturnType blaze::SVecForEachExpr< VT, OP, TF >::at ( size_t  index) const
inline

Checked access to the vector elements.

Parameters
indexAccess index. The index has to be in the range $[0..N-1]$.
Returns
The resulting value.
Exceptions
std::out_of_rangeInvalid vector access index.
template<typename VT , typename OP , bool TF>
ConstIterator blaze::SVecForEachExpr< VT, OP, TF >::begin ( ) const
inline

Returns an iterator to the first non-zero element of the sparse vector.

Returns
Iterator to the first non-zero element of the sparse vector.
template<typename VT , typename OP , bool TF>
template<typename T >
bool blaze::SVecForEachExpr< VT, OP, TF >::canAlias ( const T *  alias) const
inlinenoexcept

Returns whether the expression can alias with the given address alias.

Parameters
aliasThe alias to be checked.
Returns
true in case the expression can alias, false otherwise.
template<typename VT , typename OP , bool TF>
bool blaze::SVecForEachExpr< VT, OP, TF >::canSMPAssign ( ) const
inlinenoexcept

Returns whether the expression can be used in SMP assignments.

Returns
true in case the expression can be used in SMP assignments, false if not.
template<typename VT , typename OP , bool TF>
ConstIterator blaze::SVecForEachExpr< VT, OP, TF >::end ( ) const
inline

Returns an iterator just past the last non-zero element of the sparse vector.

Returns
Iterator just past the last non-zero element of the sparse vector.
template<typename VT , typename OP , bool TF>
ConstIterator blaze::SVecForEachExpr< VT, OP, TF >::find ( size_t  index) const
inline

Searches for a specific vector element.

Parameters
indexThe index of the search element.
Returns
Iterator to the element in case the index is found, end() iterator otherwise.
template<typename VT , typename OP , bool TF>
template<typename T >
bool blaze::SVecForEachExpr< VT, OP, TF >::isAliased ( const T *  alias) const
inlinenoexcept

Returns whether the expression is aliased with the given address alias.

Parameters
aliasThe alias to be checked.
Returns
true in case an alias effect is detected, false otherwise.
template<typename VT , typename OP , bool TF>
ConstIterator blaze::SVecForEachExpr< VT, OP, TF >::lowerBound ( size_t  index) const
inline

Returns an iterator to the first index not less then the given index.

Parameters
indexThe index of the search element.
Returns
Iterator to the first index not less then the given index, end() iterator otherwise.
template<typename VT , typename OP , bool TF>
size_t blaze::SVecForEachExpr< VT, OP, TF >::nonZeros ( ) const
inline

Returns the number of non-zero elements in the sparse vector.

Returns
The number of non-zero elements in the sparse vector.
template<typename VT , typename OP , bool TF>
Operand blaze::SVecForEachExpr< VT, OP, TF >::operand ( ) const
inlinenoexcept

Returns the sparse vector operand.

Returns
The sparse vector operand.
template<typename VT , typename OP , bool TF>
Operation blaze::SVecForEachExpr< VT, OP, TF >::operation ( ) const
inline

Returns a copy of the custom operation.

Returns
A copy of the custom operation.
template<typename VT , typename OP , bool TF>
ReturnType blaze::SVecForEachExpr< VT, OP, TF >::operator[] ( size_t  index) const
inline

Subscript operator for the direct access to the vector elements.

Parameters
indexAccess index. The index has to be in the range $[0..N-1]$.
Returns
The resulting value.
BLAZE_ALWAYS_INLINE VectorType& blaze::Vector< SVecForEachExpr< VT, OP, TF > , TF >::operator~ ( )
inlinenoexceptinherited

Conversion operator for non-constant vectors.

Returns
Reference of the actual type of the vector.
BLAZE_ALWAYS_INLINE const VectorType& blaze::Vector< SVecForEachExpr< VT, OP, TF > , TF >::operator~ ( ) const
inlinenoexceptinherited

Conversion operator for constant vectors.

Returns
Const reference of the actual type of the vector.
template<typename VT , typename OP , bool TF>
size_t blaze::SVecForEachExpr< VT, OP, TF >::size ( ) const
inlinenoexcept

Returns the current size/dimension of the vector.

Returns
The size of the vector.
template<typename VT , typename OP , bool TF>
ConstIterator blaze::SVecForEachExpr< VT, OP, TF >::upperBound ( size_t  index) const
inline

Returns an iterator to the first index greater then the given index.

Parameters
indexThe index of the search element.
Returns
Iterator to the first index greater then the given index, end() iterator otherwise.

The documentation for this class was generated from the following files: