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;
63 inline Index rows()
const {
return m_expression.rows(); }
65 inline Index cols()
const {
return m_expression.cols(); }
67 inline Index outerStride()
const {
return m_expression.outerStride(); }
69 inline Index innerStride()
const {
return m_expression.innerStride(); }
72 inline ScalarWithConstIfNotLvalue* data() {
return m_expression.data(); }
74 inline const Scalar* data()
const {
return m_expression.data(); }
79 return m_expression.coeffRef(rowId, colId);
85 return m_expression.coeffRef(index);
88 template<
typename Dest>
90 inline void evalTo(Dest& dst)
const { dst = m_expression; }
92 const typename internal::remove_all<NestedExpressionType>::type&
94 nestedExpression()
const
109 NestedExpressionType m_expression;
124 template<
typename ExpressionType>
125 struct traits<MatrixWrapper<ExpressionType> >
126 :
public traits<typename remove_all<typename ExpressionType::Nested>::type >
128 typedef MatrixXpr XprKind;
131 Flags0 = traits<typename remove_all<typename ExpressionType::Nested>::type >::Flags,
132 Flags = Flags0 & ~NestByRefBit
137 template<
typename ExpressionType>
144 typedef typename internal::remove_all<ExpressionType>::type NestedExpression;
146 typedef typename internal::conditional<
147 internal::is_lvalue<ExpressionType>::value,
150 >::type ScalarWithConstIfNotLvalue;
152 typedef typename internal::ref_selector<ExpressionType>::non_const_type NestedExpressionType;
154 using Base::coeffRef;
157 explicit inline MatrixWrapper(ExpressionType& matrix) : m_expression(matrix) {}
160 inline Index rows()
const {
return m_expression.rows(); }
162 inline Index cols()
const {
return m_expression.cols(); }
164 inline Index outerStride()
const {
return m_expression.outerStride(); }
166 inline Index innerStride()
const {
return m_expression.innerStride(); }
169 inline ScalarWithConstIfNotLvalue* data() {
return m_expression.data(); }
171 inline const Scalar* data()
const {
return m_expression.data(); }
176 return m_expression.derived().coeffRef(rowId, colId);
182 return m_expression.coeffRef(index);
186 const typename internal::remove_all<NestedExpressionType>::type&
187 nestedExpression()
const
202 NestedExpressionType m_expression;
Base class for all 1D and 2D array, and related expressions.
Definition: ArrayBase.h:41
MatrixWrapper< ArrayWrapper< ExpressionType > > matrix()
Definition: ArrayBase.h:148
Expression of a mathematical vector or matrix as an array object.
Definition: ArrayWrapper.h:42
void resize(Index rows, Index cols)
Definition: ArrayWrapper.h:106
void resize(Index newSize)
Definition: ArrayWrapper.h:102
internal::traits< Derived >::Scalar Scalar
Definition: DenseBase.h:66
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:50
Expression of an array as a mathematical vector or matrix.
Definition: ArrayWrapper.h:139
void resize(Index newSize)
Definition: ArrayWrapper.h:195
void resize(Index rows, Index cols)
Definition: ArrayWrapper.h:199
Namespace containing all symbols from the Eigen library.
Definition: Core:287
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:37