35#ifndef _BLAZE_MATH_EXPRESSIONS_DVECREPEATEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_DVECREPEATEXPR_H_
83 :
public VecRepeatExpr< DenseVector< DVecRepeatExpr<VT,TF,CRAs...>, TF >, CRAs... >
84 ,
private If_t< IsComputation_v<VT>, Computation, Transformation >
125 template<
typename... RRAs >
140 return dv_[index%
dv_.size()];
152 if( index >=
size() ) {
155 return (*
this)[index];
164 inline size_t size() const noexcept {
165 return dv_.size() * this->
template repetitions<0UL>();
180 using DataType::repetitions;
189 template<
typename T >
190 inline bool canAlias(
const T* alias )
const noexcept {
191 return IsExpression_v<VT> &&
dv_.canAlias( alias );
201 template<
typename T >
202 inline bool isAliased(
const T* alias )
const noexcept {
203 return dv_.isAliased( alias );
213 return dv_.isAligned();
244 template<
typename VT2 >
253 const size_t reps( rhs.template repetitions<0UL>() );
254 const size_t size( x.size() );
256 for(
size_t rep=0UL; rep<reps; ++rep ) {
275 template<
typename VT2 >
284 const size_t reps( rhs.template repetitions<0UL>() );
285 const size_t size( x.size() );
288 (*lhs).reserve( reps*
size );
290 for(
size_t rep=0UL; rep<reps; ++rep ) {
291 for(
size_t i=0UL; i<
size; ++i ) {
292 (*lhs).append( rep*
size+i, x[i],
true );
311 template<
typename VT2 >
312 friend inline void addAssign( DenseVector<VT2,TF>& lhs,
const DVecRepeatExpr& rhs )
318 CompositeType_t<VT> x(
serial( rhs.dv_ ) );
320 const size_t reps( rhs.template repetitions<0UL>() );
321 const size_t size( x.size() );
323 for(
size_t rep=0UL; rep<reps; ++rep ) {
346 template<
typename VT2 >
347 friend inline void subAssign( DenseVector<VT2,TF>& lhs,
const DVecRepeatExpr& rhs )
353 CompositeType_t<VT> x(
serial( rhs.dv_ ) );
355 const size_t reps( rhs.template repetitions<0UL>() );
356 const size_t size( x.size() );
358 for(
size_t rep=0UL; rep<reps; ++rep ) {
381 template<
typename VT2 >
382 friend inline void multAssign( DenseVector<VT2,TF>& lhs,
const DVecRepeatExpr& rhs )
388 CompositeType_t<VT> x(
serial( rhs.dv_ ) );
390 const size_t reps( rhs.template repetitions<0UL>() );
391 const size_t size( x.size() );
393 for(
size_t rep=0UL; rep<reps; ++rep ) {
416 template<
typename VT2 >
417 friend inline void divAssign( DenseVector<VT2,TF>& lhs,
const DVecRepeatExpr& rhs )
423 CompositeType_t<VT> x(
serial( rhs.dv_ ) );
425 const size_t reps( rhs.template repetitions<0UL>() );
426 const size_t size( x.size() );
428 for(
size_t rep=0UL; rep<reps; ++rep ) {
490 return ReturnType( *dv, repetitions );
528 return ReturnType( *dv );
548inline decltype(
auto)
repeat(
const DenseVector<VT,TF>& dv,
size_t repetitions )
554 using ReturnType =
const DVecRepeatExpr<VT,TF,R0>;
555 return ReturnType( *dv );
Header file for auxiliary alias declarations.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition: Aliases.h:110
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition: Aliases.h:470
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 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 MAYBE_UNUSED function template.
Header file for the implementation of the RepeatExprData class template.
Header file for the repeat trait.
Expression object for the dense vector repeat() function.
Definition: DVecRepeatExpr.h:86
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecRepeatExpr.h:116
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecRepeatExpr.h:101
RepeatExprData< 1UL, CRAs... > DataType
The type of the RepeatExprData base class.
Definition: DVecRepeatExpr.h:89
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecRepeatExpr.h:164
If_t< IsExpression_v< VT >, const VT, const VT & > Operand
Composite data type of the dense vector expression.
Definition: DVecRepeatExpr.h:107
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecRepeatExpr.h:190
Operand dv_
Dense vector of the repeater expression.
Definition: DVecRepeatExpr.h:229
ReturnType_t< VT > ReturnType
Return type for expression template evaluations.
Definition: DVecRepeatExpr.h:103
const ResultType CompositeType
Data type for composite expression templates.
Definition: DVecRepeatExpr.h:104
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecRepeatExpr.h:212
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecRepeatExpr.h:138
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecRepeatExpr.h:222
RepeatTrait_t< VT, CRAs... > ResultType
Result type for expression template evaluations.
Definition: DVecRepeatExpr.h:100
DVecRepeatExpr(const VT &dv, RRAs... args) noexcept
Constructor for the DVecRepeatExpr class.
Definition: DVecRepeatExpr.h:126
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecRepeatExpr.h:151
Operand operand() const noexcept
Returns the dense vector operand.
Definition: DVecRepeatExpr.h:174
ElementType_t< VT > ElementType
Resulting element type.
Definition: DVecRepeatExpr.h:102
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecRepeatExpr.h:202
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecRepeatExpr.h:113
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
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 DenseVector base class.
Header file for the VecRepeatExpr base class.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
decltype(auto) repeat(const DenseVector< VT, TF > &dv)
Repeats the given dense vector.
Definition: DVecRepeatExpr.h:523
#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_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: DenseVector.h:61
typename RepeatTrait< T, CRAs... >::Type RepeatTrait_t
Auxiliary alias declaration for the RepeatTrait type trait.
Definition: RepeatTrait.h:151
#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
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
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.