35 #ifndef _BLAZE_MATH_EXPRESSIONS_SVECTRANSPOSER_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SVECTRANSPOSER_H_
72 class SVecTransposer :
public SparseVector< SVecTransposer<VT,TF>, TF >
93 enum { smpAssignable = VT::smpAssignable };
165 template<
typename Other >
182 template<
typename Other >
225 return sv_.insert( index, value );
243 return sv_.find( index );
257 sv_.reserve( nonzeros );
287 sv_.append( index, value, check );
297 template<
typename Other >
300 return sv_.canAlias( alias );
310 template<
typename Other >
313 return sv_.isAliased( alias );
328 template<
typename VT2 >
335 size_t nonzeros( 0UL );
337 for(
size_t i=0UL; i<
sv_.size(); ++i ) {
339 if( nonzeros++ ==
sv_.capacity() )
341 sv_.append( i, (~rhs)[i] );
358 template<
typename VT2 >
372 sv_.append( element->index(), element->value() );
390 size_t nonzeros( 2UL*
sv_.capacity()+1UL );
391 nonzeros = max( nonzeros, 7UL );
392 nonzeros = min( nonzeros,
sv_.size() );
431 template<
typename VT
451 template<
typename VT,
bool TF >
452 struct SubvectorTrait< SVecTransposer<VT,TF> >
Constraint on the data type.
Header file for mathematical functions.
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4579
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the SparseVector base class.
bool canAlias(const Other *alias) const
Returns whether the vector can alias with the given address alias.
Definition: SVecTransposer.h:298
void assign(const DenseVector< VT2, TF > &rhs)
Implementation of the transpose assignment of a dense vector.
Definition: SVecTransposer.h:329
size_t size() const
Returns the current size/dimension of the vector.
Definition: SVecTransposer.h:197
ConstIterator begin() const
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecTransposer.h:123
bool isDefault(const DynamicMatrix< Type, SO > &m)
Returns whether the given dense matrix is in default state.
Definition: DynamicMatrix.h:4622
VT::ElementType ElementType
Resulting element type.
Definition: SVecTransposer.h:79
ConstIterator cend() const
Returns an iterator just past the last non-zero element of the sparse vector.
Definition: SVecTransposer.h:153
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:118
Iterator find(size_t index)
Inserting an element into the sparse vector.
Definition: SVecTransposer.h:242
VT::TransposeType ResultType
Result type for expression template evaluations.
Definition: SVecTransposer.h:77
VT & sv_
The sparse vector operand.
Definition: SVecTransposer.h:401
void append(size_t index, const ElementType &value, bool check=false)
Appending an element to the sparse vector.
Definition: SVecTransposer.h:286
void reserve(size_t nonzeros)
Setting the minimum capacity of the sparse vector.
Definition: SVecTransposer.h:256
bool isAliased(const Other *alias) const
Returns whether the vector is aliased with the given address alias.
Definition: SVecTransposer.h:311
EnableIf< IsNumeric< Other >, SVecTransposer >::Type & operator/=(Other rhs)
Division assignment operator for the division of a vector by a scalar value ( ).
Definition: SVecTransposer.h:183
void assign(const SparseVector< VT2, TF > &rhs)
Implementation of the transpose assignment of a sparse vector.
Definition: SVecTransposer.h:359
ConstIterator cbegin() const
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecTransposer.h:133
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2388
Header file for the subvector trait.
Expression object for the transposition of a sparse vector.The SVecTransposer class is a wrapper obje...
Definition: Forward.h:119
VT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: SVecTransposer.h:80
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
Constraint on the data type.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2381
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2382
SVecTransposer(VT &sv)
Constructor for the SVecTransposer class.
Definition: SVecTransposer.h:101
VT::ConstReference ConstReference
Reference to a constant matrix value.
Definition: SVecTransposer.h:83
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2386
Header file for the EnableIf class template.
Header file for the IsNumeric type trait.
Iterator insert(size_t index, const ElementType &value)
Inserting an element into the sparse vector.
Definition: SVecTransposer.h:224
VT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: SVecTransposer.h:85
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2383
Header file for run time assertion macros.
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
EnableIf< IsNumeric< Other >, SVecTransposer >::Type & operator*=(Other rhs)
Multiplication assignment operator for the multiplication between a vector and a scalar value ( )...
Definition: SVecTransposer.h:166
const VT::ElementType max(const SparseVector< VT, TF > &sv)
Returns the largest element of the sparse vector.
Definition: SparseVector.h:405
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2387
Header file for the isDefault shim.
SVecTransposer< VT, TF > This
Type of this SVecTransposer instance.
Definition: SVecTransposer.h:76
VT::Reference Reference
Reference to a non-constant matrix value.
Definition: SVecTransposer.h:82
void reset()
Resets the vector elements.
Definition: SVecTransposer.h:207
VT::ResultType TransposeType
Transpose type for expression template evaluations.
Definition: SVecTransposer.h:78
ConstReference operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecTransposer.h:112
VT::Iterator Iterator
Iterator over non-constant elements.
Definition: SVecTransposer.h:84
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:105
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2379
Header file for basic type definitions.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2385
const VT::ElementType min(const SparseVector< VT, TF > &sv)
Returns the smallest element of the sparse vector.
Definition: SparseVector.h:348
const This & CompositeType
Data type for composite expression templates.
Definition: SVecTransposer.h:81
ConstIterator end() const
Returns an iterator just past the last non-zero element of the sparse vector.
Definition: SVecTransposer.h:143
#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:238
#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
size_t extendCapacity() const
Calculating a new vector capacity.
Definition: SVecTransposer.h:385