10#ifndef EIGEN_REPLICATE_H
11#define EIGEN_REPLICATE_H
13#include "./InternalHeaderCheck.h"
18template<
typename MatrixType,
int RowFactor,
int ColFactor>
19struct traits<Replicate<MatrixType,RowFactor,ColFactor> >
22 typedef typename MatrixType::Scalar Scalar;
23 typedef typename traits<MatrixType>::StorageKind StorageKind;
24 typedef typename traits<MatrixType>::XprKind XprKind;
25 typedef typename ref_selector<MatrixType>::type MatrixTypeNested;
26 typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
28 RowsAtCompileTime = RowFactor==
Dynamic || int(MatrixType::RowsAtCompileTime)==
Dynamic
30 : RowFactor * MatrixType::RowsAtCompileTime,
31 ColsAtCompileTime = ColFactor==
Dynamic || int(MatrixType::ColsAtCompileTime)==
Dynamic
33 : ColFactor * MatrixType::ColsAtCompileTime,
35 MaxRowsAtCompileTime = RowsAtCompileTime,
36 MaxColsAtCompileTime = ColsAtCompileTime,
37 IsRowMajor = MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1 ? 1
38 : MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1 ? 0
63template<
typename MatrixType,
int RowFactor,
int ColFactor>
class Replicate
64 :
public internal::dense_xpr_base< Replicate<MatrixType,RowFactor,ColFactor> >::type
66 typedef typename internal::traits<Replicate>::MatrixTypeNested MatrixTypeNested;
67 typedef typename internal::traits<Replicate>::_MatrixTypeNested _MatrixTypeNested;
70 typedef typename internal::dense_xpr_base<Replicate>::type Base;
72 typedef typename internal::remove_all<MatrixType>::type NestedExpression;
74 template<
typename OriginalMatrixType>
76 inline explicit Replicate(
const OriginalMatrixType& matrix)
77 : m_matrix(matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor)
79 EIGEN_STATIC_ASSERT((internal::is_same<
typename internal::remove_const<MatrixType>::type,OriginalMatrixType>::value),
80 THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)
84 template<
typename OriginalMatrixType>
87 : m_matrix(matrix), m_rowFactor(rowFactor), m_colFactor(colFactor)
89 EIGEN_STATIC_ASSERT((internal::is_same<
typename internal::remove_const<MatrixType>::type,OriginalMatrixType>::value),
90 THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)
93 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
94 inline Index rows()
const {
return m_matrix.rows() * m_rowFactor.value(); }
95 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
96 inline Index cols()
const {
return m_matrix.cols() * m_colFactor.value(); }
99 const _MatrixTypeNested& nestedExpression()
const
105 MatrixTypeNested m_matrix;
106 const internal::variable_if_dynamic<Index, RowFactor> m_rowFactor;
107 const internal::variable_if_dynamic<Index, ColFactor> m_colFactor;
118template<
typename Derived>
119template<
int RowFactor,
int ColFactor>
134template<
typename ExpressionType,
int Direction>
const Replicate< Derived, RowFactor, ColFactor > replicate() const
Definition: Replicate.h:121
Expression of the multiple replication of a matrix or vector.
Definition: Replicate.h:65
Eigen::Index Index
Definition: VectorwiseOp.h:194
const ReplicateReturnType replicate(Index factor) const
Definition: Replicate.h:136
@ Horizontal
Definition: Constants.h:269
@ Vertical
Definition: Constants.h:266
const unsigned int RowMajorBit
Definition: Constants.h:68
Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:59
const int Dynamic
Definition: Constants.h:24