35#ifndef _BLAZE_MATH_EXPRESSIONS_SVECREPEATEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_SVECREPEATEXPR_H_
82 :
public VecRepeatExpr< SparseVector< SVecRepeatExpr<VT,TF,CRAs...>, TF >, CRAs... >
83 ,
private If_t< IsComputation_v<VT>, Computation, Transformation >
121 template<
typename... RRAs >
136 return sv_[index%
sv_.size()];
148 if( index >=
size() ) {
151 return (*
this)[index];
160 inline size_t size() const noexcept {
161 return sv_.size() * this->
template repetitions<0UL>();
171 return sv_.nonZeros() * this->
template repetitions<0UL>();
186 using DataType::repetitions;
195 template<
typename T >
196 inline bool canAlias(
const T* alias )
const noexcept {
207 template<
typename T >
208 inline bool isAliased(
const T* alias )
const noexcept {
209 return sv_.isAliased( alias );
240 template<
typename VT2 >
249 const size_t reps( rhs.template repetitions<0UL>() );
250 const size_t size( x.size() );
252 for(
size_t rep=0UL; rep<reps; ++rep ) {
271 template<
typename VT2 >
280 const size_t reps( rhs.template repetitions<0UL>() );
281 const size_t size( x.size() );
283 (*lhs).reserve( reps*
size );
285 for(
size_t rep=0UL; rep<reps; ++rep ) {
286 for(
auto element=x.begin(); element!=x.end(); ++element ) {
287 (*lhs).append( rep*
size+element->index(), element->value(),
true );
306 template<
typename VT2 >
307 friend inline void addAssign( DenseVector<VT2,TF>& lhs,
const SVecRepeatExpr& rhs )
313 CompositeType_t<VT> x(
serial( rhs.sv_ ) );
315 const size_t reps( rhs.template repetitions<0UL>() );
316 const size_t size( x.size() );
318 for(
size_t rep=0UL; rep<reps; ++rep ) {
341 template<
typename VT2 >
342 friend inline void subAssign( DenseVector<VT2,TF>& lhs,
const SVecRepeatExpr& rhs )
348 CompositeType_t<VT> x(
serial( rhs.sv_ ) );
350 const size_t reps( rhs.template repetitions<0UL>() );
351 const size_t size( x.size() );
353 for(
size_t rep=0UL; rep<reps; ++rep ) {
376 template<
typename VT2 >
377 friend inline void multAssign( DenseVector<VT2,TF>& lhs,
const SVecRepeatExpr& rhs )
383 CompositeType_t<VT> x(
serial( rhs.sv_ ) );
385 const size_t reps( rhs.template repetitions<0UL>() );
386 const size_t size( x.size() );
388 for(
size_t rep=0UL; rep<reps; ++rep ) {
450 return ReturnType( *sv, repetitions );
488 return ReturnType( *sv );
508inline decltype(
auto)
repeat(
const SparseVector<VT,TF>& sv,
size_t repetitions )
514 using ReturnType =
const SVecRepeatExpr<VT,TF,R0>;
515 return ReturnType( *sv );
Header file for auxiliary alias declarations.
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition Aliases.h:470
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition Aliases.h:110
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition Aliases.h:550
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition Aliases.h:190
Header file for the blaze::checked and blaze::unchecked instances.
Header file for the function trace functionality.
Header file for the If class template.
Header file for the IsExpression type trait class.
Header file for the implementation of the RepeatExprData class template.
Header file for the repeat trait.
Base class for N-dimensional dense vectors.
Definition DenseVector.h:77
Auxiliary class template for the data members of repeater expression classes.
Definition RepeatExprData.h:65
Expression object for the sparse vector repeat() function.
Definition SVecRepeatExpr.h:85
Operand operand() const noexcept
Returns the sparse vector operand.
Definition SVecRepeatExpr.h:180
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition SVecRepeatExpr.h:218
RepeatTrait_t< VT, CRAs... > ResultType
Definition SVecRepeatExpr.h:99
size_t nonZeros() const
Returns the number of non-zero elements in the sparse vector.
Definition SVecRepeatExpr.h:170
RepeatExprData< 1UL, CRAs... > DataType
The type of the RepeatExprData base class.
Definition SVecRepeatExpr.h:88
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition SVecRepeatExpr.h:196
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition SVecRepeatExpr.h:147
static constexpr bool smpAssignable
Definition SVecRepeatExpr.h:112
const ResultType CompositeType
Definition SVecRepeatExpr.h:103
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition SVecRepeatExpr.h:208
Operand sv_
Definition SVecRepeatExpr.h:225
VecRepeatExpr< SparseVector< This, TF >, CRAs... > BaseType
Definition SVecRepeatExpr.h:97
ElementType_t< VT > ElementType
Definition SVecRepeatExpr.h:101
size_t size() const noexcept
Definition SVecRepeatExpr.h:160
ReturnType_t< VT > ReturnType
Definition SVecRepeatExpr.h:102
TransposeType_t< ResultType > TransposeType
Definition SVecRepeatExpr.h:100
SVecRepeatExpr< VT, TF, CRAs... > This
Type of this SVecRepeatExpr instance.
Definition SVecRepeatExpr.h:94
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition SVecRepeatExpr.h:134
SVecRepeatExpr(const VT &sv, RRAs... args) noexcept
Constructor for the SVecRepeatExpr class.
Definition SVecRepeatExpr.h:122
If_t< IsExpression_v< VT >, const VT, const VT & > Operand
Definition SVecRepeatExpr.h:106
Base class for sparse vectors.
Definition SparseVector.h:72
Constraint on the data type.
Header file for the Computation base class.
Header file for the SparseVector base class.
Header file for the VecRepeatExpr base class.
decltype(auto) repeat(const DenseMatrix< MT, SO > &dm, size_t m, size_t n)
Repeats the given dense matrix.
Definition DMatRepeatExpr.h:543
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition DMatSerialExpr.h:812
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.
Definition TransposeFlag.h:63
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition SparseVector.h:61
typename RepeatTrait< T, CRAs... >::Type RepeatTrait_t
Auxiliary alias declaration for the RepeatTrait type trait.
Definition RepeatTrait.h:151
constexpr bool IsExpression_v
Auxiliary variable template for the IsExpression type trait.
Definition IsExpression.h:114
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition Matrix.h:676
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition Assert.h:101
decltype(auto) subvector(Vector< VT, TF > &, RSAs...)
Creating a view on a specific subvector of the given vector.
Definition Subvector.h:158
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition MaybeUnused.h:81
#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
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition If.h:108
constexpr Unchecked unchecked
Global Unchecked instance.
Definition Check.h:146
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.
Header file for the serial shim.
Base class for all vector repeater expression templates.
Definition VecRepeatExpr.h:69
Header file for basic type definitions.
Subvector specialization for dense vectors.