10 #ifndef EIGEN_ARRAYWRAPPER_H
11 #define EIGEN_ARRAYWRAPPER_H
13 #include "./InternalHeaderCheck.h"
29 template<
typename ExpressionType>
30 struct traits<ArrayWrapper<ExpressionType> >
31 :
public traits<remove_all_t<typename ExpressionType::Nested> >
33 typedef ArrayXpr XprKind;
36 Flags0 = traits<remove_all_t<typename ExpressionType::Nested> >::Flags,
37 LvalueBitFlag = is_lvalue<ExpressionType>::value ?
LvalueBit : 0,
38 Flags = (Flags0 & ~(NestByRefBit |
LvalueBit)) | LvalueBitFlag
43 template<
typename ExpressionType>
50 typedef internal::remove_all_t<ExpressionType> NestedExpression;
52 typedef std::conditional_t<
53 internal::is_lvalue<ExpressionType>::value,
56 > ScalarWithConstIfNotLvalue;
58 typedef typename internal::ref_selector<ExpressionType>::non_const_type NestedExpressionType;
65 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
66 inline Index rows()
const EIGEN_NOEXCEPT {
return m_expression.rows(); }
67 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
68 inline Index cols()
const EIGEN_NOEXCEPT {
return m_expression.cols(); }
69 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
70 inline Index outerStride()
const EIGEN_NOEXCEPT {
return m_expression.outerStride(); }
71 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
72 inline Index innerStride()
const EIGEN_NOEXCEPT {
return m_expression.innerStride(); }
75 inline ScalarWithConstIfNotLvalue* data() {
return m_expression.data(); }
77 inline const Scalar* data()
const {
return m_expression.data(); }
82 return m_expression.coeffRef(rowId, colId);
88 return m_expression.coeffRef(index);
91 template<
typename Dest>
93 inline void evalTo(Dest& dst)
const { dst = m_expression; }
96 const internal::remove_all_t<NestedExpressionType>&
97 nestedExpression()
const
112 NestedExpressionType m_expression;
127 template<
typename ExpressionType>
128 struct traits<MatrixWrapper<ExpressionType> >
129 :
public traits<remove_all_t<typename ExpressionType::Nested> >
131 typedef MatrixXpr XprKind;
134 Flags0 = traits<remove_all_t<typename ExpressionType::Nested> >::Flags,
135 LvalueBitFlag = is_lvalue<ExpressionType>::value ?
LvalueBit : 0,
136 Flags = (Flags0 & ~(NestByRefBit |
LvalueBit)) | LvalueBitFlag
141 template<
typename ExpressionType>
148 typedef internal::remove_all_t<ExpressionType> NestedExpression;
150 typedef std::conditional_t<
151 internal::is_lvalue<ExpressionType>::value,
154 > ScalarWithConstIfNotLvalue;
156 typedef typename internal::ref_selector<ExpressionType>::non_const_type NestedExpressionType;
158 using Base::coeffRef;
161 explicit inline MatrixWrapper(ExpressionType& matrix) : m_expression(matrix) {}
163 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
164 inline Index rows()
const EIGEN_NOEXCEPT {
return m_expression.rows(); }
165 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
166 inline Index cols()
const EIGEN_NOEXCEPT {
return m_expression.cols(); }
167 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
168 inline Index outerStride()
const EIGEN_NOEXCEPT {
return m_expression.outerStride(); }
169 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
170 inline Index innerStride()
const EIGEN_NOEXCEPT {
return m_expression.innerStride(); }
173 inline ScalarWithConstIfNotLvalue* data() {
return m_expression.data(); }
175 inline const Scalar* data()
const {
return m_expression.data(); }
180 return m_expression.derived().coeffRef(rowId, colId);
186 return m_expression.coeffRef(index);
190 const internal::remove_all_t<NestedExpressionType>&
191 nestedExpression()
const
206 NestedExpressionType m_expression;
Base class for all 1D and 2D array, and related expressions.
Definition: ArrayBase.h:43
MatrixWrapper< ArrayWrapper< ExpressionType > > matrix()
Definition: ArrayBase.h:150
Expression of a mathematical vector or matrix as an array object.
Definition: ArrayWrapper.h:45
void resize(Index rows, Index cols)
Definition: ArrayWrapper.h:109
void resize(Index newSize)
Definition: ArrayWrapper.h:105
internal::traits< Derived >::Scalar Scalar
Definition: DenseBase.h:61
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:52
Expression of an array as a mathematical vector or matrix.
Definition: ArrayWrapper.h:143
void resize(Index newSize)
Definition: ArrayWrapper.h:199
void resize(Index rows, Index cols)
Definition: ArrayWrapper.h:203
const unsigned int LvalueBit
Definition: Constants.h:146
Namespace containing all symbols from the Eigen library.
Definition: Core:139
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:59
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:41