| 42 | |
| 43 | template<typename ExpressionType> |
| 44 | class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> > |
| 45 | { |
| 46 | public: |
| 47 | typedef ArrayBase<ArrayWrapper> Base; |
| 48 | EIGEN_DENSE_PUBLIC_INTERFACE(ArrayWrapper) |
| 49 | EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ArrayWrapper) |
| 50 | typedef internal::remove_all_t<ExpressionType> NestedExpression; |
| 51 | |
| 52 | typedef std::conditional_t< |
| 53 | internal::is_lvalue<ExpressionType>::value, |
| 54 | Scalar, |
| 55 | const Scalar |
| 56 | > ScalarWithConstIfNotLvalue; |
| 57 | |
| 58 | typedef typename internal::ref_selector<ExpressionType>::non_const_type NestedExpressionType; |
| 59 | |
| 60 | using Base::coeffRef; |
| 61 | |
| 62 | EIGEN_DEVICE_FUNC |
| 63 | explicit EIGEN_STRONG_INLINE ArrayWrapper(ExpressionType& matrix) : m_expression(matrix) {} |
| 64 | |
| 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(); } |
| 73 | |
| 74 | EIGEN_DEVICE_FUNC |
| 75 | inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } |
| 76 | EIGEN_DEVICE_FUNC |
| 77 | inline const Scalar* data() const { return m_expression.data(); } |
| 78 | |
| 79 | EIGEN_DEVICE_FUNC |
| 80 | inline const Scalar& coeffRef(Index rowId, Index colId) const |
| 81 | { |
| 82 | return m_expression.coeffRef(rowId, colId); |
| 83 | } |
| 84 | |
| 85 | EIGEN_DEVICE_FUNC |
| 86 | inline const Scalar& coeffRef(Index index) const |
| 87 | { |
| 88 | return m_expression.coeffRef(index); |
| 89 | } |
| 90 | |
| 91 | template<typename Dest> |
| 92 | EIGEN_DEVICE_FUNC |
| 93 | inline void evalTo(Dest& dst) const { dst = m_expression; } |
| 94 | |
| 95 | EIGEN_DEVICE_FUNC |
| 96 | const internal::remove_all_t<NestedExpressionType>& |
| 97 | nestedExpression() const |
| 98 | { |
| 99 | return m_expression; |
| 100 | } |
| 101 | |