template<typename Derived>
ArrayBase class
Base class for all 1D and 2D array, and related expressions.
Template parameters | |
---|---|
Derived | is the derived type, e.g., an array or an expression type. |
Contents
An array is similar to a dense vector or matrix. While matrices are mathematical objects with well defined linear algebra operators, an array is just a collection of scalar values arranged in a one or two dimensionnal fashion. As the main consequence, all operations applied to an array are performed coefficient wise. Furthermore, arrays support scalar math functions of the c++ standard library (e.g., std::sin(x)), and convenient constructors allowing to easily write generic code working for both scalar values and arrays.
This class is the base that is inherited by all array expression types.
This class can be extended with the help of the plugin mechanism described on the page Extending MatrixBase (and other classes) by defining the preprocessor symbol EIGEN_ARRAYBASE_PLUGIN
.
Base classes
-
template<typename Derived>class DenseBase
- Base class for all dense matrices, vectors, and arrays.
Derived classes
-
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>struct dense_xpr_base_dispatcher<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>>
Public types
- using Abs2ReturnType = CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived>
- using AbsReturnType = CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived>
- using AcoshReturnType = CwiseUnaryOp<internal::scalar_acosh_op<Scalar>, const Derived>
- using AcosReturnType = CwiseUnaryOp<internal::scalar_acos_op<Scalar>, const Derived>
- using ArgReturnType = CwiseUnaryOp<internal::scalar_arg_op<Scalar>, const Derived>
- using AsinhReturnType = CwiseUnaryOp<internal::scalar_asinh_op<Scalar>, const Derived>
- using AsinReturnType = CwiseUnaryOp<internal::scalar_asin_op<Scalar>, const Derived>
- using AtanhReturnType = CwiseUnaryOp<internal::scalar_atanh_op<Scalar>, const Derived>
- using AtanReturnType = CwiseUnaryOp<internal::scalar_atan_op<Scalar>, const Derived>
- using BooleanNotReturnType = CwiseUnaryOp<internal::scalar_boolean_not_op<Scalar>, const Derived>
- using CeilReturnType = CwiseUnaryOp<internal::scalar_ceil_op<Scalar>, const Derived>
- using CoshReturnType = CwiseUnaryOp<internal::scalar_cosh_op<Scalar>, const Derived>
- using CosReturnType = CwiseUnaryOp<internal::scalar_cos_op<Scalar>, const Derived>
- using CubeReturnType = CwiseUnaryOp<internal::scalar_cube_op<Scalar>, const Derived>
- using CwiseAbs2ReturnType = CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived>
- using CwiseAbsReturnType = CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived>
- using CwiseInverseReturnType = CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived>
- using CwiseScalarEqualReturnType = CwiseBinaryOp<internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_EQ>, const Derived, const ConstantReturnType>
- using CwiseSignReturnType = CwiseUnaryOp<internal::scalar_sign_op<Scalar>, const Derived>
- using CwiseSqrtReturnType = CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived>
- using DigammaReturnType = CwiseUnaryOp<internal::scalar_digamma_op<Scalar>, const Derived>
- using ErfcReturnType = CwiseUnaryOp<internal::scalar_erfc_op<Scalar>, const Derived>
- using ErfReturnType = CwiseUnaryOp<internal::scalar_erf_op<Scalar>, const Derived>
- using Expm1ReturnType = CwiseUnaryOp<internal::scalar_expm1_op<Scalar>, const Derived>
- using ExpReturnType = CwiseUnaryOp<internal::scalar_exp_op<Scalar>, const Derived>
- using FloorReturnType = CwiseUnaryOp<internal::scalar_floor_op<Scalar>, const Derived>
- using InverseReturnType = CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived>
- using IsFiniteReturnType = CwiseUnaryOp<internal::scalar_isfinite_op<Scalar>, const Derived>
- using IsInfReturnType = CwiseUnaryOp<internal::scalar_isinf_op<Scalar>, const Derived>
- using IsNaNReturnType = CwiseUnaryOp<internal::scalar_isnan_op<Scalar>, const Derived>
- using LgammaReturnType = CwiseUnaryOp<internal::scalar_lgamma_op<Scalar>, const Derived>
- using Log10ReturnType = CwiseUnaryOp<internal::scalar_log10_op<Scalar>, const Derived>
- using Log1pReturnType = CwiseUnaryOp<internal::scalar_log1p_op<Scalar>, const Derived>
- using LogisticReturnType = CwiseUnaryOp<internal::scalar_logistic_op<Scalar>, const Derived>
- using LogReturnType = CwiseUnaryOp<internal::scalar_log_op<Scalar>, const Derived>
- using RoundReturnType = CwiseUnaryOp<internal::scalar_round_op<Scalar>, const Derived>
- using RsqrtReturnType = CwiseUnaryOp<internal::scalar_rsqrt_op<Scalar>, const Derived>
- using SignReturnType = CwiseUnaryOp<internal::scalar_sign_op<Scalar>, const Derived>
- using SinhReturnType = CwiseUnaryOp<internal::scalar_sinh_op<Scalar>, const Derived>
- using SinReturnType = CwiseUnaryOp<internal::scalar_sin_op<Scalar>, const Derived>
- using SqrtReturnType = CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived>
- using SquareReturnType = CwiseUnaryOp<internal::scalar_square_op<Scalar>, const Derived>
- using TanhReturnType = CwiseUnaryOp<internal::scalar_tanh_op<Scalar>, const Derived>
- using TanReturnType = CwiseUnaryOp<internal::scalar_tan_op<Scalar>, const Derived>
Public functions
- auto abs() const -> const AbsReturnType
- auto abs2() const -> const Abs2ReturnType
- auto acos() const -> const AcosReturnType
- auto acosh() const -> const AcoshReturnType
- auto arg() const -> const ArgReturnType
- auto asin() const -> const AsinReturnType
- auto asinh() const -> const AsinhReturnType
- auto atan() const -> const AtanReturnType
- auto atanh() const -> const AtanhReturnType
-
template<typename CustomBinaryOp, typename OtherDerived>auto binaryExpr(const Eigen::
ArrayBase<OtherDerived>& other, const CustomBinaryOp& func = CustomBinaryOp()) const -> const CwiseBinaryOp<CustomBinaryOp, const Derived, const OtherDerived> - auto ceil() const -> const CeilReturnType
- auto cos() const -> const CosReturnType
- auto cosh() const -> const CoshReturnType
- auto cube() const -> const CubeReturnType
- auto cwiseAbs() const -> const CwiseAbsReturnType
- auto cwiseAbs2() const -> const CwiseAbs2ReturnType
-
template<typename OtherDerived>auto cwiseEqual(const Eigen::
ArrayBase<OtherDerived>& other) const -> const CwiseBinaryOp<std::equal_to<Scalar>, const Derived, const OtherDerived> - auto cwiseEqual(const Scalar& s) const -> const CwiseScalarEqualReturnType
- auto cwiseInverse() const -> const CwiseInverseReturnType
-
template<typename OtherDerived>auto cwiseMax(const Eigen::
ArrayBase<OtherDerived>& other) const -> const CwiseBinaryOp<internal::scalar_max_op<Scalar, Scalar>, const Derived, const OtherDerived> - auto cwiseMax(const Scalar& other) const -> const CwiseBinaryOp<internal::scalar_max_op<Scalar, Scalar>, const Derived, const ConstantReturnType>
-
template<typename OtherDerived>auto cwiseMin(const Eigen::
ArrayBase<OtherDerived>& other) const -> const CwiseBinaryOp<internal::scalar_min_op<Scalar, Scalar>, const Derived, const OtherDerived> - auto cwiseMin(const Scalar& other) const -> const CwiseBinaryOp<internal::scalar_min_op<Scalar, Scalar>, const Derived, const ConstantReturnType>
-
template<typename OtherDerived>auto cwiseNotEqual(const Eigen::
ArrayBase<OtherDerived>& other) const -> const CwiseBinaryOp<std::not_equal_to<Scalar>, const Derived, const OtherDerived> -
template<typename OtherDerived>auto cwiseProduct(const Eigen::
ArrayBase<OtherDerived>& other) const -> const CwiseBinaryOp<internal::scalar_product_op<Derived ::Scalar, OtherDerived ::Scalar>, const Derived, const OtherDerived> -
template<typename OtherDerived>auto cwiseQuotient(const Eigen::
ArrayBase<OtherDerived>& other) const -> const CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived> - auto cwiseSign() const -> const CwiseSignReturnType
- auto cwiseSqrt() const -> const CwiseSqrtReturnType
- auto digamma() const -> const DigammaReturnType
- auto erf() const -> const ErfReturnType
- auto erfc() const -> const ErfcReturnType
- auto exp() const -> const ExpReturnType
- auto expm1() const -> const Expm1ReturnType
- auto floor() const -> const FloorReturnType
- auto inverse() const -> const InverseReturnType
- auto isFinite() const -> const IsFiniteReturnType
- auto isInf() const -> const IsInfReturnType
- auto isNaN() const -> const IsNaNReturnType
- auto lgamma() const -> const LgammaReturnType
- auto log() const -> const LogReturnType
- auto log10() const -> const Log10ReturnType
- auto log1p() const -> const Log1pReturnType
- auto logistic() const -> const LogisticReturnType
- auto matrix() -> MatrixWrapper<Derived>
-
template<typename OtherDerived>auto max(const Eigen::
ArrayBase<OtherDerived>& other) const -> const CwiseBinaryOp<max<Scalar>, const Derived, const OtherDerived> - auto max(const Scalar& other) const -> const CwiseBinaryOp<internal::scalar_max_op<Scalar, Scalar>, const Derived, const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject>>
-
template<typename OtherDerived>auto min(const Eigen::
ArrayBase<OtherDerived>& other) const -> const CwiseBinaryOp<min<Scalar>, const Derived, const OtherDerived> - auto min(const Scalar& other) const -> const CwiseBinaryOp<internal::scalar_min_op<Scalar, Scalar>, const Derived, const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject>>
-
template<typename OtherDerived>auto operator&&(const Eigen::
ArrayBase<OtherDerived>& other) const -> const CwiseBinaryOp<internal::scalar_boolean_and_op, const Derived, const OtherDerived> -
template<typename OtherDerived>auto operator*(const Eigen::
ArrayBase<OtherDerived>& other) const -> const CwiseBinaryOp<internal::scalar_product_op<Derived ::Scalar, OtherDerived ::Scalar>, const Derived, const OtherDerived> -
template<typename T>auto operator*(const T& scalar) const -> const CwiseBinaryOp<internal::scalar_product_op<Scalar, T>, Derived, Constant<T>>
-
template<typename OtherDerived>auto operator*=(const ArrayBase<OtherDerived>& other) -> Derived&
- auto operator!() const -> const BooleanNotReturnType
-
template<typename OtherDerived>auto operator+(const Eigen::
ArrayBase<OtherDerived>& other) const -> const CwiseBinaryOp<sum<Scalar>, const Derived, const OtherDerived> -
template<typename T>auto operator+(const T& scalar) const -> const CwiseBinaryOp<internal::scalar_sum_op<Scalar, T>, Derived, Constant<T>>
-
template<typename OtherDerived>auto operator+=(const ArrayBase<OtherDerived>& other) -> Derived&
-
template<typename OtherDerived>auto operator-(const Eigen::
ArrayBase<OtherDerived>& other) const -> const CwiseBinaryOp<difference<Scalar>, const Derived, const OtherDerived> -
template<typename T>auto operator-(const T& scalar) const -> const CwiseBinaryOp<internal::scalar_difference_op<Scalar, T>, Derived, Constant<T>>
-
template<typename OtherDerived>auto operator-=(const ArrayBase<OtherDerived>& other) -> Derived&
-
template<typename OtherDerived>auto operator/(const Eigen::
ArrayBase<OtherDerived>& other) const -> const CwiseBinaryOp<internal::scalar_quotient_op<Scalar, typename OtherDerived::Scalar>, const Derived, const OtherDerived> -
template<typename T>auto operator/(const T& scalar) const -> const CwiseBinaryOp<internal::scalar_quotient_op<Scalar, T>, Derived, Constant<T>>
-
template<typename OtherDerived>auto operator/=(const ArrayBase<OtherDerived>& other) -> Derived&
- auto operator=(const ArrayBase& other) -> Derived&
- auto operator=(const Scalar& value) -> Derived&
-
template<typename OtherDerived>auto operator^(const Eigen::
ArrayBase<OtherDerived>& other) const -> const CwiseBinaryOp<internal::scalar_boolean_xor_op, const Derived, const OtherDerived> -
template<typename OtherDerived>auto operator||(const Eigen::
ArrayBase<OtherDerived>& other) const -> const CwiseBinaryOp<internal::scalar_boolean_or_op, const Derived, const OtherDerived> -
template<typename OtherDerived>auto pow(const Eigen::
ArrayBase<OtherDerived>& other) const -> const CwiseBinaryOp<pow<Scalar>, const Derived, const OtherDerived> -
template<typename T>auto pow(const T& exponent) const -> const CwiseBinaryOp<internal::scalar_pow_op<Scalar, T>, Derived, Constant<T>>
- auto round() const -> const RoundReturnType
- auto rsqrt() const -> const RsqrtReturnType
- auto sign() const -> const SignReturnType
- auto sin() const -> const SinReturnType
- auto sinh() const -> const SinhReturnType
- auto sqrt() const -> const SqrtReturnType
- auto square() const -> const SquareReturnType
- auto tan() const -> const TanReturnType
- auto tanh() const -> const TanhReturnType
-
template<typename DerivedQ>auto zeta(const Eigen::
ArrayBase<DerivedQ>& q) const -> const CwiseBinaryOp<internal::scalar_zeta_op<Scalar>, const Derived, const DerivedQ>
Friends
-
template<typename T>auto operator*(const T& scalar, const StorageBaseType& expr) -> const CwiseBinaryOp<internal::scalar_product_op<T, Scalar>, Constant<T>, Derived>
-
template<typename T>auto operator+(const T& scalar, const StorageBaseType& expr) -> const CwiseBinaryOp<internal::scalar_sum_op<T, Scalar>, Constant<T>, Derived>
-
template<typename T>auto operator-(const T& scalar, const StorageBaseType& expr) -> const CwiseBinaryOp<internal::scalar_difference_op<T, Scalar>, Constant<T>, Derived>
-
template<typename T>auto operator/(const T& s, const StorageBaseType& a) -> const CwiseBinaryOp<internal::scalar_quotient_op<T, Scalar>, Constant<T>, Derived>
- Component-wise division of the scalar s by array elements of a.
Typedef documentation
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: Abs2ReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: AbsReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_acosh_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: AcoshReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_acos_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: AcosReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_arg_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: ArgReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_asinh_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: AsinhReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_asin_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: AsinReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_atanh_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: AtanhReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_atan_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: AtanReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_boolean_not_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: BooleanNotReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_ceil_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: CeilReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_cosh_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: CoshReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_cos_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: CosReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_cube_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: CubeReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: CwiseAbs2ReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: CwiseAbsReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: CwiseInverseReturnType
template<typename Derived>
typedef CwiseBinaryOp<internal::scalar_cmp_op<Scalar, Scalar, internal::cmp_EQ>, const Derived, const ConstantReturnType> Eigen:: ArrayBase<Derived>:: CwiseScalarEqualReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_sign_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: CwiseSignReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: CwiseSqrtReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_digamma_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: DigammaReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_erfc_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: ErfcReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_erf_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: ErfReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_expm1_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: Expm1ReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_exp_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: ExpReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_floor_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: FloorReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: InverseReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_isfinite_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: IsFiniteReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_isinf_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: IsInfReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_isnan_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: IsNaNReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_lgamma_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: LgammaReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_log10_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: Log10ReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_log1p_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: Log1pReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_logistic_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: LogisticReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_log_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: LogReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_round_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: RoundReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_rsqrt_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: RsqrtReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_sign_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: SignReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_sinh_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: SinhReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_sin_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: SinReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: SqrtReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_square_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: SquareReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_tanh_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: TanhReturnType
template<typename Derived>
typedef CwiseUnaryOp<internal::scalar_tan_op<Scalar>, const Derived> Eigen:: ArrayBase<Derived>:: TanReturnType
Function documentation
template<typename Derived>
const AbsReturnType Eigen:: ArrayBase<Derived>:: abs() const
Returns | an expression of the coefficient-wise absolute value of *this |
---|
Example:
Array3d v(1,-2,-3); cout << v.abs() << endl;
Output:
1 2 3
template<typename Derived>
const Abs2ReturnType Eigen:: ArrayBase<Derived>:: abs2() const
Returns | an expression of the coefficient-wise squared absolute value of *this |
---|
Example:
Array3d v(1,-2,-3); cout << v.abs2() << endl;
Output:
1 4 9
template<typename Derived>
const AcosReturnType Eigen:: ArrayBase<Derived>:: acos() const
Returns | an expression of the coefficient-wise arc cosine of *this. |
---|
Example:
Array3d v(0, sqrt(2.)/2, 1); cout << v.acos() << endl;
Output:
1.57 0.785 0
template<typename Derived>
const AcoshReturnType Eigen:: ArrayBase<Derived>:: acosh() const
Returns | an expression of the coefficient-wise inverse hyperbolic cos of *this. |
---|
template<typename Derived>
const ArgReturnType Eigen:: ArrayBase<Derived>:: arg() const
Returns | an expression of the coefficient-wise phase angle of *this |
---|
Example:
ArrayXcf v = ArrayXcf::Random(3); cout << v << endl << endl; cout << arg(v) << endl;
Output:
(-0.211,0.68) (0.597,0.566) (-0.605,0.823) 1.87 0.759 2.2
template<typename Derived>
const AsinReturnType Eigen:: ArrayBase<Derived>:: asin() const
Returns | an expression of the coefficient-wise arc sine of *this. |
---|
Example:
Array3d v(0, sqrt(2.)/2, 1); cout << v.asin() << endl;
Output:
0 0.785 1.57
template<typename Derived>
const AsinhReturnType Eigen:: ArrayBase<Derived>:: asinh() const
Returns | an expression of the coefficient-wise inverse hyperbolic sin of *this. |
---|
template<typename Derived>
const AtanReturnType Eigen:: ArrayBase<Derived>:: atan() const
Returns | an expression of the coefficient-wise arc tan of *this. |
---|
Example:
ArrayXd v = ArrayXd::LinSpaced(5,0,1); cout << v.atan() << endl;
Output:
0 0.245 0.464 0.644 0.785
template<typename Derived>
const AtanhReturnType Eigen:: ArrayBase<Derived>:: atanh() const
Returns | an expression of the coefficient-wise inverse hyperbolic tan of *this. |
---|
template<typename Derived>
template<typename CustomBinaryOp, typename OtherDerived>
const CwiseBinaryOp<CustomBinaryOp, const Derived, const OtherDerived> Eigen:: ArrayBase<Derived>:: binaryExpr(const Eigen:: ArrayBase<OtherDerived>& other,
const CustomBinaryOp& func = CustomBinaryOp()) const
Returns | an expression of a custom coefficient-wise operator func of *this and other |
---|
The template parameter CustomBinaryOp is the type of the functor of the custom operator (see class CwiseBinaryOp for an example)
Here is an example illustrating the use of custom functors:
#include <Eigen/Core> #include <iostream> using namespace Eigen; using namespace std; // define a custom template binary functor template<typename Scalar> struct MakeComplexOp { EIGEN_EMPTY_STRUCT_CTOR(MakeComplexOp) typedef complex<Scalar> result_type; complex<Scalar> operator()(const Scalar& a, const Scalar& b) const { return complex<Scalar>(a,b); } }; int main(int, char**) { Matrix4d m1 = Matrix4d::Random(), m2 = Matrix4d::Random(); cout << m1.binaryExpr(m2, MakeComplexOp<double>()) << endl; return 0; }
Output:
(0.68,0.271) (0.823,-0.967) (-0.444,-0.687) (-0.27,0.998) (-0.211,0.435) (-0.605,-0.514) (0.108,-0.198) (0.0268,-0.563) (0.566,-0.717) (-0.33,-0.726) (-0.0452,-0.74) (0.904,0.0259) (0.597,0.214) (0.536,0.608) (0.258,-0.782) (0.832,0.678)
template<typename Derived>
const CeilReturnType Eigen:: ArrayBase<Derived>:: ceil() const
Returns | an expression of the coefficient-wise ceil of *this. |
---|
Example:
ArrayXd v = ArrayXd::LinSpaced(7,-2,2); cout << v << endl << endl; cout << ceil(v) << endl;
Output:
-2 -1.33 -0.667 0 0.667 1.33 2 -2 -1 -0 0 1 2 2
template<typename Derived>
const CosReturnType Eigen:: ArrayBase<Derived>:: cos() const
Returns | an expression of the coefficient-wise cosine of *this. |
---|
This function computes the coefficient-wise cosine. The function MatrixBase::
Example:
Array3d v(M_PI, M_PI/2, M_PI/3); cout << v.cos() << endl;
Output:
-1 6.12e-17 0.5
template<typename Derived>
const CoshReturnType Eigen:: ArrayBase<Derived>:: cosh() const
Returns | an expression of the coefficient-wise hyperbolic cos of *this. |
---|
Example:
ArrayXd v = ArrayXd::LinSpaced(5,0,1); cout << cosh(v) << endl;
Output:
1 1.03 1.13 1.29 1.54
template<typename Derived>
const CubeReturnType Eigen:: ArrayBase<Derived>:: cube() const
Returns | an expression of the coefficient-wise cube of *this. |
---|
Example:
Array3d v(2,3,4); cout << v.cube() << endl;
Output:
8 27 64
template<typename Derived>
const CwiseAbsReturnType Eigen:: ArrayBase<Derived>:: cwiseAbs() const
Returns | an expression of the coefficient-wise absolute value of *this |
---|
Example:
MatrixXd m(2,3); m << 2, -4, 6, -5, 1, 0; cout << m.cwiseAbs() << endl;
Output:
template<typename Derived>
const CwiseAbs2ReturnType Eigen:: ArrayBase<Derived>:: cwiseAbs2() const
Returns | an expression of the coefficient-wise squared absolute value of *this |
---|
Example:
MatrixXd m(2,3); m << 2, -4, 6, -5, 1, 0; cout << m.cwiseAbs2() << endl;
Output:
template<typename Derived>
template<typename OtherDerived>
const CwiseBinaryOp<std::equal_to<Scalar>, const Derived, const OtherDerived> Eigen:: ArrayBase<Derived>:: cwiseEqual(const Eigen:: ArrayBase<OtherDerived>& other) const
Returns | an expression of the coefficient-wise == operator of *this and other |
---|
Example:
MatrixXi m(2,2); m << 1, 0, 1, 1; cout << "Comparing m with identity matrix:" << endl; cout << m.cwiseEqual(MatrixXi::Identity(2,2)) << endl; Index count = m.cwiseEqual(MatrixXi::Identity(2,2)).count(); cout << "Number of coefficients that are equal: " << count << endl;
Output:
Comparing m with identity matrix: 1 1 0 1 Number of coefficients that are equal: 3
template<typename Derived>
const CwiseScalarEqualReturnType Eigen:: ArrayBase<Derived>:: cwiseEqual(const Scalar& s) const
Returns | an expression of the coefficient-wise == operator of *this and a scalar s |
---|
template<typename Derived>
const CwiseInverseReturnType Eigen:: ArrayBase<Derived>:: cwiseInverse() const
Returns | an expression of the coefficient-wise inverse of *this. |
---|
Example:
MatrixXd m(2,3); m << 2, 0.5, 1, 3, 0.25, 1; cout << m.cwiseInverse() << endl;
Output:
template<typename Derived>
template<typename OtherDerived>
const CwiseBinaryOp<internal::scalar_max_op<Scalar, Scalar>, const Derived, const OtherDerived> Eigen:: ArrayBase<Derived>:: cwiseMax(const Eigen:: ArrayBase<OtherDerived>& other) const
Returns | an expression of the coefficient-wise max of *this and other |
---|
Example:
Vector3d v(2,3,4), w(4,2,3); cout << v.cwiseMax(w) << endl;
Output:
4 3 4
template<typename Derived>
const CwiseBinaryOp<internal::scalar_max_op<Scalar, Scalar>, const Derived, const ConstantReturnType> Eigen:: ArrayBase<Derived>:: cwiseMax(const Scalar& other) const
Returns | an expression of the coefficient-wise max of *this and scalar other |
---|
template<typename Derived>
template<typename OtherDerived>
const CwiseBinaryOp<internal::scalar_min_op<Scalar, Scalar>, const Derived, const OtherDerived> Eigen:: ArrayBase<Derived>:: cwiseMin(const Eigen:: ArrayBase<OtherDerived>& other) const
Returns | an expression of the coefficient-wise min of *this and other |
---|
Example:
Vector3d v(2,3,4), w(4,2,3); cout << v.cwiseMin(w) << endl;
Output:
2 2 3
template<typename Derived>
const CwiseBinaryOp<internal::scalar_min_op<Scalar, Scalar>, const Derived, const ConstantReturnType> Eigen:: ArrayBase<Derived>:: cwiseMin(const Scalar& other) const
Returns | an expression of the coefficient-wise min of *this and scalar other |
---|
template<typename Derived>
template<typename OtherDerived>
const CwiseBinaryOp<std::not_equal_to<Scalar>, const Derived, const OtherDerived> Eigen:: ArrayBase<Derived>:: cwiseNotEqual(const Eigen:: ArrayBase<OtherDerived>& other) const
Returns | an expression of the coefficient-wise != operator of *this and other |
---|
Example:
MatrixXi m(2,2); m << 1, 0, 1, 1; cout << "Comparing m with identity matrix:" << endl; cout << m.cwiseNotEqual(MatrixXi::Identity(2,2)) << endl; Index count = m.cwiseNotEqual(MatrixXi::Identity(2,2)).count(); cout << "Number of coefficients that are not equal: " << count << endl;
Output:
Comparing m with identity matrix: 0 0 1 0 Number of coefficients that are not equal: 1
template<typename Derived>
template<typename OtherDerived>
const CwiseBinaryOp<internal::scalar_product_op<Derived ::Scalar, OtherDerived ::Scalar>, const Derived, const OtherDerived> Eigen:: ArrayBase<Derived>:: cwiseProduct(const Eigen:: ArrayBase<OtherDerived>& other) const
Returns | an expression of the Schur product (coefficient wise product) of *this and other |
---|
Example:
Matrix3i a = Matrix3i::Random(), b = Matrix3i::Random(); Matrix3i c = a.cwiseProduct(b); cout << "a:\n" << a << "\nb:\n" << b << "\nc:\n" << c << endl;
Output:
a: 7 6 -3 -2 9 6 6 -6 -5 b: 1 -3 9 0 0 3 3 9 5 c: 7 -18 -27 0 0 18 18 -54 -25
template<typename Derived>
template<typename OtherDerived>
const CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived> Eigen:: ArrayBase<Derived>:: cwiseQuotient(const Eigen:: ArrayBase<OtherDerived>& other) const
Returns | an expression of the coefficient-wise quotient of *this and other |
---|
Example:
Vector3d v(2,3,4), w(4,2,3); cout << v.cwiseQuotient(w) << endl;
Output:
0.5 1.5 1.33
template<typename Derived>
const CwiseSignReturnType Eigen:: ArrayBase<Derived>:: cwiseSign() const
Returns | an expression of the coefficient-wise signum of *this. |
---|
Example:
MatrixXd m(2,3); m << 2, -4, 6, -5, 1, 0; cout << m.cwiseSign() << endl;
Output:
1 -1 1 -1 1 0
template<typename Derived>
const CwiseSqrtReturnType Eigen:: ArrayBase<Derived>:: cwiseSqrt() const
Returns | an expression of the coefficient-wise square root of *this. |
---|
Example:
Vector3d v(1,2,4); cout << v.cwiseSqrt() << endl;
Output:
cwisePow(), cwiseSquare()
template<typename Derived>
const DigammaReturnType Eigen:: ArrayBase<Derived>:: digamma() const
Returns | an expression of the coefficient-wise digamma (psi, derivative of lgamma). |
---|
This is defined in the unsupported SpecialFunctions module. #include <Eigen/SpecialFunctions>
template<typename Derived>
const ErfReturnType Eigen:: ArrayBase<Derived>:: erf() const
Returns | an expression of the coefficient-wise Gauss error function of *this. |
---|
[c++11]
This is defined in the unsupported SpecialFunctions module. #include <Eigen/SpecialFunctions>
Example:
#include <Eigen/Core> #include <unsupported/Eigen/SpecialFunctions> #include <iostream> using namespace Eigen; int main() { Array4d v(-0.5,2,0,-7); std::cout << v.erf() << std::endl; }
Output:
-0.52 0.995 0 -1
template<typename Derived>
const ErfcReturnType Eigen:: ArrayBase<Derived>:: erfc() const
Returns | an expression of the coefficient-wise Complementary error function of *this. |
---|
[c++11]
This is defined in the unsupported SpecialFunctions module. #include <Eigen/SpecialFunctions>
Example:
#include <Eigen/Core> #include <unsupported/Eigen/SpecialFunctions> #include <iostream> using namespace Eigen; int main() { Array4d v(-0.5,2,0,-7); std::cout << v.erfc() << std::endl; }
Output:
1.52 0.00468 1 2
template<typename Derived>
const ExpReturnType Eigen:: ArrayBase<Derived>:: exp() const
Returns | an expression of the coefficient-wise exponential of *this. |
---|
This function computes the coefficient-wise exponential. The function MatrixBase::
Example:
Array3d v(1,2,3); cout << v.exp() << endl;
Output:
2.72 7.39 20.1
template<typename Derived>
const Expm1ReturnType Eigen:: ArrayBase<Derived>:: expm1() const
Returns | an expression of the coefficient-wise exponential of *this minus 1. |
---|
In exact arithmetic, x.expm1()
is equivalent to x.exp()
- 1, however, with finite precision, this function is much more accurate when x
is close to zero.
template<typename Derived>
const FloorReturnType Eigen:: ArrayBase<Derived>:: floor() const
Returns | an expression of the coefficient-wise floor of *this. |
---|
Example:
ArrayXd v = ArrayXd::LinSpaced(7,-2,2); cout << v << endl << endl; cout << floor(v) << endl;
Output:
-2 -1.33 -0.667 0 0.667 1.33 2 -2 -2 -1 0 0 1 2
template<typename Derived>
const InverseReturnType Eigen:: ArrayBase<Derived>:: inverse() const
Returns | an expression of the coefficient-wise inverse of *this. |
---|
Example:
Array3d v(2,3,4); cout << v.inverse() << endl;
Output:
0.5 0.333 0.25
template<typename Derived>
const IsFiniteReturnType Eigen:: ArrayBase<Derived>:: isFinite() const
Returns | an expression of the coefficient-wise isfinite of *this. |
---|
Example:
Array3d v(1,2,3); v(1) *= 0.0/0.0; v(2) /= 0.0; cout << v << endl << endl; cout << isfinite(v) << endl;
Output:
1 -nan inf 1 0 0
template<typename Derived>
const IsInfReturnType Eigen:: ArrayBase<Derived>:: isInf() const
Returns | an expression of the coefficient-wise isinf of *this. |
---|
Example:
Array3d v(1,2,3); v(1) *= 0.0/0.0; v(2) /= 0.0; cout << v << endl << endl; cout << isinf(v) << endl;
Output:
1 -nan inf 0 0 1
template<typename Derived>
const IsNaNReturnType Eigen:: ArrayBase<Derived>:: isNaN() const
Returns | an expression of the coefficient-wise isnan of *this. |
---|
Example:
Array3d v(1,2,3); v(1) *= 0.0/0.0; v(2) /= 0.0; cout << v << endl << endl; cout << isnan(v) << endl;
Output:
1 -nan inf 0 1 0
template<typename Derived>
const LgammaReturnType Eigen:: ArrayBase<Derived>:: lgamma() const
Returns | an expression of the coefficient-wise ln(|gamma(*this)|). |
---|
[c++11]
This is defined in the unsupported SpecialFunctions module. #include <Eigen/SpecialFunctions>
Example:
#include <Eigen/Core> #include <unsupported/Eigen/SpecialFunctions> #include <iostream> using namespace Eigen; int main() { Array4d v(0.5,10,0,-1); std::cout << v.lgamma() << std::endl; }
Output:
0.572 12.8 inf inf
template<typename Derived>
const LogReturnType Eigen:: ArrayBase<Derived>:: log() const
Returns | an expression of the coefficient-wise logarithm of *this. |
---|
This function computes the coefficient-wise logarithm. The function MatrixBase::
Example:
Array3d v(1,2,3); cout << v.log() << endl;
Output:
0 0.693 1.1
template<typename Derived>
const Log10ReturnType Eigen:: ArrayBase<Derived>:: log10() const
Returns | an expression of the coefficient-wise base-10 logarithm of *this. |
---|
This function computes the coefficient-wise base-10 logarithm.
Example:
Array4d v(-1,0,1,2); cout << log10(v) << endl;
Output:
nan -inf 0 0.301
template<typename Derived>
const Log1pReturnType Eigen:: ArrayBase<Derived>:: log1p() const
Returns | an expression of the coefficient-wise logarithm of 1 plus *this . |
---|
In exact arithmetic, x.log()
is equivalent to (x+1).log(), however, with finite precision, this function is much more accurate when x
is close to zero.
template<typename Derived>
const LogisticReturnType Eigen:: ArrayBase<Derived>:: logistic() const
Returns | an expression of the coefficient-wise logistic of *this. |
---|
template<typename Derived>
MatrixWrapper<Derived> Eigen:: ArrayBase<Derived>:: matrix()
Returns | an Matrix expression of this array |
---|
template<typename Derived>
template<typename OtherDerived>
const CwiseBinaryOp<max<Scalar>, const Derived, const OtherDerived> Eigen:: ArrayBase<Derived>:: max(const Eigen:: ArrayBase<OtherDerived>& other) const
Returns | an expression of the coefficient-wise max of *this and other |
---|
Example:
Array3d v(2,3,4), w(4,2,3); cout << v.max(w) << endl;
Output:
4 3 4
template<typename Derived>
const CwiseBinaryOp<internal::scalar_max_op<Scalar, Scalar>, const Derived, const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject>> Eigen:: ArrayBase<Derived>:: max(const Scalar& other) const
Returns | an expression of the coefficient-wise max of *this and scalar other |
---|
template<typename Derived>
template<typename OtherDerived>
const CwiseBinaryOp<min<Scalar>, const Derived, const OtherDerived> Eigen:: ArrayBase<Derived>:: min(const Eigen:: ArrayBase<OtherDerived>& other) const
Returns | an expression of the coefficient-wise min of *this and other |
---|
Example:
Array3d v(2,3,4), w(4,2,3); cout << v.min(w) << endl;
Output:
2 2 3
template<typename Derived>
const CwiseBinaryOp<internal::scalar_min_op<Scalar, Scalar>, const Derived, const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject>> Eigen:: ArrayBase<Derived>:: min(const Scalar& other) const
Returns | an expression of the coefficient-wise min of *this and scalar other |
---|
template<typename Derived>
template<typename OtherDerived>
const CwiseBinaryOp<internal::scalar_boolean_and_op, const Derived, const OtherDerived> Eigen:: ArrayBase<Derived>:: operator&&(const Eigen:: ArrayBase<OtherDerived>& other) const
Returns | an expression of the coefficient-wise boolean and operator of *this and other |
---|
Example:
Array3d v(-1,2,1), w(-3,2,3); cout << ((v<w) && (v<0)) << endl;
Output:
0 0 0
template<typename Derived>
template<typename OtherDerived>
const CwiseBinaryOp<internal::scalar_product_op<Derived ::Scalar, OtherDerived ::Scalar>, const Derived, const OtherDerived> Eigen:: ArrayBase<Derived>:: operator*(const Eigen:: ArrayBase<OtherDerived>& other) const
Returns | an expression of the coefficient wise product of *this and other |
---|
template<typename Derived>
template<typename T>
const CwiseBinaryOp<internal::scalar_product_op<Scalar, T>, Derived, Constant<T>> Eigen:: ArrayBase<Derived>:: operator*(const T& scalar) const
Template parameters | |
---|---|
T | is the scalar type of scalar. It must be compatible with the scalar type of the given expression. |
Returns | an expression of *this scaled by the scalar factor scalar |
template<typename Derived>
template<typename OtherDerived>
Derived& Eigen:: ArrayBase<Derived>:: operator*=(const ArrayBase<OtherDerived>& other)
Returns | a reference to *this |
---|
replaces *this
by *this
* other coefficient wise.
template<typename Derived>
const BooleanNotReturnType Eigen:: ArrayBase<Derived>:: operator!() const
Returns | an expression of the coefficient-wise ! operator of *this |
---|
Example:
Array3d v(1,2,3); v(1) *= 0.0/0.0; v(2) /= 0.0; cout << v << endl << endl; cout << !isfinite(v) << endl;
Output:
1 -nan inf 0 1 1
template<typename Derived>
template<typename OtherDerived>
const CwiseBinaryOp<sum<Scalar>, const Derived, const OtherDerived> Eigen:: ArrayBase<Derived>:: operator+(const Eigen:: ArrayBase<OtherDerived>& other) const
Returns | an expression of the sum of *this and other |
---|
template<typename Derived>
template<typename T>
const CwiseBinaryOp<internal::scalar_sum_op<Scalar, T>, Derived, Constant<T>> Eigen:: ArrayBase<Derived>:: operator+(const T& scalar) const
Template parameters | |
---|---|
T | is the scalar type of scalar. It must be compatible with the scalar type of the given expression. |
Returns | an expression of the coefficient-wise < operator of *this and other |
Example:
Array3d v(1,2,3), w(3,2,1); cout << (v<w) << endl;
Output:
1 0 0
Example:
Array3d v(1,2,3), w(3,2,1); cout << (v<=w) << endl;
Output:
1 1 0
Example:
Array3d v(1,2,3), w(3,2,1); cout << (v>w) << endl;
Output:
0 0 1
Example:
Array3d v(1,2,3), w(3,2,1); cout << (v>=w) << endl;
Output:
0 1 1
Example:
Array3d v(1,2,3), w(3,2,1); cout << (v==w) << endl;
Output:
0 1 0
Example:
Array3d v(1,2,3), w(3,2,1); cout << (v!=w) << endl;
Output:
1 0 1
Example:
Array3d v(1,2,3); cout << v+5 << endl;
Output:
6 7 8
template<typename Derived>
template<typename OtherDerived>
Derived& Eigen:: ArrayBase<Derived>:: operator+=(const ArrayBase<OtherDerived>& other)
Returns | a reference to *this |
---|
replaces *this
by *this
+ other.
template<typename Derived>
template<typename OtherDerived>
const CwiseBinaryOp<difference<Scalar>, const Derived, const OtherDerived> Eigen:: ArrayBase<Derived>:: operator-(const Eigen:: ArrayBase<OtherDerived>& other) const
Returns | an expression of the difference of *this and other |
---|
template<typename Derived>
template<typename T>
const CwiseBinaryOp<internal::scalar_difference_op<Scalar, T>, Derived, Constant<T>> Eigen:: ArrayBase<Derived>:: operator-(const T& scalar) const
Template parameters | |
---|---|
T | is the scalar type of scalar. It must be compatible with the scalar type of the given expression. |
Returns | an expression of *this with each coeff decremented by the constant scalar |
Example:
Array3d v(1,2,3); cout << v-5 << endl;
Output:
-4 -3 -2
template<typename Derived>
template<typename OtherDerived>
Derived& Eigen:: ArrayBase<Derived>:: operator-=(const ArrayBase<OtherDerived>& other)
Returns | a reference to *this |
---|
replaces *this
by *this
- other.
template<typename Derived>
template<typename OtherDerived>
const CwiseBinaryOp<internal::scalar_quotient_op<Scalar, typename OtherDerived::Scalar>, const Derived, const OtherDerived> Eigen:: ArrayBase<Derived>:: operator/(const Eigen:: ArrayBase<OtherDerived>& other) const
Returns | an expression of the coefficient wise quotient of *this and other |
---|
template<typename Derived>
template<typename T>
const CwiseBinaryOp<internal::scalar_quotient_op<Scalar, T>, Derived, Constant<T>> Eigen:: ArrayBase<Derived>:: operator/(const T& scalar) const
Template parameters | |
---|---|
T | is the scalar type of scalar. It must be compatible with the scalar type of the given expression. |
Returns | an expression of *this divided by the scalar value scalar |
template<typename Derived>
template<typename OtherDerived>
Derived& Eigen:: ArrayBase<Derived>:: operator/=(const ArrayBase<OtherDerived>& other)
Returns | a reference to *this |
---|
replaces *this
by *this
/ other coefficient wise.
template<typename Derived>
template<typename OtherDerived>
const CwiseBinaryOp<internal::scalar_boolean_xor_op, const Derived, const OtherDerived> Eigen:: ArrayBase<Derived>:: operator^(const Eigen:: ArrayBase<OtherDerived>& other) const
Returns | an expression of the coefficient-wise ^ operator of *this and other |
---|
Example:
Array3d v(-1,2,1), w(-3,2,3); cout << ((v<w) ^ (v<0)) << endl;
Output:
1 0 1
template<typename Derived>
template<typename OtherDerived>
const CwiseBinaryOp<internal::scalar_boolean_or_op, const Derived, const OtherDerived> Eigen:: ArrayBase<Derived>:: operator||(const Eigen:: ArrayBase<OtherDerived>& other) const
Returns | an expression of the coefficient-wise boolean or operator of *this and other |
---|
Example:
Array3d v(-1,2,1), w(-3,2,3); cout << ((v<w) || (v<0)) << endl;
Output:
1 0 1
template<typename Derived>
template<typename OtherDerived>
const CwiseBinaryOp<pow<Scalar>, const Derived, const OtherDerived> Eigen:: ArrayBase<Derived>:: pow(const Eigen:: ArrayBase<OtherDerived>& other) const
Returns | an expression of the coefficient-wise power of *this to the given array of exponents. |
---|
This function computes the coefficient-wise power.
Example:
Array<double,1,3> x(8,25,3), e(1./3.,0.5,2.); cout << "[" << x << "]^[" << e << "] = " << x.pow(e) << endl; // using ArrayBase::pow cout << "[" << x << "]^[" << e << "] = " << pow(x,e) << endl; // using Eigen::pow
Output:
[ 8 25 3]^[0.333 0.5 2] = 2 5 9 [ 8 25 3]^[0.333 0.5 2] = 2 5 9
template<typename Derived>
template<typename T>
const CwiseBinaryOp<internal::scalar_pow_op<Scalar, T>, Derived, Constant<T>> Eigen:: ArrayBase<Derived>:: pow(const T& exponent) const
Template parameters | |
---|---|
T | is the scalar type of exponent. It must be compatible with the scalar type of the given expression. |
Returns | an expression of the coefficients of *this rasied to the constant power exponent |
This function computes the coefficient-wise power. The function MatrixBase::
Example:
Array3d v(8,27,64); cout << v.pow(0.333333) << endl;
Output:
2 3 4
template<typename Derived>
const RoundReturnType Eigen:: ArrayBase<Derived>:: round() const
Returns | an expression of the coefficient-wise round of *this. |
---|
Example:
ArrayXd v = ArrayXd::LinSpaced(7,-2,2); cout << v << endl << endl; cout << round(v) << endl;
Output:
-2 -1.33 -0.667 0 0.667 1.33 2 -2 -1 -1 -0 1 1 2
template<typename Derived>
const RsqrtReturnType Eigen:: ArrayBase<Derived>:: rsqrt() const
Returns | an expression of the coefficient-wise inverse square root of *this. |
---|
This function computes the coefficient-wise inverse square root.
Example:
Array3d v(1,2,4); cout << v.sqrt() << endl;
Output:
1 1.41 2
template<typename Derived>
const SignReturnType Eigen:: ArrayBase<Derived>:: sign() const
Returns | an expression of the coefficient-wise signum of *this. |
---|
This function computes the coefficient-wise signum.
Example:
Array3d v(-3,5,0); cout << v.sign() << endl;
Output:
-1 1 0
template<typename Derived>
const SinReturnType Eigen:: ArrayBase<Derived>:: sin() const
Returns | an expression of the coefficient-wise sine of *this. |
---|
This function computes the coefficient-wise sine. The function MatrixBase::
Example:
Array3d v(M_PI, M_PI/2, M_PI/3); cout << v.sin() << endl;
Output:
1.22e-16 1 0.866
template<typename Derived>
const SinhReturnType Eigen:: ArrayBase<Derived>:: sinh() const
Returns | an expression of the coefficient-wise hyperbolic sin of *this. |
---|
Example:
ArrayXd v = ArrayXd::LinSpaced(5,0,1); cout << sinh(v) << endl;
Output:
0 0.253 0.521 0.822 1.18
template<typename Derived>
const SqrtReturnType Eigen:: ArrayBase<Derived>:: sqrt() const
Returns | an expression of the coefficient-wise square root of *this. |
---|
This function computes the coefficient-wise square root. The function MatrixBase::
Example:
Array3d v(1,2,4); cout << v.sqrt() << endl;
Output:
1 1.41 2
template<typename Derived>
const SquareReturnType Eigen:: ArrayBase<Derived>:: square() const
Returns | an expression of the coefficient-wise square of *this. |
---|
Example:
Array3d v(2,3,4); cout << v.square() << endl;
Output:
4 9 16
template<typename Derived>
const TanReturnType Eigen:: ArrayBase<Derived>:: tan() const
Returns | an expression of the coefficient-wise tan of *this. |
---|
Example:
Array3d v(M_PI, M_PI/2, M_PI/3); cout << v.tan() << endl;
Output:
-1.22e-16 1.63e+16 1.73
template<typename Derived>
const TanhReturnType Eigen:: ArrayBase<Derived>:: tanh() const
Returns | an expression of the coefficient-wise hyperbolic tan of *this. |
---|
Example:
ArrayXd v = ArrayXd::LinSpaced(5,0,1); cout << tanh(v) << endl;
Output:
0 0.245 0.462 0.635 0.762
template<typename Derived>
template<typename DerivedQ>
const CwiseBinaryOp<internal::scalar_zeta_op<Scalar>, const Derived, const DerivedQ> Eigen:: ArrayBase<Derived>:: zeta(const Eigen:: ArrayBase<DerivedQ>& q) const
Parameters | |
---|---|
q | is the shift, it must be > 0 |
Returns | an expression of the coefficient-wise zeta function. |
This is defined in the unsupported SpecialFunctions module. #include <Eigen/SpecialFunctions>
It returns the Riemann zeta function of two arguments *this
and q:
This method is an alias for zeta(*this,q);
template<typename Derived>
template<typename T>
const CwiseBinaryOp<internal::scalar_product_op<T, Scalar>, Constant<T>, Derived> operator*(const T& scalar,
const StorageBaseType& expr)
Template parameters | |
---|---|
T | is the scalar type of scalar. It must be compatible with the scalar type of the given expression. |
Returns | an expression of expr scaled by the scalar factor scalar |
template<typename Derived>
template<typename T>
const CwiseBinaryOp<internal::scalar_sum_op<T, Scalar>, Constant<T>, Derived> operator+(const T& scalar,
const StorageBaseType& expr)
Template parameters | |
---|---|
T | is the scalar type of scalar. It must be compatible with the scalar type of the given expression. |
Returns | an expression of expr with each coeff incremented by the constant scalar |
template<typename Derived>
template<typename T>
const CwiseBinaryOp<internal::scalar_difference_op<T, Scalar>, Constant<T>, Derived> operator-(const T& scalar,
const StorageBaseType& expr)
Template parameters | |
---|---|
T | is the scalar type of scalar. It must be compatible with the scalar type of the given expression. |
Returns | an expression of the constant matrix of value scalar decremented by the coefficients of expr |
template<typename Derived>
template<typename T>
const CwiseBinaryOp<internal::scalar_quotient_op<T, Scalar>, Constant<T>, Derived> operator/(const T& s,
const StorageBaseType& a)
Component-wise division of the scalar s by array elements of a.
template<typename Derived>
template<typename Derived, typename ScalarExponent>
const CwiseBinaryOp<internal::scalar_pow_op<Derived::Scalar, ScalarExponent>, Derived, Constant<ScalarExponent>> pow(const Eigen:: ArrayBase<Derived>& x,
const ScalarExponent& exponent)
Template parameters | |
---|---|
Derived | |
ScalarExponent | is the scalar type of exponent. It must be compatible with the scalar type of the given expression (Derived::Scalar ). |
Returns | an expression of the coefficient-wise power of x to the given constant exponent. |
template<typename Derived>
template<typename Derived, typename ExponentDerived>
const Eigen:: CwiseBinaryOp<Eigen::internal::scalar_pow_op<typename Derived::Scalar, typename ExponentDerived::Scalar>, const Derived, const ExponentDerived> pow(const Eigen:: ArrayBase<Derived>& x,
const Eigen:: ArrayBase<ExponentDerived>& exponents)
Returns | an expression of the coefficient-wise power of x to the given array of exponents. |
---|
This function computes the coefficient-wise power.
Example:
Array<double,1,3> x(8,25,3), e(1./3.,0.5,2.); cout << "[" << x << "]^[" << e << "] = " << x.pow(e) << endl; // using ArrayBase::pow cout << "[" << x << "]^[" << e << "] = " << pow(x,e) << endl; // using Eigen::pow
Output:
[ 8 25 3]^[0.333 0.5 2] = 2 5 9 [ 8 25 3]^[0.333 0.5 2] = 2 5 9
template<typename Derived>
template<typename Scalar, typename Derived>
const CwiseBinaryOp<internal::scalar_pow_op<Scalar, Derived::Scalar>, Constant<Scalar>, Derived> pow(const Scalar& x,
const Eigen:: ArrayBase<Derived>& x)
Returns | an expression of the coefficient-wise power of the scalar x to the given array of exponents. |
---|
This function computes the coefficient-wise power between a scalar and an array of exponents.
Example:
Array<double,1,3> e(2,-3,1./3.); cout << "10^[" << e << "] = " << pow(10,e) << endl;
Output:
10^[ 2 -3 0.333] = 100 0.001 2.15