File indexing completed on 2025-01-18 09:56:10
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef EIGEN_ARRAYBASE_H
0011 #define EIGEN_ARRAYBASE_H
0012
0013 namespace Eigen {
0014
0015 template<typename ExpressionType> class MatrixWrapper;
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 template<typename Derived> class ArrayBase
0040 : public DenseBase<Derived>
0041 {
0042 public:
0043 #ifndef EIGEN_PARSED_BY_DOXYGEN
0044
0045 typedef ArrayBase StorageBaseType;
0046
0047 typedef ArrayBase Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl;
0048
0049 typedef typename internal::traits<Derived>::StorageKind StorageKind;
0050 typedef typename internal::traits<Derived>::Scalar Scalar;
0051 typedef typename internal::packet_traits<Scalar>::type PacketScalar;
0052 typedef typename NumTraits<Scalar>::Real RealScalar;
0053
0054 typedef DenseBase<Derived> Base;
0055 using Base::RowsAtCompileTime;
0056 using Base::ColsAtCompileTime;
0057 using Base::SizeAtCompileTime;
0058 using Base::MaxRowsAtCompileTime;
0059 using Base::MaxColsAtCompileTime;
0060 using Base::MaxSizeAtCompileTime;
0061 using Base::IsVectorAtCompileTime;
0062 using Base::Flags;
0063
0064 using Base::derived;
0065 using Base::const_cast_derived;
0066 using Base::rows;
0067 using Base::cols;
0068 using Base::size;
0069 using Base::coeff;
0070 using Base::coeffRef;
0071 using Base::lazyAssign;
0072 using Base::operator-;
0073 using Base::operator=;
0074 using Base::operator+=;
0075 using Base::operator-=;
0076 using Base::operator*=;
0077 using Base::operator/=;
0078
0079 typedef typename Base::CoeffReturnType CoeffReturnType;
0080
0081 #endif
0082
0083 #ifndef EIGEN_PARSED_BY_DOXYGEN
0084 typedef typename Base::PlainObject PlainObject;
0085
0086
0087 typedef CwiseNullaryOp<internal::scalar_constant_op<Scalar>,PlainObject> ConstantReturnType;
0088 #endif
0089
0090 #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::ArrayBase
0091 #define EIGEN_DOC_UNARY_ADDONS(X,Y)
0092 # include "../plugins/MatrixCwiseUnaryOps.h"
0093 # include "../plugins/ArrayCwiseUnaryOps.h"
0094 # include "../plugins/CommonCwiseBinaryOps.h"
0095 # include "../plugins/MatrixCwiseBinaryOps.h"
0096 # include "../plugins/ArrayCwiseBinaryOps.h"
0097 # ifdef EIGEN_ARRAYBASE_PLUGIN
0098 # include EIGEN_ARRAYBASE_PLUGIN
0099 # endif
0100 #undef EIGEN_CURRENT_STORAGE_BASE_CLASS
0101 #undef EIGEN_DOC_UNARY_ADDONS
0102
0103
0104
0105
0106 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0107 Derived& operator=(const ArrayBase& other)
0108 {
0109 internal::call_assignment(derived(), other.derived());
0110 return derived();
0111 }
0112
0113
0114
0115 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0116 Derived& operator=(const Scalar &value)
0117 { Base::setConstant(value); return derived(); }
0118
0119 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0120 Derived& operator+=(const Scalar& scalar);
0121 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0122 Derived& operator-=(const Scalar& scalar);
0123
0124 template<typename OtherDerived>
0125 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0126 Derived& operator+=(const ArrayBase<OtherDerived>& other);
0127 template<typename OtherDerived>
0128 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0129 Derived& operator-=(const ArrayBase<OtherDerived>& other);
0130
0131 template<typename OtherDerived>
0132 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0133 Derived& operator*=(const ArrayBase<OtherDerived>& other);
0134
0135 template<typename OtherDerived>
0136 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0137 Derived& operator/=(const ArrayBase<OtherDerived>& other);
0138
0139 public:
0140 EIGEN_DEVICE_FUNC
0141 ArrayBase<Derived>& array() { return *this; }
0142 EIGEN_DEVICE_FUNC
0143 const ArrayBase<Derived>& array() const { return *this; }
0144
0145
0146
0147 EIGEN_DEVICE_FUNC
0148 MatrixWrapper<Derived> matrix() { return MatrixWrapper<Derived>(derived()); }
0149 EIGEN_DEVICE_FUNC
0150 const MatrixWrapper<const Derived> matrix() const { return MatrixWrapper<const Derived>(derived()); }
0151
0152
0153
0154
0155 protected:
0156 EIGEN_DEFAULT_COPY_CONSTRUCTOR(ArrayBase)
0157 EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(ArrayBase)
0158
0159 private:
0160 explicit ArrayBase(Index);
0161 ArrayBase(Index,Index);
0162 template<typename OtherDerived> explicit ArrayBase(const ArrayBase<OtherDerived>&);
0163 protected:
0164
0165 template<typename OtherDerived> Derived& operator+=(const MatrixBase<OtherDerived>& )
0166 {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;}
0167
0168 template<typename OtherDerived> Derived& operator-=(const MatrixBase<OtherDerived>& )
0169 {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;}
0170 };
0171
0172
0173
0174
0175
0176 template<typename Derived>
0177 template<typename OtherDerived>
0178 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
0179 ArrayBase<Derived>::operator-=(const ArrayBase<OtherDerived> &other)
0180 {
0181 call_assignment(derived(), other.derived(), internal::sub_assign_op<Scalar,typename OtherDerived::Scalar>());
0182 return derived();
0183 }
0184
0185
0186
0187
0188
0189 template<typename Derived>
0190 template<typename OtherDerived>
0191 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
0192 ArrayBase<Derived>::operator+=(const ArrayBase<OtherDerived>& other)
0193 {
0194 call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar,typename OtherDerived::Scalar>());
0195 return derived();
0196 }
0197
0198
0199
0200
0201
0202 template<typename Derived>
0203 template<typename OtherDerived>
0204 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
0205 ArrayBase<Derived>::operator*=(const ArrayBase<OtherDerived>& other)
0206 {
0207 call_assignment(derived(), other.derived(), internal::mul_assign_op<Scalar,typename OtherDerived::Scalar>());
0208 return derived();
0209 }
0210
0211
0212
0213
0214
0215 template<typename Derived>
0216 template<typename OtherDerived>
0217 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
0218 ArrayBase<Derived>::operator/=(const ArrayBase<OtherDerived>& other)
0219 {
0220 call_assignment(derived(), other.derived(), internal::div_assign_op<Scalar,typename OtherDerived::Scalar>());
0221 return derived();
0222 }
0223
0224 }
0225
0226 #endif