10#ifndef EIGEN_ARRAYWRAPPER_H
11#define EIGEN_ARRAYWRAPPER_H
27template<
typename ExpressionType>
28struct 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
41template<
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;
63 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
64 inline Index rows()
const EIGEN_NOEXCEPT {
return m_expression.rows(); }
65 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
66 inline Index cols()
const EIGEN_NOEXCEPT {
return m_expression.cols(); }
67 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
68 inline Index outerStride()
const EIGEN_NOEXCEPT {
return m_expression.outerStride(); }
69 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
70 inline Index innerStride()
const EIGEN_NOEXCEPT {
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; }
94 const typename internal::remove_all<NestedExpressionType>::type&
95 nestedExpression()
const
110 NestedExpressionType m_expression;
125template<
typename ExpressionType>
126struct 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
139template<
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) {}
161 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
162 inline Index rows()
const EIGEN_NOEXCEPT {
return m_expression.rows(); }
163 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
164 inline Index cols()
const EIGEN_NOEXCEPT {
return m_expression.cols(); }
165 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
166 inline Index outerStride()
const EIGEN_NOEXCEPT {
return m_expression.outerStride(); }
167 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
168 inline Index innerStride()
const EIGEN_NOEXCEPT {
return m_expression.innerStride(); }
171 inline ScalarWithConstIfNotLvalue* data() {
return m_expression.data(); }
173 inline const Scalar* data()
const {
return m_expression.data(); }
178 return m_expression.derived().coeffRef(rowId, colId);
184 return m_expression.coeffRef(index);
188 const typename internal::remove_all<NestedExpressionType>::type&
189 nestedExpression()
const
204 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:43
void resize(Index rows, Index cols)
Definition: ArrayWrapper.h:107
void resize(Index newSize)
Definition: ArrayWrapper.h:103
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:141
void resize(Index newSize)
Definition: ArrayWrapper.h:197
void resize(Index rows, Index cols)
Definition: ArrayWrapper.h:201
const unsigned int LvalueBit
Definition: Constants.h:144
Namespace containing all symbols from the Eigen library.
Definition: Core:141
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74