41class ArrayWrapper :
public ArrayBase<ArrayWrapper<ExpressionType> >
44 typedef ArrayBase<ArrayWrapper> Base;
45 EIGEN_DENSE_PUBLIC_INTERFACE(ArrayWrapper)
46 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ArrayWrapper)
48 typedef typename internal::conditional<
49 internal::is_lvalue<ExpressionType>::value,
52 >::type ScalarWithConstIfNotLvalue;
54 typedef typename internal::nested<ExpressionType>::type NestedExpressionType;
56 inline ArrayWrapper(ExpressionType&
matrix) : m_expression(
matrix) {}
58 inline Index rows()
const {
return m_expression.rows(); }
59 inline Index cols()
const {
return m_expression.cols(); }
60 inline Index outerStride()
const {
return m_expression.outerStride(); }
61 inline Index innerStride()
const {
return m_expression.innerStride(); }
63 inline ScalarWithConstIfNotLvalue* data() {
return m_expression.const_cast_derived().data(); }
64 inline const Scalar* data()
const {
return m_expression.data(); }
66 inline CoeffReturnType coeff(
Index rowId,
Index colId)
const
68 return m_expression.coeff(rowId, colId);
71 inline Scalar& coeffRef(
Index rowId,
Index colId)
73 return m_expression.const_cast_derived().coeffRef(rowId, colId);
76 inline const Scalar& coeffRef(
Index rowId,
Index colId)
const
78 return m_expression.const_cast_derived().coeffRef(rowId, colId);
81 inline CoeffReturnType coeff(
Index index)
const
83 return m_expression.coeff(index);
86 inline Scalar& coeffRef(
Index index)
88 return m_expression.const_cast_derived().coeffRef(index);
91 inline const Scalar& coeffRef(
Index index)
const
93 return m_expression.const_cast_derived().coeffRef(index);
96 template<
int LoadMode>
97 inline const PacketScalar packet(
Index rowId,
Index colId)
const
99 return m_expression.template packet<LoadMode>(rowId, colId);
102 template<
int LoadMode>
103 inline void writePacket(
Index rowId,
Index colId,
const PacketScalar& val)
105 m_expression.const_cast_derived().template writePacket<LoadMode>(rowId, colId, val);
108 template<
int LoadMode>
109 inline const PacketScalar packet(
Index index)
const
111 return m_expression.template packet<LoadMode>(index);
114 template<
int LoadMode>
115 inline void writePacket(
Index index,
const PacketScalar& val)
117 m_expression.const_cast_derived().template writePacket<LoadMode>(index, val);
120 template<
typename Dest>
121 inline void evalTo(Dest& dst)
const { dst = m_expression; }
123 const typename internal::remove_all<NestedExpressionType>::type&
124 nestedExpression()
const
131 void resize(
Index newSize) { m_expression.const_cast_derived().resize(newSize); }
134 void resize(
Index nbRows,
Index nbCols) { m_expression.const_cast_derived().resize(nbRows,nbCols); }
137 NestedExpressionType m_expression;
166class MatrixWrapper :
public MatrixBase<MatrixWrapper<ExpressionType> >
169 typedef MatrixBase<MatrixWrapper<ExpressionType> > Base;
170 EIGEN_DENSE_PUBLIC_INTERFACE(MatrixWrapper)
171 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixWrapper)
173 typedef typename internal::conditional<
174 internal::is_lvalue<ExpressionType>::value,
177 >::type ScalarWithConstIfNotLvalue;
179 typedef typename internal::nested<ExpressionType>::type NestedExpressionType;
181 inline MatrixWrapper(ExpressionType& a_matrix) : m_expression(a_matrix) {}
183 inline Index rows()
const {
return m_expression.rows(); }
184 inline Index cols()
const {
return m_expression.cols(); }
185 inline Index outerStride()
const {
return m_expression.outerStride(); }
186 inline Index innerStride()
const {
return m_expression.innerStride(); }
188 inline ScalarWithConstIfNotLvalue* data() {
return m_expression.const_cast_derived().data(); }
189 inline const Scalar* data()
const {
return m_expression.data(); }
191 inline CoeffReturnType coeff(
Index rowId,
Index colId)
const
193 return m_expression.coeff(rowId, colId);
196 inline Scalar& coeffRef(
Index rowId,
Index colId)
198 return m_expression.const_cast_derived().coeffRef(rowId, colId);
201 inline const Scalar& coeffRef(
Index rowId,
Index colId)
const
203 return m_expression.derived().coeffRef(rowId, colId);
206 inline CoeffReturnType coeff(
Index index)
const
208 return m_expression.coeff(index);
211 inline Scalar& coeffRef(
Index index)
213 return m_expression.const_cast_derived().coeffRef(index);
216 inline const Scalar& coeffRef(
Index index)
const
218 return m_expression.const_cast_derived().coeffRef(index);
221 template<
int LoadMode>
222 inline const PacketScalar packet(
Index rowId,
Index colId)
const
224 return m_expression.template packet<LoadMode>(rowId, colId);
227 template<
int LoadMode>
228 inline void writePacket(
Index rowId,
Index colId,
const PacketScalar& val)
230 m_expression.const_cast_derived().template writePacket<LoadMode>(rowId, colId, val);
233 template<
int LoadMode>
234 inline const PacketScalar packet(
Index index)
const
236 return m_expression.template packet<LoadMode>(index);
239 template<
int LoadMode>
240 inline void writePacket(
Index index,
const PacketScalar& val)
242 m_expression.const_cast_derived().template writePacket<LoadMode>(index, val);
245 const typename internal::remove_all<NestedExpressionType>::type&
246 nestedExpression()
const
253 void resize(
Index newSize) { m_expression.const_cast_derived().resize(newSize); }
256 void resize(
Index nbRows,
Index nbCols) { m_expression.const_cast_derived().resize(nbRows,nbCols); }
259 NestedExpressionType m_expression;