MatrixCwiseUnaryOps.h File Reference

Go to the source code of this file.

Typedefs

typedef CwiseUnaryOp< internal::scalar_abs2_op< Scalar >, const Derived > CwiseAbs2ReturnType
 
typedef CwiseUnaryOp< internal::scalar_abs_op< Scalar >, const Derived > CwiseAbsReturnType
 
typedef CwiseUnaryOp< internal::scalar_arg_op< Scalar >, const Derived > CwiseArgReturnType
 
typedef CwiseUnaryOp< internal::scalar_carg_op< Scalar >, const Derived > CwiseCArgReturnType
 
typedef CwiseUnaryOp< internal::scalar_inverse_op< Scalar >, const Derived > CwiseInverseReturnType
 
template<typename ScalarExponent >
using CwisePowReturnType = std::enable_if_t< internal::is_arithmetic< typename NumTraits< ScalarExponent >::Real >::value, CwiseUnaryOp< internal::scalar_unary_pow_op< Scalar, ScalarExponent >, const Derived > >
 
typedef CwiseUnaryOp< internal::scalar_sign_op< Scalar >, const Derived > CwiseSignReturnType
 
typedef CwiseUnaryOp< internal::scalar_sqrt_op< Scalar >, const Derived > CwiseSqrtReturnType
 

Functions

const CwiseAbsReturnType cwiseAbs () const
 
const CwiseAbs2ReturnType cwiseAbs2 () const
 
const CwiseArgReturnType cwiseArg () const
 
const CwiseCArgReturnType cwiseCArg () const
 
const CwiseInverseReturnType cwiseInverse () const
 
template<typename ScalarExponent >
const CwisePowReturnType< ScalarExponent > cwisePow (const ScalarExponent &exponent) const
 
const CwiseSignReturnType cwiseSign () const
 
const CwiseSqrtReturnType cwiseSqrt () const
 

Typedef Documentation

◆ CwiseAbs2ReturnType

typedef CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived> CwiseAbs2ReturnType

Definition at line 16 of file MatrixCwiseUnaryOps.h.

◆ CwiseAbsReturnType

typedef CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived> CwiseAbsReturnType

Definition at line 15 of file MatrixCwiseUnaryOps.h.

◆ CwiseArgReturnType

typedef CwiseUnaryOp<internal::scalar_arg_op<Scalar>, const Derived> CwiseArgReturnType

Definition at line 17 of file MatrixCwiseUnaryOps.h.

◆ CwiseCArgReturnType

typedef CwiseUnaryOp<internal::scalar_carg_op<Scalar>, const Derived> CwiseCArgReturnType

Definition at line 18 of file MatrixCwiseUnaryOps.h.

◆ CwiseInverseReturnType

typedef CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived> CwiseInverseReturnType

Definition at line 21 of file MatrixCwiseUnaryOps.h.

◆ CwisePowReturnType

template<typename ScalarExponent >
using CwisePowReturnType = std::enable_if_t<internal::is_arithmetic<typename NumTraits<ScalarExponent>::Real>::value, CwiseUnaryOp<internal::scalar_unary_pow_op<Scalar, ScalarExponent>, const Derived> >

Definition at line 103 of file MatrixCwiseUnaryOps.h.

◆ CwiseSignReturnType

typedef CwiseUnaryOp<internal::scalar_sign_op<Scalar>, const Derived> CwiseSignReturnType

Definition at line 20 of file MatrixCwiseUnaryOps.h.

◆ CwiseSqrtReturnType

typedef CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived> CwiseSqrtReturnType

Definition at line 19 of file MatrixCwiseUnaryOps.h.

Function Documentation

◆ cwiseAbs()

const CwiseAbsReturnType cwiseAbs ( ) const
inline
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;
Matrix3f m
Matrix< double, Dynamic, Dynamic > MatrixXd
Dynamic×Dynamic matrix of type double.
Definition: Matrix.h:502

Output:

2 4 6
5 1 0
See also
cwiseAbs2()

Definition at line 34 of file MatrixCwiseUnaryOps.h.

34 { return CwiseAbsReturnType(derived()); }
CwiseUnaryOp< internal::scalar_abs_op< Scalar >, const Derived > CwiseAbsReturnType

◆ cwiseAbs2()

const CwiseAbs2ReturnType cwiseAbs2 ( ) const
inline
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:

 4 16 36
25  1  0
See also
cwiseAbs()

Definition at line 47 of file MatrixCwiseUnaryOps.h.

47 { return CwiseAbs2ReturnType(derived()); }
CwiseUnaryOp< internal::scalar_abs2_op< Scalar >, const Derived > CwiseAbs2ReturnType

◆ cwiseArg()

const CwiseArgReturnType cwiseArg ( ) const
inline
Returns
an expression of the coefficient-wise phase angle of *this

Example:

MatrixXcf v = MatrixXcf::Random(2, 3);
cout << v << endl << endl;
cout << v.cwiseArg() << endl;
Array< int, Dynamic, 1 > v
Matrix< std::complex< float >, Dynamic, Dynamic > MatrixXcf
Dynamic×Dynamic matrix of type std::complex<float>.
Definition: Matrix.h:503

Output:

  (-0.211,0.68)  (-0.605,0.823)  (0.108,-0.444)
  (0.597,0.566)   (0.536,-0.33) (0.258,-0.0452)

  1.87    2.2  -1.33
 0.759 -0.551 -0.174

Definition at line 96 of file MatrixCwiseUnaryOps.h.

96 { return CwiseArgReturnType(derived()); }
CwiseUnaryOp< internal::scalar_arg_op< Scalar >, const Derived > CwiseArgReturnType

◆ cwiseCArg()

const CwiseCArgReturnType cwiseCArg ( ) const
inline

Definition at line 100 of file MatrixCwiseUnaryOps.h.

100 { return CwiseCArgReturnType(derived()); }
CwiseUnaryOp< internal::scalar_carg_op< Scalar >, const Derived > CwiseCArgReturnType

◆ cwiseInverse()

const CwiseInverseReturnType cwiseInverse ( ) const
inline
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:

  0.5     2     1
0.333     4     1
See also
cwiseProduct()

Definition at line 85 of file MatrixCwiseUnaryOps.h.

85 { return CwiseInverseReturnType(derived()); }
CwiseUnaryOp< internal::scalar_inverse_op< Scalar >, const Derived > CwiseInverseReturnType

◆ cwisePow()

template<typename ScalarExponent >
const CwisePowReturnType<ScalarExponent> cwisePow ( const ScalarExponent &  exponent) const
inline

Definition at line 108 of file MatrixCwiseUnaryOps.h.

108  {
109  return CwisePowReturnType<ScalarExponent>(derived(), internal::scalar_unary_pow_op<Scalar, ScalarExponent>(exponent));
110 }
std::enable_if_t< internal::is_arithmetic< typename NumTraits< ScalarExponent >::Real >::value, CwiseUnaryOp< internal::scalar_unary_pow_op< Scalar, ScalarExponent >, const Derived > > CwisePowReturnType

◆ cwiseSign()

const CwiseSignReturnType cwiseSign ( ) const
inline
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

Definition at line 71 of file MatrixCwiseUnaryOps.h.

71 { return CwiseSignReturnType(derived()); }
CwiseUnaryOp< internal::scalar_sign_op< Scalar >, const Derived > CwiseSignReturnType

◆ cwiseSqrt()

const CwiseSqrtReturnType cwiseSqrt ( ) const
inline
Returns
an expression of the coefficient-wise square root of *this.

Example:

Vector3d v(1,2,4);
cout << v.cwiseSqrt() << endl;
Matrix< double, 3, 1 > Vector3d
3×1 vector of type double.
Definition: Matrix.h:502

Output:

   1
1.41
   2
See also
cwisePow(), cwiseSquare()

Definition at line 60 of file MatrixCwiseUnaryOps.h.

60 { return CwiseSqrtReturnType(derived()); }
CwiseUnaryOp< internal::scalar_sqrt_op< Scalar >, const Derived > CwiseSqrtReturnType