35#ifndef _BLAZE_MATH_EXPRESSIONS_DMATREPEATEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_DMATREPEATEXPR_H_
83 :
public MatRepeatExpr< DenseMatrix< DMatRepeatExpr<MT,SO,CRAs...>, SO >, CRAs... >
84 ,
private If_t< IsComputation_v<MT>, Computation, Transformation >
126 template<
typename... RRAs >
143 return dm_( i%
dm_.rows(), j%
dm_.columns() );
171 inline size_t rows() const noexcept {
172 return dm_.rows() * this->
template repetitions<0UL>();
182 return dm_.columns() * this->
template repetitions<1UL>();
197 using DataType::repetitions;
206 template<
typename T >
207 inline bool canAlias(
const T* alias )
const noexcept {
218 template<
typename T >
219 inline bool isAliased(
const T* alias )
const noexcept {
220 return dm_.isAliased( alias );
230 return dm_.isAligned();
262 template<
typename MT2
273 const size_t reps0( rhs.template repetitions<0UL>() );
274 const size_t reps1( rhs.template repetitions<1UL>() );
275 const size_t M( A.rows() );
276 const size_t N( A.columns() );
278 for(
size_t rep0=0UL; rep0<reps0; ++rep0 ) {
279 for(
size_t rep1=0UL; rep1<reps1; ++rep1 ) {
299 template<
typename MT2
310 const size_t reps0( rhs.template repetitions<0UL>() );
311 const size_t reps1( rhs.template repetitions<1UL>() );
312 const size_t M( A.rows() );
313 const size_t N( A.columns() );
316 (*lhs).reserve( reps0*reps1*M*N );
320 for(
size_t rep0=0UL; rep0<reps0; ++rep0 ) {
321 for(
size_t i=0UL; i<M; ++i ) {
322 for(
size_t rep1=0UL; rep1<reps1; ++rep1 ) {
323 for(
size_t j=0UL; j<N; ++j ) {
324 (*lhs).append( rep0*M+i, rep1*N+j, A(i,j),
true );
327 (*lhs).finalize( rep0*M+i );
333 for(
size_t rep1=0UL; rep1<reps1; ++rep1 ) {
334 for(
size_t j=0UL; j<N; ++j ) {
335 for(
size_t rep0=0UL; rep0<reps0; ++rep0 ) {
336 for(
size_t i=0UL; i<M; ++i ) {
337 (*lhs).append( rep0*M+i, rep1*N+j, A(i,j),
true );
340 (*lhs).finalize( rep1*N+j );
360 template<
typename MT2
362 friend inline void addAssign( DenseMatrix<MT2,SO2>& lhs,
const DMatRepeatExpr& rhs )
369 CompositeType_t<MT> A(
serial( rhs.dm_ ) );
371 const size_t reps0( rhs.template repetitions<0UL>() );
372 const size_t reps1( rhs.template repetitions<1UL>() );
373 const size_t M( A.rows() );
374 const size_t N( A.columns() );
376 for(
size_t rep0=0UL; rep0<reps0; ++rep0 ) {
377 for(
size_t rep1=0UL; rep1<reps1; ++rep1 ) {
401 template<
typename MT2
403 friend inline void subAssign( DenseMatrix<MT2,SO2>& lhs,
const DMatRepeatExpr& rhs )
410 CompositeType_t<MT> A(
serial( rhs.dm_ ) );
412 const size_t reps0( rhs.template repetitions<0UL>() );
413 const size_t reps1( rhs.template repetitions<1UL>() );
414 const size_t M( A.rows() );
415 const size_t N( A.columns() );
417 for(
size_t rep0=0UL; rep0<reps0; ++rep0 ) {
418 for(
size_t rep1=0UL; rep1<reps1; ++rep1 ) {
442 template<
typename MT2
444 friend inline void schurAssign( DenseMatrix<MT2,SO2>& lhs,
const DMatRepeatExpr& rhs )
451 CompositeType_t<MT> A(
serial( rhs.dm_ ) );
453 const size_t reps0( rhs.template repetitions<0UL>() );
454 const size_t reps1( rhs.template repetitions<1UL>() );
455 const size_t M( A.rows() );
456 const size_t N( A.columns() );
458 for(
size_t rep0=0UL; rep0<reps0; ++rep0 ) {
459 for(
size_t rep1=0UL; rep1<reps1; ++rep1 ) {
548 return ReturnType( *dm, m, n );
604 return ReturnType( *dm );
626inline decltype(
auto)
repeat(
const DenseMatrix<MT,SO>& dm,
size_t m,
size_t n )
632 using ReturnType =
const DMatRepeatExpr<MT,SO,R0,R1>;
633 return ReturnType( *dm );
Header file for auxiliary alias declarations.
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition Aliases.h:470
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.
Definition Aliases.h:310
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 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 matrix repeat() function.
Definition DMatRepeatExpr.h:86
ReturnType_t< MT > ReturnType
Definition DMatRepeatExpr.h:104
If_t< IsExpression_v< MT >, const MT, const MT & > Operand
Definition DMatRepeatExpr.h:108
RepeatTrait_t< MT, CRAs... > ResultType
Definition DMatRepeatExpr.h:100
size_t reps_
Definition DMatRepeatExpr.h:247
Operand operand() const noexcept
Returns the dense matrix operand.
Definition DMatRepeatExpr.h:191
DMatRepeatExpr(const MT &dm, RRAs... args) noexcept
Constructor for the DMatRepeatExpr class.
Definition DMatRepeatExpr.h:127
ElementType_t< MT > ElementType
Definition DMatRepeatExpr.h:103
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition DMatRepeatExpr.h:140
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition DMatRepeatExpr.h:155
static constexpr bool simdEnabled
Definition DMatRepeatExpr.h:114
TransposeType_t< ResultType > TransposeType
Definition DMatRepeatExpr.h:102
Operand dm_
Definition DMatRepeatExpr.h:246
size_t columns() const noexcept
Definition DMatRepeatExpr.h:181
size_t rows() const noexcept
Definition DMatRepeatExpr.h:171
RepeatExprData< 2UL, CRAs... > DataType
The type of the RepeatExprData base class.
Definition DMatRepeatExpr.h:89
static constexpr bool smpAssignable
Definition DMatRepeatExpr.h:117
const ResultType CompositeType
Definition DMatRepeatExpr.h:105
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition DMatRepeatExpr.h:207
OppositeType_t< ResultType > OppositeType
Definition DMatRepeatExpr.h:101
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition DMatRepeatExpr.h:229
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition DMatRepeatExpr.h:239
DMatRepeatExpr< MT, SO, CRAs... > This
Type of this DMatRepeatExpr instance.
Definition DMatRepeatExpr.h:95
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition DMatRepeatExpr.h:219
MatRepeatExpr< DenseMatrix< This, SO >, CRAs... > BaseType
Definition DMatRepeatExpr.h:98
Base class for dense matrices.
Definition DenseMatrix.h:82
Auxiliary class template for the data members of repeater expression classes.
Definition RepeatExprData.h:65
Base class for sparse matrices.
Definition SparseMatrix.h:77
Constraint on the data type.
Header file for the Computation base class.
Header file for the DenseMatrix base class.
Header file for the MatRepeatExpr 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_DENSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition DenseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.
Definition StorageOrder.h:63
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
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition Assert.h:101
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition Submatrix.h:181
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.
constexpr bool rowMajor
Storage order flag for row-major matrices.
Definition StorageOrder.h:71
Constraints on the storage order of matrix types.
Header file for all forward declarations for expression class templates.
Header file for the serial shim.
Base class for all matrix repeat expression templates.
Definition MatRepeatExpr.h:69
Header file for basic type definitions.
Submatrix specialization for dense matrices.