10 #ifndef EIGEN_REPLICATE_H 11 #define EIGEN_REPLICATE_H 31 template<
typename MatrixType,
int RowFactor,
int ColFactor>
32 struct traits<Replicate<MatrixType,RowFactor,ColFactor> >
35 typedef typename MatrixType::Scalar Scalar;
36 typedef typename traits<MatrixType>::StorageKind StorageKind;
37 typedef typename traits<MatrixType>::XprKind XprKind;
38 typedef typename ref_selector<MatrixType>::type MatrixTypeNested;
39 typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
41 RowsAtCompileTime = RowFactor==Dynamic || int(MatrixType::RowsAtCompileTime)==Dynamic
43 : RowFactor * MatrixType::RowsAtCompileTime,
44 ColsAtCompileTime = ColFactor==Dynamic || int(MatrixType::ColsAtCompileTime)==Dynamic
46 : ColFactor * MatrixType::ColsAtCompileTime,
48 MaxRowsAtCompileTime = RowsAtCompileTime,
49 MaxColsAtCompileTime = ColsAtCompileTime,
50 IsRowMajor = MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1 ? 1
51 : MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1 ? 0
60 template<
typename MatrixType,
int RowFactor,
int ColFactor>
class Replicate 61 :
public internal::dense_xpr_base< Replicate<MatrixType,RowFactor,ColFactor> >::type
63 typedef typename internal::traits<Replicate>::MatrixTypeNested MatrixTypeNested;
64 typedef typename internal::traits<Replicate>::_MatrixTypeNested _MatrixTypeNested;
67 typedef typename internal::dense_xpr_base<Replicate>::type Base;
69 typedef typename internal::remove_all<MatrixType>::type NestedExpression;
71 template<
typename OriginalMatrixType>
73 inline explicit Replicate(
const OriginalMatrixType& matrix)
74 : m_matrix(matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor)
76 EIGEN_STATIC_ASSERT((internal::is_same<
typename internal::remove_const<MatrixType>::type,OriginalMatrixType>::value),
77 THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)
78 eigen_assert(RowFactor!=Dynamic && ColFactor!=Dynamic);
81 template<
typename OriginalMatrixType>
83 inline Replicate(
const OriginalMatrixType& matrix, Index rowFactor, Index colFactor)
84 : m_matrix(matrix), m_rowFactor(rowFactor), m_colFactor(colFactor)
86 EIGEN_STATIC_ASSERT((internal::is_same<
typename internal::remove_const<MatrixType>::type,OriginalMatrixType>::value),
87 THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)
91 inline Index rows()
const {
return m_matrix.rows() * m_rowFactor.value(); }
93 inline Index cols()
const {
return m_matrix.cols() * m_colFactor.value(); }
96 const _MatrixTypeNested& nestedExpression()
const 102 MatrixTypeNested m_matrix;
103 const internal::variable_if_dynamic<Index, RowFactor> m_rowFactor;
104 const internal::variable_if_dynamic<Index, ColFactor> m_colFactor;
115 template<
typename Derived>
116 template<
int RowFactor,
int ColFactor>
131 template<
typename ExpressionType,
int Direction>
141 #endif // EIGEN_REPLICATE_H Definition: Constants.h:265
const Replicate< Derived, RowFactor, ColFactor > replicate() const
Definition: Replicate.h:118
Eigen::Index Index
Definition: VectorwiseOp.h:162
const unsigned int RowMajorBit
Definition: Constants.h:61
Expression of the multiple replication of a matrix or vector.
Definition: Replicate.h:60
Definition: Constants.h:268
Definition: Eigen_Colamd.h:54
const ReplicateReturnType replicate(Index factor) const
Definition: Replicate.h:133