ArrayCwiseBinaryOps.h File Reference

Go to the source code of this file.

Macros

#define EIGEN_MAKE_CWISE_COMP_OP(OP, COMPARATOR)
 
#define EIGEN_MAKE_CWISE_COMP_R_OP(OP, R_OP, RCOMPARATOR)
 

Functions

template<typename OtherDerived >
const CwiseBinaryOp< absolute_difference< Scalar >, const Derived, const OtherDerived > absolute_difference (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
 
const CwiseBinaryOp< internal::scalar_absolute_difference_op< Scalar, Scalar >, const Derived, const CwiseNullaryOp< internal::scalar_constant_op< Scalar >, PlainObject > > absolute_difference (const Scalar &other) const
 
template<typename OtherDerived >
const CwiseBinaryOp< atan2< Scalar >, const Derived, const OtherDerived > atan2 (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
 
template<int NaNPropagation = PropagateFast, typename OtherDerived >
const CwiseBinaryOp< internal::scalar_max_op< Scalar, Scalar, NaNPropagation >, const Derived, const OtherDerived > max (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
 
template<int NaNPropagation = PropagateFast>
const CwiseBinaryOp< internal::scalar_max_op< Scalar, Scalar, NaNPropagation >, const Derived, const CwiseNullaryOp< internal::scalar_constant_op< Scalar >, PlainObject > > max (const Scalar &other) const
 
template<int NaNPropagation = PropagateFast, typename OtherDerived >
const CwiseBinaryOp< internal::scalar_min_op< Scalar, Scalar, NaNPropagation >, const Derived, const OtherDerived > min (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
 
template<int NaNPropagation = PropagateFast>
const CwiseBinaryOp< internal::scalar_min_op< Scalar, Scalar, NaNPropagation >, const Derived, const CwiseNullaryOp< internal::scalar_constant_op< Scalar >, PlainObject > > min (const Scalar &other) const
 
template<typename OtherDerived >
const CwiseBinaryOp< internal::scalar_product_op< Derived ::Scalar, OtherDerived ::Scalar >, const Derived, const OtherDerived > operator* (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
 
template<typename T >
const CwiseBinaryOp< internal::scalar_sum_op< Scalar, T >, Derived, Constant< T > > operator+ (const T &scalar) const
 
template<typename T >
const CwiseBinaryOp< internal::scalar_sum_op< T, Scalar >, Constant< T >, Derived > operator+ (const T &scalar, const StorageBaseType &expr)
 
template<typename T >
const CwiseBinaryOp< internal::scalar_difference_op< Scalar, T >, Derived, Constant< T > > operator- (const T &scalar) const
 
template<typename T >
const CwiseBinaryOp< internal::scalar_difference_op< T, Scalar >, Constant< T >, Derived > operator- (const T &scalar, const StorageBaseType &expr)
 
template<typename OtherDerived >
const CwiseBinaryOp< internal::scalar_quotient_op< Scalar, typename OtherDerived::Scalar >, const Derived, const OtherDerived > operator/ (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
 
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. More...
 
template<typename OtherDerived >
const CwiseBinaryOp< pow< Scalar >, const Derived, const OtherDerived > pow (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
 
template<typename DerivedQ >
const CwiseBinaryOp< internal::scalar_zeta_op< Scalar >, const Derived, const DerivedQ > zeta (const EIGEN_CURRENT_STORAGE_BASE_CLASS< DerivedQ > &q) const
 

Macro Definition Documentation

◆ EIGEN_MAKE_CWISE_COMP_OP

#define EIGEN_MAKE_CWISE_COMP_OP (   OP,
  COMPARATOR 
)

Definition at line 146 of file ArrayCwiseBinaryOps.h.

◆ EIGEN_MAKE_CWISE_COMP_R_OP

#define EIGEN_MAKE_CWISE_COMP_R_OP (   OP,
  R_OP,
  RCOMPARATOR 
)

Definition at line 164 of file ArrayCwiseBinaryOps.h.

Function Documentation

◆ absolute_difference() [1/2]

template<typename OtherDerived >
const CwiseBinaryOp< absolute_difference <Scalar>, const Derived, const OtherDerived> absolute_difference ( const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &  other) const
Returns
an expression of the coefficient-wise absdiff of *this and other

Example:

Output:

See also
absolute_difference()

◆ absolute_difference() [2/2]

const CwiseBinaryOp<internal::scalar_absolute_difference_op<Scalar,Scalar>, const Derived, const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> > absolute_difference ( const Scalar &  other) const
inline
Returns
an expression of the coefficient-wise absolute_difference of *this and scalar other
See also
absolute_difference()

Definition at line 119 of file ArrayCwiseBinaryOps.h.

124 {
125  return (absolute_difference)(Derived::PlainObject::Constant(rows(), cols(), other));
126 }
const CwiseBinaryOp< absolute_difference< Scalar >, const Derived, const OtherDerived > absolute_difference(const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const

◆ atan2()

template<typename OtherDerived >
const CwiseBinaryOp< atan2 <Scalar>, const Derived, const OtherDerived> atan2 ( const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &  other) const
Returns
an expression of the coefficient-wise atan2(*this, y), where y is the given array argument.

This function computes the coefficient-wise atan2.

◆ max() [1/2]

template<int NaNPropagation = PropagateFast, typename OtherDerived >
const CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar,NaNPropagation>, const Derived, const OtherDerived> max ( const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &  other) const
inline
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;
Array< int, Dynamic, 1 > v
RowVector3d w
Array< double, 3, 1 > Array3d
Definition: Array.h:346

Output:

4
3
4
See also
min()

Definition at line 75 of file ArrayCwiseBinaryOps.h.

80 {
81  return CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar,NaNPropagation>, const Derived, const OtherDerived>(derived(), other.derived());
82 }

◆ max() [2/2]

template<int NaNPropagation = PropagateFast>
const CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar,NaNPropagation>, const Derived, const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> > max ( const Scalar &  other) const
inline
Returns
an expression of the coefficient-wise max of *this and scalar other
See also
min()

Definition at line 93 of file ArrayCwiseBinaryOps.h.

98 {
99  return (max<NaNPropagation>)(Derived::PlainObject::Constant(rows(), cols(), other));
100 }

◆ min() [1/2]

template<int NaNPropagation = PropagateFast, typename OtherDerived >
const CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar,NaNPropagation>, const Derived, const OtherDerived> min ( const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &  other) const
inline
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
See also
max()

Definition at line 37 of file ArrayCwiseBinaryOps.h.

42 {
43  return CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar,NaNPropagation>, const Derived, const OtherDerived>(derived(), other.derived());
44 }

◆ min() [2/2]

template<int NaNPropagation = PropagateFast>
const CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar,NaNPropagation>, const Derived, const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> > min ( const Scalar &  other) const
inline
Returns
an expression of the coefficient-wise min of *this and scalar other
See also
max()

Definition at line 55 of file ArrayCwiseBinaryOps.h.

60 {
61  return (min<NaNPropagation>)(Derived::PlainObject::Constant(rows(), cols(), other));
62 }

◆ operator*()

template<typename OtherDerived >
const CwiseBinaryOp< internal::scalar_product_op < Derived ::Scalar, OtherDerived ::Scalar>, const Derived , const OtherDerived > operator* ( const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &  other) const
inline
Returns
an expression of the coefficient wise product of *this and other
See also
MatrixBase::cwiseProduct

Definition at line 9 of file ArrayCwiseBinaryOps.h.

10 {
11  return EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,product)(derived(), other.derived());
12 }
#define EIGEN_CWISE_BINARY_RETURN_TYPE(LHS, RHS, OPNAME)
Definition: Macros.h:1182

◆ operator+() [1/2]

template<typename T >
const CwiseBinaryOp<internal::scalar_sum_op<Scalar,T>,Derived,Constant<T> > operator+ ( const T scalar) const
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
See also
all(), any(), operator>(), operator<=()
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
1
0
See also
all(), any(), operator>=(), operator<()
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:

0
0
1
See also
all(), any(), operator>=(), operator<()
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:

0
1
1
See also
all(), any(), operator>(), operator<=()
Returns
an expression of the coefficient-wise == operator of *this and other
Warning
this performs an exact comparison, which is generally a bad idea with floating-point types. In order to check for equality between two vectors or matrices with floating-point coefficients, it is generally a far better idea to use a fuzzy comparison as provided by isApprox() and isMuchSmallerThan().

Example:

Array3d v(1,2,3), w(3,2,1);
cout << (v==w) << endl;

Output:

0
1
0
See also
all(), any(), isApprox(), isMuchSmallerThan()
Returns
an expression of the coefficient-wise != operator of *this and other
Warning
this performs an exact comparison, which is generally a bad idea with floating-point types. In order to check for equality between two vectors or matrices with floating-point coefficients, it is generally a far better idea to use a fuzzy comparison as provided by isApprox() and isMuchSmallerThan().

Example:

Array3d v(1,2,3), w(3,2,1);
cout << (v!=w) << endl;

Output:

1
0
1
See also
all(), any(), isApprox(), isMuchSmallerThan()
Returns
an expression of *this with each coeff incremented by the constant scalar
Template Parameters
Tis the scalar type of scalar. It must be compatible with the scalar type of the given expression.

Example:

Array3d v(1,2,3);
cout << v+5 << endl;

Output:

6
7
8
See also
operator+=(), operator-()

◆ operator+() [2/2]

template<typename T >
friend const CwiseBinaryOp<internal::scalar_sum_op<T,Scalar>,Constant<T>,Derived> operator+ ( const T scalar,
const StorageBaseType &  expr 
)
Returns
an expression of expr with each coeff incremented by the constant scalar
Template Parameters
Tis the scalar type of scalar. It must be compatible with the scalar type of the given expression.

◆ operator-() [1/2]

template<typename T >
const CwiseBinaryOp<internal::scalar_difference_op<Scalar,T>,Derived,Constant<T> > operator- ( const T scalar) const
Returns
an expression of *this with each coeff decremented by the constant scalar
Template Parameters
Tis the scalar type of scalar. It must be compatible with the scalar type of the given expression.

Example:

Array3d v(1,2,3);
cout << v-5 << endl;

Output:

-4
-3
-2
See also
operator+=(), operator-()

◆ operator-() [2/2]

template<typename T >
friend const CwiseBinaryOp<internal::scalar_difference_op<T,Scalar>,Constant<T>,Derived> operator- ( const T scalar,
const StorageBaseType &  expr 
)
Returns
an expression of the constant matrix of value scalar decremented by the coefficients of expr
Template Parameters
Tis the scalar type of scalar. It must be compatible with the scalar type of the given expression.

◆ operator/() [1/2]

template<typename OtherDerived >
const CwiseBinaryOp<internal::scalar_quotient_op<Scalar,typename OtherDerived::Scalar>, const Derived, const OtherDerived> operator/ ( const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &  other) const
inline
Returns
an expression of the coefficient wise quotient of *this and other
See also
MatrixBase::cwiseQuotient

Definition at line 21 of file ArrayCwiseBinaryOps.h.

22 {
23  return CwiseBinaryOp<internal::scalar_quotient_op<Scalar,typename OtherDerived::Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
24 }

◆ operator/() [2/2]

template<typename T >
friend const CwiseBinaryOp<internal::scalar_quotient_op<T,Scalar>,Constant<T>,Derived> operator/ ( const T s,
const StorageBaseType &  a 
)
inline

Component-wise division of the scalar s by array elements of a.

Template Parameters
Scalaris the scalar type of x. It must be compatible with the scalar type of the given array expression (Derived::Scalar).

◆ pow()

template<typename OtherDerived >
const CwiseBinaryOp< pow <Scalar>, const Derived, const OtherDerived> pow ( const EIGEN_CURRENT_STORAGE_BASE_CLASS< 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
Array< double, 1, 3 > e(1./3., 0.5, 2.)
const GlobalUnaryPowReturnType< Derived, ScalarExponent > pow(const Eigen::ArrayBase< Derived > &x, const ScalarExponent &exponent)

Output:

[ 8 25  3]^[0.333   0.5     2] = 2 5 9
[ 8 25  3]^[0.333   0.5     2] = 2 5 9

◆ zeta()

template<typename DerivedQ >
const CwiseBinaryOp<internal::scalar_zeta_op<Scalar>, const Derived, const DerivedQ> zeta ( const EIGEN_CURRENT_STORAGE_BASE_CLASS< DerivedQ > &  q) const
inline
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:

Parameters
qis the shift, it must be > 0
Note
*this is the exponent, it must be > 1.
This function supports only float and double scalar types. To support other scalar types, the user has to provide implementations of zeta(T,T) for any scalar type T to be supported.

This method is an alias for zeta(*this,q);

See also
Eigen::zeta()

Definition at line 348 of file ArrayCwiseBinaryOps.h.

349 {
350  return CwiseBinaryOp<internal::scalar_zeta_op<Scalar>, const Derived, const DerivedQ>(this->derived(), q.derived());
351 }