11#ifndef EIGEN_ARRAYBASE_H
12#define EIGEN_ARRAYBASE_H
15#include "./InternalHeaderCheck.h"
19template <
typename ExpressionType>
44template <
typename Derived>
47#ifndef EIGEN_PARSED_BY_DOXYGEN
49 using StorageBaseType = ArrayBase;
51 using Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl = ArrayBase;
53 using StorageKind =
typename internal::traits<Derived>::StorageKind;
54 using Scalar =
typename internal::traits<Derived>::Scalar;
55 using PacketScalar =
typename internal::packet_traits<Scalar>::type;
56 using RealScalar =
typename NumTraits<Scalar>::Real;
59 using Base::ColsAtCompileTime;
61 using Base::IsVectorAtCompileTime;
62 using Base::MaxColsAtCompileTime;
63 using Base::MaxRowsAtCompileTime;
64 using Base::MaxSizeAtCompileTime;
65 using Base::RowsAtCompileTime;
66 using Base::SizeAtCompileTime;
71 using Base::const_cast_derived;
73 using Base::lazyAssign;
76 using Base::operator-;
77 using Base::operator=;
78 using Base::operator+=;
79 using Base::operator-=;
80 using Base::operator*=;
81 using Base::operator/=;
83 using CoeffReturnType =
typename Base::CoeffReturnType;
91#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::ArrayBase
92#define EIGEN_DOC_UNARY_ADDONS(X, Y)
93#include "../plugins/MatrixCwiseUnaryOps.inc"
94#include "../plugins/ArrayCwiseUnaryOps.inc"
95#include "../plugins/CommonCwiseBinaryOps.inc"
96#include "../plugins/MatrixCwiseBinaryOps.inc"
97#include "../plugins/ArrayCwiseBinaryOps.inc"
98#ifdef EIGEN_ARRAYBASE_PLUGIN
99#include EIGEN_ARRAYBASE_PLUGIN
101#undef EIGEN_CURRENT_STORAGE_BASE_CLASS
102#undef EIGEN_DOC_UNARY_ADDONS
107 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
operator=(
const ArrayBase& other) {
108 internal::call_assignment(derived(), other.derived());
115 Base::setConstant(
value);
119 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator+=(
const Scalar& other) {
120 internal::call_assignment(this->derived(), PlainObject::Constant(rows(), cols(), other),
121 internal::add_assign_op<Scalar, Scalar>());
125 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator-=(
const Scalar& other) {
126 internal::call_assignment(this->derived(), PlainObject::Constant(rows(), cols(), other),
127 internal::sub_assign_op<Scalar, Scalar>());
135 template <
typename OtherDerived>
136 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
operator+=(
const ArrayBase<OtherDerived>& other) {
137 call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar, typename OtherDerived::Scalar>());
145 template <
typename OtherDerived>
146 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
operator-=(
const ArrayBase<OtherDerived>& other) {
147 call_assignment(derived(), other.derived(), internal::sub_assign_op<Scalar, typename OtherDerived::Scalar>());
155 template <
typename OtherDerived>
156 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
operator*=(
const ArrayBase<OtherDerived>& other) {
157 call_assignment(derived(), other.derived(), internal::mul_assign_op<Scalar, typename OtherDerived::Scalar>());
165 template <
typename OtherDerived>
166 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
operator/=(
const ArrayBase<OtherDerived>& other) {
167 call_assignment(derived(), other.derived(), internal::div_assign_op<Scalar, typename OtherDerived::Scalar>());
173 EIGEN_DEVICE_FUNC
constexpr const ArrayBase<Derived>& array()
const {
return *
this; }
183 EIGEN_DEFAULT_COPY_CONSTRUCTOR(
ArrayBase)
184 EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(
ArrayBase)
189 template <
typename OtherDerived>
190 explicit ArrayBase(
const ArrayBase<OtherDerived>&);
194 template <
typename OtherDerived>
196 EIGEN_STATIC_ASSERT(std::ptrdiff_t(
sizeof(
typename OtherDerived::Scalar)) == -1,
197 YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);
201 template <
typename OtherDerived>
203 EIGEN_STATIC_ASSERT(std::ptrdiff_t(
sizeof(
typename OtherDerived::Scalar)) == -1,
204 YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);
Base class for all 1D and 2D array, and related expressions.
Definition ArrayBase.h:45
Derived & operator/=(const ArrayBase< OtherDerived > &other)
Definition ArrayBase.h:166
Derived & operator=(const ArrayBase &other)
Definition ArrayBase.h:107
constexpr MatrixWrapper< Derived > matrix()
Definition ArrayBase.h:177
Derived & operator*=(const ArrayBase< OtherDerived > &other)
Definition ArrayBase.h:156
Derived & operator+=(const ArrayBase< OtherDerived > &other)
Definition ArrayBase.h:136
Derived & operator-=(const ArrayBase< OtherDerived > &other)
Definition ArrayBase.h:146
Generic expression of a matrix where all coefficients are defined by a functor.
Definition CwiseNullaryOp.h:65
std::conditional_t< std::is_same< typename internal::traits< Derived >::XprKind, MatrixXpr >::value, PlainMatrix, PlainArray > PlainObject
The plain matrix or array type corresponding to this expression.
Definition DenseBase.h:203
CoeffReturnType value() const
Definition DenseBase.h:450
constexpr DenseBase()=default
typename internal::traits< Derived >::Scalar Scalar
Definition DenseBase.h:63
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:53
Expression of an array as a mathematical vector or matrix.
Definition ArrayWrapper.h:120