10 #ifndef EIGEN_REPLICATE_H 11 #define EIGEN_REPLICATE_H 31 template<
typename MatrixType,
int RowFactor,
int ColFactor>
35 typedef typename MatrixType::Scalar
Scalar;
44 RowsAtCompileTime = RowFactor==
Dynamic || int(MatrixType::RowsAtCompileTime)==
Dynamic 46 : RowFactor * MatrixType::RowsAtCompileTime,
47 ColsAtCompileTime = ColFactor==
Dynamic || int(MatrixType::ColsAtCompileTime)==
Dynamic 49 : ColFactor * MatrixType::ColsAtCompileTime,
51 MaxRowsAtCompileTime = RowsAtCompileTime,
52 MaxColsAtCompileTime = ColsAtCompileTime,
53 IsRowMajor = MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1 ? 1
54 : MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1 ? 0
57 CoeffReadCost = _MatrixTypeNested::CoeffReadCost
62 template<
typename MatrixType,
int RowFactor,
int ColFactor>
class Replicate 72 template<typename OriginalMatrixType>
74 : m_matrix(a_matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor)
77 THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)
81 template<
typename OriginalMatrixType>
82 inline Replicate(
const OriginalMatrixType& a_matrix, Index rowFactor, Index colFactor)
83 : m_matrix(a_matrix), m_rowFactor(rowFactor), m_colFactor(colFactor)
86 THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)
89 inline Index
rows()
const {
return m_matrix.rows() * m_rowFactor.value(); }
90 inline Index
cols()
const {
return m_matrix.cols() * m_colFactor.value(); }
92 inline Scalar
coeff(Index rowId, Index colId)
const 96 : RowFactor==1 ? rowId
97 : rowId%m_matrix.rows();
99 : ColFactor==1 ? colId
100 : colId%m_matrix.cols();
102 return m_matrix.coeff(actual_row, actual_col);
104 template<
int LoadMode>
105 inline PacketScalar
packet(Index rowId, Index colId)
const 108 : RowFactor==1 ? rowId
109 : rowId%m_matrix.rows();
111 : ColFactor==1 ? colId
112 : colId%m_matrix.cols();
114 return m_matrix.template packet<LoadMode>(actual_row, actual_col);
136 template<
typename Derived>
137 template<
int RowFactor,
int ColFactor>
152 template<
typename Derived>
167 template<
typename ExpressionType,
int Direction>
177 #endif // EIGEN_REPLICATE_H MatrixType::Scalar Scalar
const _MatrixTypeNested & nestedExpression() const
ExpressionType::Index Index
Replicate< ExpressionType, Direction==Vertical?Dynamic:1, Direction==Horizontal?Dynamic:1 > ReplicateReturnType
const Replicate< Derived, RowFactor, ColFactor > replicate() const
internal::traits< Derived >::Index Index
The type of indices.
Scalar coeff(Index rowId, Index colId) const
iterative scaling algorithm to equilibrate rows and column norms in matrices
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
const internal::variable_if_dynamic< Index, RowFactor > m_rowFactor
const unsigned int RowMajorBit
internal::dense_xpr_base< Replicate >::type Base
const unsigned int HereditaryBits
traits< MatrixType >::XprKind XprKind
Expression of the multiple replication of a matrix or vector.
PacketScalar packet(Index rowId, Index colId) const
traits< MatrixType >::StorageKind StorageKind
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
const ReplicateReturnType replicate(Index factor) const
remove_reference< MatrixTypeNested >::type _MatrixTypeNested
MatrixTypeNested m_matrix
nested< MatrixType, Factor >::type MatrixTypeNested
const internal::variable_if_dynamic< Index, ColFactor > m_colFactor
Replicate(const OriginalMatrixType &a_matrix, Index rowFactor, Index colFactor)
internal::traits< Replicate >::_MatrixTypeNested _MatrixTypeNested
internal::traits< Replicate >::MatrixTypeNested MatrixTypeNested