10 #ifndef EIGEN_ARRAYWRAPPER_H 11 #define EIGEN_ARRAYWRAPPER_H 27 template<
typename ExpressionType>
28 struct traits<ArrayWrapper<ExpressionType> >
29 :
public traits<typename remove_all<typename ExpressionType::Nested>::type >
31 typedef ArrayXpr XprKind;
34 Flags0 = traits<typename remove_all<typename ExpressionType::Nested>::type >::Flags,
35 Flags = Flags0 & ~NestByRefBit
40 template<
typename ExpressionType>
47 typedef typename internal::remove_all<ExpressionType>::type NestedExpression;
49 typedef typename internal::conditional<
50 internal::is_lvalue<ExpressionType>::value,
53 >::type ScalarWithConstIfNotLvalue;
55 typedef typename internal::ref_selector<ExpressionType>::non_const_type NestedExpressionType;
58 explicit EIGEN_STRONG_INLINE
ArrayWrapper(ExpressionType& matrix) : m_expression(matrix) {}
61 inline Index rows()
const {
return m_expression.rows(); }
63 inline Index cols()
const {
return m_expression.cols(); }
65 inline Index outerStride()
const {
return m_expression.outerStride(); }
67 inline Index innerStride()
const {
return m_expression.innerStride(); }
70 inline ScalarWithConstIfNotLvalue* data() {
return m_expression.data(); }
72 inline const Scalar* data()
const {
return m_expression.data(); }
75 inline CoeffReturnType coeff(
Index rowId,
Index colId)
const 77 return m_expression.coeff(rowId, colId);
81 inline Scalar& coeffRef(
Index rowId,
Index colId)
83 return m_expression.coeffRef(rowId, colId);
87 inline const Scalar& coeffRef(
Index rowId,
Index colId)
const 89 return m_expression.coeffRef(rowId, colId);
93 inline CoeffReturnType coeff(
Index index)
const 95 return m_expression.coeff(index);
99 inline Scalar& coeffRef(
Index index)
101 return m_expression.coeffRef(index);
105 inline const Scalar& coeffRef(
Index index)
const 107 return m_expression.coeffRef(index);
110 template<
int LoadMode>
111 inline const PacketScalar packet(
Index rowId,
Index colId)
const 113 return m_expression.template packet<LoadMode>(rowId, colId);
116 template<
int LoadMode>
117 inline void writePacket(
Index rowId,
Index colId,
const PacketScalar& val)
119 m_expression.template writePacket<LoadMode>(rowId, colId, val);
122 template<
int LoadMode>
123 inline const PacketScalar packet(
Index index)
const 125 return m_expression.template packet<LoadMode>(index);
128 template<
int LoadMode>
129 inline void writePacket(
Index index,
const PacketScalar& val)
131 m_expression.template writePacket<LoadMode>(index, val);
134 template<
typename Dest>
136 inline void evalTo(Dest& dst)
const { dst = m_expression; }
138 const typename internal::remove_all<NestedExpressionType>::type&
140 nestedExpression()
const 155 NestedExpressionType m_expression;
170 template<
typename ExpressionType>
171 struct traits<MatrixWrapper<ExpressionType> >
172 :
public traits<typename remove_all<typename ExpressionType::Nested>::type >
177 Flags0 = traits<typename remove_all<typename ExpressionType::Nested>::type >::Flags,
178 Flags = Flags0 & ~NestByRefBit
183 template<
typename ExpressionType>
190 typedef typename internal::remove_all<ExpressionType>::type NestedExpression;
192 typedef typename internal::conditional<
193 internal::is_lvalue<ExpressionType>::value,
196 >::type ScalarWithConstIfNotLvalue;
198 typedef typename internal::ref_selector<ExpressionType>::non_const_type NestedExpressionType;
201 explicit inline MatrixWrapper(ExpressionType& matrix) : m_expression(matrix) {}
204 inline Index rows()
const {
return m_expression.rows(); }
206 inline Index cols()
const {
return m_expression.cols(); }
208 inline Index outerStride()
const {
return m_expression.outerStride(); }
210 inline Index innerStride()
const {
return m_expression.innerStride(); }
213 inline ScalarWithConstIfNotLvalue* data() {
return m_expression.data(); }
215 inline const Scalar* data()
const {
return m_expression.data(); }
218 inline CoeffReturnType coeff(
Index rowId,
Index colId)
const 220 return m_expression.coeff(rowId, colId);
224 inline Scalar& coeffRef(
Index rowId,
Index colId)
226 return m_expression.coeffRef(rowId, colId);
230 inline const Scalar& coeffRef(
Index rowId,
Index colId)
const 232 return m_expression.derived().coeffRef(rowId, colId);
236 inline CoeffReturnType coeff(
Index index)
const 238 return m_expression.coeff(index);
242 inline Scalar& coeffRef(
Index index)
244 return m_expression.coeffRef(index);
248 inline const Scalar& coeffRef(
Index index)
const 250 return m_expression.coeffRef(index);
253 template<
int LoadMode>
254 inline const PacketScalar packet(
Index rowId,
Index colId)
const 256 return m_expression.template packet<LoadMode>(rowId, colId);
259 template<
int LoadMode>
260 inline void writePacket(
Index rowId,
Index colId,
const PacketScalar& val)
262 m_expression.template writePacket<LoadMode>(rowId, colId, val);
265 template<
int LoadMode>
266 inline const PacketScalar packet(
Index index)
const 268 return m_expression.template packet<LoadMode>(index);
271 template<
int LoadMode>
272 inline void writePacket(
Index index,
const PacketScalar& val)
274 m_expression.template writePacket<LoadMode>(index, val);
278 const typename internal::remove_all<NestedExpressionType>::type&
279 nestedExpression()
const 294 NestedExpressionType m_expression;
299 #endif // EIGEN_ARRAYWRAPPER_H void resize(Index newSize)
Definition: ArrayWrapper.h:287
internal::traits< Derived >::Scalar Scalar
Definition: DenseBase.h:66
Expression of a mathematical vector or matrix as an array object.
Definition: ArrayWrapper.h:41
Namespace containing all symbols from the Eigen library.
Definition: Core:271
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:37
void resize(Index rows, Index cols)
Definition: ArrayWrapper.h:291
Definition: Constants.h:506
Expression of an array as a mathematical vector or matrix.
Definition: ArrayBase.h:15
Base class for all 1D and 2D array, and related expressions.
Definition: ArrayBase.h:39
void resize(Index rows, Index cols)
Definition: ArrayWrapper.h:152
Definition: Eigen_Colamd.h:50
void resize(Index newSize)
Definition: ArrayWrapper.h:148
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48