35 #ifndef _BLAZE_MATH_EXPRESSIONS_SVECTRANSEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SVECTRANSEXPR_H_
92 class SVecTransExpr :
public SparseVector< SVecTransExpr<VT,TF>, TF >
93 ,
private VecTransExpr
94 ,
private If< IsComputation<VT>, Computation, EmptyType >::Type
112 template<
typename VT2 >
115 enum :
bool { value = useAssign };
127 template<
typename VT2 >
128 struct UseSMPAssign {
129 enum :
bool { value = VT2::smpAssignable && useAssign };
151 enum :
bool { smpAssignable = VT::smpAssignable };
165 typedef typename std::iterator_traits<IteratorType>::value_type
ValueType;
166 typedef typename std::iterator_traits<IteratorType>::pointer
PointerType;
167 typedef typename std::iterator_traits<IteratorType>::reference
ReferenceType;
168 typedef typename std::iterator_traits<IteratorType>::difference_type
DifferenceType;
306 inline ReturnType
at(
size_t index )
const {
307 if( index >=
sv_.size() ) {
310 return (*
this)[index];
339 inline size_t size() const noexcept {
350 return sv_.nonZeros();
406 template<
typename T >
407 inline bool canAlias(
const T* alias )
const noexcept {
408 return sv_.canAlias( alias );
418 template<
typename T >
419 inline bool isAliased(
const T* alias )
const noexcept {
420 return sv_.isAliased( alias );
430 return sv_.canSMPAssign();
453 template<
typename VT2 >
462 assign( tmp, rhs.sv_ );
481 template<
typename VT2 >
490 assign( tmp, rhs.sv_ );
509 template<
typename VT2 >
510 friend inline EnableIf_< UseAssign<VT2> >
511 addAssign( DenseVector<VT2,TF>& lhs,
const SVecTransExpr& rhs )
517 DVecTransposer<VT2,!TF> tmp( ~lhs );
518 addAssign( tmp, rhs.sv_ );
541 template<
typename VT2 >
542 friend inline EnableIf_< UseAssign<VT2> >
543 subAssign( DenseVector<VT2,TF>& lhs,
const SVecTransExpr& rhs )
549 DVecTransposer<VT2,!TF> tmp( ~lhs );
550 subAssign( tmp, rhs.sv_ );
573 template<
typename VT2 >
574 friend inline EnableIf_< UseAssign<VT2> >
575 multAssign( DenseVector<VT2,TF>& lhs,
const SVecTransExpr& rhs )
581 DVecTransposer<VT2,!TF> tmp( ~lhs );
582 multAssign( tmp, rhs.sv_ );
605 template<
typename VT2 >
606 friend inline EnableIf_< UseSMPAssign<VT2> >
613 DVecTransposer<VT2,!TF> tmp( ~lhs );
633 template<
typename VT2 >
634 friend inline EnableIf_< UseSMPAssign<VT2> >
641 SVecTransposer<VT2,!TF> tmp( ~lhs );
661 template<
typename VT2 >
662 friend inline EnableIf_< UseSMPAssign<VT2> >
669 DVecTransposer<VT2,!TF> tmp( ~lhs );
693 template<
typename VT2 >
694 friend inline EnableIf_< UseSMPAssign<VT2> >
701 DVecTransposer<VT2,!TF> tmp( ~lhs );
726 template<
typename VT2 >
727 friend inline EnableIf_< UseSMPAssign<VT2> >
734 DVecTransposer<VT2,!TF> tmp( ~lhs );
780 template<
typename VT
819 template<
typename VT
821 inline typename SVecTransExpr<VT,TF>::Operand
trans(
const SVecTransExpr<VT,TF>& sv )
841 template<
typename VT,
bool TF >
842 struct Size< SVecTransExpr<VT,TF> > :
public Size<VT>
858 template<
typename VT >
859 struct SVecTransExprTrait< SVecTransExpr<VT,false> >
863 using Type = If_< And< IsSparseVector<VT>, IsRowVector<VT> >
864 , Operand_< SVecTransExpr<VT,false> >
874 template<
typename VT >
875 struct TSVecTransExprTrait< SVecTransExpr<VT,true> >
879 using Type = If_< And< IsSparseVector<VT>, IsColumnVector<VT> >
880 , Operand_< SVecTransExpr<VT,true> >
890 template<
typename VT,
bool TF,
bool AF >
891 struct SubvectorExprTrait< SVecTransExpr<VT,TF>, AF >
895 using Type = TransExprTrait_< SubvectorExprTrait_<const VT,AF> >;
Header file for auxiliary alias declarations.
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SVecTransExpr.h:339
Operand sv_
Sparse vector of the transposition expression.
Definition: SVecTransExpr.h:436
PointerType pointer
Pointer return type.
Definition: SVecTransExpr.h:173
Header file for basic type definitions.
Header file for the SparseVector base class.
ResultType_< VT > TransposeType
Transpose type for expression template evaluations.
Definition: SVecTransExpr.h:138
ConstIterator & operator++()
Pre-increment operator.
Definition: SVecTransExpr.h:191
EnableIf_< IsDenseMatrix< MT1 > > 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
ConstIterator begin() const
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecTransExpr.h:319
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SVecTransExpr.h:407
TransposeType_< VT > ResultType
Result type for expression template evaluations.
Definition: SVecTransExpr.h:137
std::iterator_traits< IteratorType >::pointer PointerType
Pointer return type.
Definition: SVecTransExpr.h:166
ValueType value_type
Type of the underlying pointers.
Definition: SVecTransExpr.h:172
Header file for the IsRowVector type trait.
EnableIf_< IsDenseVector< VT1 > > 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:193
Header file for the And class template.
Expression object for sparse vector transpositions.The SVecTransExpr class represents the compile tim...
Definition: Forward.h:125
Header file for the Computation base class.
ConstIterator_< RemoveReference_< Operand > > IteratorType
Iterator type of the sparse vector expression.
Definition: SVecTransExpr.h:162
Header file for the RequiresEvaluation type trait.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SVecTransExpr.h:254
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
EnableIf_< IsDenseMatrix< MT1 > > 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
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SVecTransExpr.h:164
Expression object for the transposition of a dense vector.The DVecTransposer class is a wrapper objec...
Definition: DVecTransposer.h:77
ConstIterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition: SVecTransExpr.h:372
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
ElementType_< VT > ElementType
Resulting element type.
Definition: SVecTransExpr.h:139
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:343
ReturnType_< VT > ReturnType
Return type for expression template evaluations.
Definition: SVecTransExpr.h:140
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:72
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SVecTransExpr.h:243
const ConstIterator * operator->() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecTransExpr.h:212
size_t index() const
Access to the current index of the sparse element.
Definition: SVecTransExpr.h:232
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
Header file for the dense vector transposer.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
std::iterator_traits< IteratorType >::value_type ValueType
Type of the underlying pointers.
Definition: SVecTransExpr.h:165
CompositeType_< VT > CT
Composite type of the sparse vector expression.
Definition: SVecTransExpr.h:98
EnableIf_< IsDenseMatrix< MT1 > > 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
IteratorCategory iterator_category
The iterator category.
Definition: SVecTransExpr.h:171
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Iterator over the elements of the sparse vector absolute value expression.
Definition: SVecTransExpr.h:157
std::iterator_traits< IteratorType >::reference ReferenceType
Reference return type.
Definition: SVecTransExpr.h:167
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Expression object for the transposition of a sparse vector.The SVecTransposer class is a wrapper obje...
Definition: Forward.h:126
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:61
ConstIterator find(size_t index) const
Searches for a specific vector element.
Definition: SVecTransExpr.h:360
If_< IsExpression< VT >, const VT, const VT & > Operand
Composite data type of the sparse vector expression.
Definition: SVecTransExpr.h:146
DifferenceType difference_type
Difference between two iterators.
Definition: SVecTransExpr.h:175
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SVecTransExpr.h:265
Header file for the exception macros of the math module.
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
Header file for the EnableIf class template.
ReturnType value() const
Access to the current value of the sparse element.
Definition: SVecTransExpr.h:222
Operand operand() const noexcept
Returns the sparse vector operand.
Definition: SVecTransExpr.h:395
Header file for the IsSparseVector type trait.
Header file for the VecTransExpr base class.
Header file for run time assertion macros.
SVecTransExpr(const VT &sv) noexcept
Constructor for the SVecTransExpr class.
Definition: SVecTransExpr.h:282
IfTrue_< useAssign, const ResultType, const SVecTransExpr & > CompositeType
Data type for composite expression templates.
Definition: SVecTransExpr.h:143
Utility type for generic codes.
std::iterator_traits< IteratorType >::difference_type DifferenceType
Difference between two iterators.
Definition: SVecTransExpr.h:168
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:160
size_t nonZeros() const
Returns the number of non-zero elements in the sparse vector.
Definition: SVecTransExpr.h:349
Header file for the TransExprTrait class template.
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecTransExpr.h:306
ConstIterator(IteratorType it)
Constructor for the ConstIterator class.
Definition: SVecTransExpr.h:181
#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:81
ConstIterator end() const
Returns an iterator just past the last non-zero element of the sparse vector.
Definition: SVecTransExpr.h:329
Header file for the RemoveReference type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
Header file for the SVecTransExprTrait class template.
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SVecTransExpr.h:419
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecTransExpr.h:293
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
Header file for the sparse vector transposer.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SVecTransExpr.h:429
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:950
ConstIterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition: SVecTransExpr.h:384
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:110
#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
Header file for the SubvectorExprTrait class template.
Header file for the TSVecTransExprTrait class template.
SVecTransExpr< VT, TF > This
Type of this SVecTransExpr instance.
Definition: SVecTransExpr.h:136
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
ReferenceType reference
Reference return type.
Definition: SVecTransExpr.h:174
const ValueType operator*() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecTransExpr.h:202
Header file for the IsColumnVector type trait.
Header file for the empty type.
Header file for the Size type trait.
#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
IteratorType it_
Iterator over the elements of the sparse vector expression.
Definition: SVecTransExpr.h:272
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.