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 LvalueBitFlag = is_lvalue<ExpressionType>::value ?
LvalueBit : 0,
36 Flags = (Flags0 & ~(NestByRefBit |
LvalueBit)) | LvalueBitFlag
41 template<
typename ExpressionType>
48 typedef typename internal::remove_all<ExpressionType>::type NestedExpression;
50 typedef typename internal::conditional<
51 internal::is_lvalue<ExpressionType>::value,
54 >::type ScalarWithConstIfNotLvalue;
56 typedef typename internal::ref_selector<ExpressionType>::non_const_type NestedExpressionType;
64 inline Index rows()
const {
return m_expression.rows(); }
66 inline Index cols()
const {
return m_expression.cols(); }
68 inline Index outerStride()
const {
return m_expression.outerStride(); }
70 inline Index innerStride()
const {
return m_expression.innerStride(); }
73 inline ScalarWithConstIfNotLvalue* data() {
return m_expression.data(); }
75 inline const Scalar* data()
const {
return m_expression.data(); }
80 return m_expression.coeffRef(rowId, colId);
86 return m_expression.coeffRef(index);
89 template<
typename Dest>
91 inline void evalTo(Dest& dst)
const { dst = m_expression; }
93 const typename internal::remove_all<NestedExpressionType>::type&
95 nestedExpression()
const
110 NestedExpressionType m_expression;
125 template<
typename ExpressionType>
126 struct traits<MatrixWrapper<ExpressionType> >
127 :
public traits<typename remove_all<typename ExpressionType::Nested>::type >
129 typedef MatrixXpr XprKind;
132 Flags0 = traits<typename remove_all<typename ExpressionType::Nested>::type >::Flags,
133 LvalueBitFlag = is_lvalue<ExpressionType>::value ?
LvalueBit : 0,
134 Flags = (Flags0 & ~(NestByRefBit |
LvalueBit)) | LvalueBitFlag
139 template<
typename ExpressionType>
146 typedef typename internal::remove_all<ExpressionType>::type NestedExpression;
148 typedef typename internal::conditional<
149 internal::is_lvalue<ExpressionType>::value,
152 >::type ScalarWithConstIfNotLvalue;
154 typedef typename internal::ref_selector<ExpressionType>::non_const_type NestedExpressionType;
156 using Base::coeffRef;
159 explicit inline MatrixWrapper(ExpressionType& matrix) : m_expression(matrix) {}
162 inline Index rows()
const {
return m_expression.rows(); }
164 inline Index cols()
const {
return m_expression.cols(); }
166 inline Index outerStride()
const {
return m_expression.outerStride(); }
168 inline Index innerStride()
const {
return m_expression.innerStride(); }
171 inline ScalarWithConstIfNotLvalue* data() {
return m_expression.data(); }
173 inline const Scalar* data()
const {
return m_expression.data(); }
176 inline const Scalar& coeffRef(
Index rowId,
Index colId)
const
178 return m_expression.derived().coeffRef(rowId, colId);
182 inline const Scalar& coeffRef(
Index index)
const
184 return m_expression.coeffRef(index);
188 const typename internal::remove_all<NestedExpressionType>::type&
189 nestedExpression()
const
204 NestedExpressionType m_expression;
209 #endif // EIGEN_ARRAYWRAPPER_H