WPILibC++ 2023.4.3-108-ge5452e3
CommonCwiseUnaryOps.h File Reference

Go to the source code of this file.

Classes

struct  CastXpr< NewType >
 

Typedefs

typedef internal::conditional< NumTraits< Scalar >::IsComplex, constCwiseUnaryOp< internal::scalar_conjugate_op< Scalar >, constDerived >, constDerived & >::type ConjugateReturnType
 
typedef internal::conditional< NumTraits< Scalar >::IsComplex, constCwiseUnaryOp< internal::scalar_real_op< Scalar >, constDerived >, constDerived & >::type RealReturnType
 
typedef internal::conditional< NumTraits< Scalar >::IsComplex, CwiseUnaryView< internal::scalar_real_ref_op< Scalar >, Derived >, Derived & >::type NonConstRealReturnType
 
typedef CwiseUnaryOp< internal::scalar_imag_op< Scalar >, const Derived > ImagReturnType
 
typedef CwiseUnaryView< internal::scalar_imag_ref_op< Scalar >, Derived > NonConstImagReturnType
 
typedef CwiseUnaryOp< internal::scalar_opposite_op< Scalar >, const Derived > NegativeReturnType
 

Functions

EIGEN_DEVICE_FUNC const NegativeReturnType operator- () const
 
template<typename NewType >
EIGEN_DEVICE_FUNC CastXpr< NewType >::Type cast () const
 
EIGEN_DEVICE_FUNC ConjugateReturnType conjugate () const
 
template<bool Cond>
EIGEN_DEVICE_FUNC internal::conditional< Cond, ConjugateReturnType, constDerived & >::type conjugateIf () const
 
EIGEN_DEVICE_FUNC RealReturnType real () const
 
EIGEN_DEVICE_FUNC const ImagReturnType imag () const
 
template<typename CustomUnaryOp >
EIGEN_DEVICE_FUNC const CwiseUnaryOp< CustomUnaryOp, const Derived > unaryExpr (const CustomUnaryOp &func=CustomUnaryOp()) const
 Apply a unary operator coefficient-wise. More...
 
template<typename CustomViewOp >
EIGEN_DEVICE_FUNC const CwiseUnaryView< CustomViewOp, const Derived > unaryViewExpr (const CustomViewOp &func=CustomViewOp()) const
 

Typedef Documentation

◆ ConjugateReturnType

typedef internal::conditional<NumTraits<Scalar>::IsComplex,constCwiseUnaryOp<internal::scalar_conjugate_op<Scalar>,constDerived>,constDerived&>::type ConjugateReturnType

◆ ImagReturnType

typedef CwiseUnaryOp<internal::scalar_imag_op<Scalar>, const Derived> ImagReturnType

◆ NegativeReturnType

typedef CwiseUnaryOp<internal::scalar_opposite_op<Scalar>, const Derived> NegativeReturnType

◆ NonConstImagReturnType

typedef CwiseUnaryView<internal::scalar_imag_ref_op<Scalar>, Derived> NonConstImagReturnType

◆ NonConstRealReturnType

typedef internal::conditional<NumTraits<Scalar>::IsComplex,CwiseUnaryView<internal::scalar_real_ref_op<Scalar>,Derived>,Derived&>::type NonConstRealReturnType

◆ RealReturnType

typedef internal::conditional<NumTraits<Scalar>::IsComplex,constCwiseUnaryOp<internal::scalar_real_op<Scalar>,constDerived>,constDerived&>::type RealReturnType

Function Documentation

◆ cast()

template<typename NewType >
EIGEN_DEVICE_FUNC CastXpr< NewType >::Type cast ( ) const
Returns
an expression of *this with the Scalar type casted to NewScalar.

The template parameter NewScalar is the type we are casting the scalars to.

See also
class CwiseUnaryOp

◆ conjugate()

EIGEN_DEVICE_FUNC ConjugateReturnType conjugate ( ) const
inline
Returns
an expression of the complex conjugate of *this.
See also
Math functions, MatrixBase::adjoint()

◆ conjugateIf()

template<bool Cond>
EIGEN_DEVICE_FUNC internal::conditional< Cond, ConjugateReturnType, constDerived & >::type conjugateIf ( ) const
inline
Returns
an expression of the complex conjugate of *this if Cond==true, returns derived() otherwise.
See also
conjugate()

◆ imag()

Returns
an read-only expression of the imaginary part of *this.
See also
real()
Returns
a non const expression of the imaginary part of *this.
See also
real()

◆ operator-()

EIGEN_DEVICE_FUNC const NegativeReturnType operator- ( ) const
inline
Returns
an expression of the opposite of *this

◆ real()

Returns
a read-only expression of the real part of *this.
See also
imag()
Returns
a non const expression of the real part of *this.
See also
imag()

◆ unaryExpr()

template<typename CustomUnaryOp >
EIGEN_DEVICE_FUNC const CwiseUnaryOp< CustomUnaryOp, const Derived > unaryExpr ( const CustomUnaryOp &  func = CustomUnaryOp()) const
inline

Apply a unary operator coefficient-wise.

Parameters
[in]funcFunctor implementing the unary operator
Template Parameters
CustomUnaryOpType of func
Returns
An expression of a custom coefficient-wise unary operator func of *this

The function ptr_fun() from the C++ standard library can be used to make functors out of normal functions.

Example:

Output:

Genuine functors allow for more possibilities, for instance it may contain a state.

Example:

Output:

 
See also
unaryViewExpr, binaryExpr, class CwiseUnaryOp

◆ unaryViewExpr()

template<typename CustomViewOp >
EIGEN_DEVICE_FUNC const CwiseUnaryView< CustomViewOp, const Derived > unaryViewExpr ( const CustomViewOp &  func = CustomViewOp()) const
inline
Returns
an expression of a custom coefficient-wise unary operator func of *this

The template parameter CustomUnaryOp is the type of the functor of the custom unary operator.

Example:

Output:

unaryExpr, binaryExpr class CwiseUnaryOp