35#ifndef _BLAZE_MATH_EXPRESSIONS_SVECTRANSPOSER_H_
36#define _BLAZE_MATH_EXPRESSIONS_SVECTRANSPOSER_H_
119 return const_cast<const VT&
>(
sv_ )[index];
131 if( index >=
sv_.size() ) {
134 return (*
this)[index];
203 inline size_t size() const noexcept {
214 return sv_.capacity();
224 return sv_.nonZeros();
251 return sv_.insert( index, value );
269 return sv_.find( index );
283 sv_.reserve( nonzeros );
313 sv_.append( index, value, check );
335 template<
typename Other >
336 inline bool canAlias(
const Other* alias )
const noexcept
338 return sv_.canAlias( alias );
348 template<
typename Other >
349 inline bool isAliased(
const Other* alias )
const noexcept
351 return sv_.isAliased( alias );
362 return sv_.canSMPAssign();
377 template<
typename VT2 >
400 size_t nonzeros( 2UL*
sv_.capacity()+1UL );
401 nonzeros =
max( nonzeros, 7UL );
402 nonzeros =
min( nonzeros,
sv_.size() );
461template<
typename VT,
bool TF >
462struct Size< SVecTransposer<VT,TF>, 0UL >
463 :
public Size<VT,0UL>
479template<
typename VT,
bool TF >
480struct MaxSize< SVecTransposer<VT,TF>, 0UL >
481 :
public MaxSize<VT,0UL>
Header file for auxiliary alias declarations.
typename T::ConstReference ConstReference_t
Alias declaration for nested ConstReference type definitions.
Definition: Aliases.h:170
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition: Aliases.h:470
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition: Aliases.h:450
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition: Aliases.h:190
typename T::Iterator Iterator_t
Alias declaration for nested Iterator type definitions.
Definition: Aliases.h:210
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.
Definition: Aliases.h:130
typename T::Reference Reference_t
Alias declaration for nested Reference type definitions.
Definition: Aliases.h:390
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition: Aliases.h:550
Header file for run time assertion macros.
Header file for the isDefault shim.
Deactivation of problematic macros.
Header file for the MaxSize type trait.
Expression object for the transposition of a sparse vector.
Definition: SVecTransposer.h:77
ElementType_t< VT > ElementType
Resulting element type.
Definition: SVecTransposer.h:84
Iterator insert(size_t index, const ElementType &value)
Inserting an element into the sparse vector.
Definition: SVecTransposer.h:250
ConstReference at(size_t index) const
Checked access to the vector elements.
Definition: SVecTransposer.h:130
Iterator begin()
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecTransposer.h:143
ResultType_t< VT > TransposeType
Transpose type for expression template evaluations.
Definition: SVecTransposer.h:83
bool canAlias(const Other *alias) const noexcept
Returns whether the vector can alias with the given address alias.
Definition: SVecTransposer.h:336
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: SVecTransposer.h:98
ConstIterator cbegin() const
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecTransposer.h:163
size_t capacity() const noexcept
Returns the maximum capacity of the vector.
Definition: SVecTransposer.h:213
ConstIterator end() const
Returns an iterator just past the last non-zero element of the sparse vector.
Definition: SVecTransposer.h:183
ConstReference_t< VT > ConstReference
Reference to a constant matrix value.
Definition: SVecTransposer.h:88
ConstIterator cend() const
Returns an iterator just past the last non-zero element of the sparse vector.
Definition: SVecTransposer.h:193
void reset()
Resets the vector elements.
Definition: SVecTransposer.h:233
ConstReference operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecTransposer.h:117
size_t nonZeros() const
Returns the number of non-zero elements in the vector.
Definition: SVecTransposer.h:223
ConstIterator_t< VT > ConstIterator
Iterator over constant elements.
Definition: SVecTransposer.h:90
Iterator_t< VT > Iterator
Iterator over non-constant elements.
Definition: SVecTransposer.h:89
Iterator find(size_t index)
Inserting an element into the sparse vector.
Definition: SVecTransposer.h:268
ReturnType_t< VT > ReturnType
Return type for expression template evaluations.
Definition: SVecTransposer.h:85
void reserve(size_t nonzeros)
Setting the minimum capacity of the sparse vector.
Definition: SVecTransposer.h:282
ConstIterator begin() const
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecTransposer.h:153
TransposeType_t< VT > ResultType
Result type for expression template evaluations.
Definition: SVecTransposer.h:82
bool canSMPAssign() const noexcept
Returns whether the vector can be used in SMP assignments.
Definition: SVecTransposer.h:360
VT & sv_
The sparse vector operand.
Definition: SVecTransposer.h:411
Reference_t< VT > Reference
Reference to a non-constant matrix value.
Definition: SVecTransposer.h:87
SVecTransposer(VT &sv) noexcept
Constructor for the SVecTransposer class.
Definition: SVecTransposer.h:106
void assign(const Vector< VT2, TF > &rhs)
Implementation of the transpose assignment of a vector.
Definition: SVecTransposer.h:378
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SVecTransposer.h:203
void append(size_t index, const ElementType &value, bool check=false)
Appending an element to the sparse vector.
Definition: SVecTransposer.h:312
bool isAliased(const Other *alias) const noexcept
Returns whether the vector is aliased with the given address alias.
Definition: SVecTransposer.h:349
Iterator end()
Returns an iterator just past the last non-zero element of the sparse vector.
Definition: SVecTransposer.h:173
size_t extendCapacity() const noexcept
Calculating a new vector capacity.
Definition: SVecTransposer.h:395
bool isIntact() const noexcept
Returns whether the invariants of the vector are intact.
Definition: SVecTransposer.h:322
Base class for sparse vectors.
Definition: SparseVector.h:72
Base class for N-dimensional vectors.
Definition: Vector.h:82
Constraint on the data type.
Constraint on the data type.
Header file for the SparseVector base class.
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1339
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1375
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:207
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.
Definition: TransposeFlag.h:63
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.
Definition: Computation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: SparseVector.h:61
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition: Assert.h:117
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
Header file for the exception macros of the math module.
Constraint on the data type.
Header file for the Size type trait.
Header file for basic type definitions.
Header file for the generic max algorithm.
Header file for the generic min algorithm.