35#ifndef _BLAZE_MATH_EXPRESSIONS_SVECTRANSEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_SVECTRANSEXPR_H_
85 :
public VecTransExpr< SparseVector< SVecTransExpr<VT,TF>, TF > >
86 ,
private If_t< IsComputation_v<VT>, Computation, Transformation >
102 static constexpr bool useAssign = RequiresEvaluation_v<VT>;
106 template<
typename VT2 >
107 static constexpr bool UseAssign_v =
useAssign;
119 template<
typename VT2 >
120 static constexpr bool UseSMPAssign_v = ( VT2::smpAssignable &&
useAssign );
182 if( index >=
sv_.size() ) {
185 return (*
this)[index];
214 inline size_t size() const noexcept {
225 return sv_.nonZeros();
281 template<
typename T >
282 inline bool canAlias(
const T* alias )
const noexcept {
283 return sv_.canAlias( alias );
293 template<
typename T >
294 inline bool isAliased(
const T* alias )
const noexcept {
295 return sv_.isAliased( alias );
305 return sv_.canSMPAssign();
328 template<
typename VT2 >
337 assign( tmp, rhs.sv_ );
356 template<
typename VT2 >
365 assign( tmp, rhs.sv_ );
384 template<
typename VT2 >
385 friend inline auto addAssign( DenseVector<VT2,TF>& lhs,
const SVecTransExpr& rhs )
386 -> EnableIf_t< UseAssign_v<VT2> >
392 DVecTransposer<VT2,!TF> tmp( *lhs );
393 addAssign( tmp, rhs.sv_ );
416 template<
typename VT2 >
417 friend inline auto subAssign( DenseVector<VT2,TF>& lhs,
const SVecTransExpr& rhs )
418 -> EnableIf_t< UseAssign_v<VT2> >
424 DVecTransposer<VT2,!TF> tmp( *lhs );
425 subAssign( tmp, rhs.sv_ );
448 template<
typename VT2 >
449 friend inline auto multAssign( DenseVector<VT2,TF>& lhs,
const SVecTransExpr& rhs )
450 -> EnableIf_t< UseAssign_v<VT2> >
456 DVecTransposer<VT2,!TF> tmp( *lhs );
457 multAssign( tmp, rhs.sv_ );
480 template<
typename VT2 >
482 -> EnableIf_t< UseSMPAssign_v<VT2> >
488 DVecTransposer<VT2,!TF> tmp( *lhs );
508 template<
typename VT2 >
510 -> EnableIf_t< UseSMPAssign_v<VT2> >
516 SVecTransposer<VT2,!TF> tmp( *lhs );
536 template<
typename VT2 >
538 -> EnableIf_t< UseSMPAssign_v<VT2> >
544 DVecTransposer<VT2,!TF> tmp( *lhs );
568 template<
typename VT2 >
570 -> EnableIf_t< UseSMPAssign_v<VT2> >
576 DVecTransposer<VT2,!TF> tmp( *lhs );
601 template<
typename VT2 >
603 -> EnableIf_t< UseSMPAssign_v<VT2> >
609 DVecTransposer<VT2,!TF> tmp( *lhs );
662 return ReturnType( *sv );
677inline decltype(
auto) transTo_backend(
const SparseVector<VT,TF>& sv,
FalseType )
695inline const VT& transTo_backend(
const SparseVector<VT,TF>& sv,
TrueType )
Header file for auxiliary alias declarations.
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::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 dense vector transposer.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Header file for the GetMemberType type trait.
Header file for the If class template.
Header file for the IntegralConstant class template.
Utility type for generic codes.
Header file for the IsExpression type trait class.
Deactivation of problematic macros.
Header file for the sparse vector transposer.
Expression object for the transposition of a dense vector.
Definition: DVecTransposer.h:81
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
Expression object for sparse vector transpositions.
Definition: SVecTransExpr.h:87
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SVecTransExpr.h:294
If_t< IsExpression_v< VT >, const VT, const VT & > Operand
Composite data type of the sparse vector expression.
Definition: SVecTransExpr.h:144
BLAZE_CREATE_GET_TYPE_MEMBER_TYPE_TRAIT(GetConstIterator, ConstIterator, INVALID_TYPE)
Definition of the GetConstIterator type trait.
ConstIterator end() const
Returns an iterator just past the last non-zero element of the sparse vector.
Definition: SVecTransExpr.h:204
ReturnType_t< VT > ReturnType
Return type for expression template evaluations.
Definition: SVecTransExpr.h:135
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecTransExpr.h:181
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecTransExpr.h:168
TransposeType_t< VT > ResultType
Result type for expression template evaluations.
Definition: SVecTransExpr.h:132
ResultType_t< VT > TransposeType
Transpose type for expression template evaluations.
Definition: SVecTransExpr.h:133
Operand sv_
Sparse vector of the transposition expression.
Definition: SVecTransExpr.h:311
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SVecTransExpr.h:304
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the transposition expression.
Definition: SVecTransExpr.h:102
size_t nonZeros() const
Returns the number of non-zero elements in the sparse vector.
Definition: SVecTransExpr.h:224
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SVecTransExpr.h:214
SVecTransExpr(const VT &sv) noexcept
Constructor for the SVecTransExpr class.
Definition: SVecTransExpr.h:157
GetConstIterator_t< VT > ConstIterator
Iterator over the elements of the dense vector.
Definition: SVecTransExpr.h:141
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SVecTransExpr.h:149
ConstIterator begin() const
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecTransExpr.h:194
ConstIterator find(size_t index) const
Searches for a specific vector element.
Definition: SVecTransExpr.h:235
ConstIterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition: SVecTransExpr.h:247
If_t< useAssign, const ResultType, const SVecTransExpr & > CompositeType
Data type for composite expression templates.
Definition: SVecTransExpr.h:138
ConstIterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition: SVecTransExpr.h:259
Operand operand() const noexcept
Returns the sparse vector operand.
Definition: SVecTransExpr.h:270
ElementType_t< VT > ElementType
Resulting element type.
Definition: SVecTransExpr.h:134
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SVecTransExpr.h:282
Expression object for the transposition of a sparse vector.
Definition: SVecTransposer.h:77
Base class for sparse vectors.
Definition: SparseVector.h:72
Constraint on the data type.
Constraint on the data type.
Header file for the Computation base class.
Header file for the SparseVector base class.
Header file for the VecTransExpr base class.
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766
decltype(auto) transTo(const DenseVector< VT, TF > &dv)
Conditional calculation of the transpose of the given dense vector.
Definition: DVecTransExpr.h:783
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.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
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector.
Definition: DenseVector.h:192
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
BoolConstant< true > TrueType
Type traits base class.
Definition: IntegralConstant.h:132
BoolConstant< false > FalseType
Type/value traits base class.
Definition: IntegralConstant.h:121
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition: If.h:108
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition: FunctionTrace.h:94
Header file for the exception macros of the math module.
Header file for all forward declarations for expression class templates.
Generic wrapper for a compile time constant integral value.
Definition: IntegralConstant.h:74
Base class for all vector transposition expression templates.
Definition: VecTransExpr.h:69
Header file for the RequiresEvaluation type trait.
Header file for basic type definitions.