Typedefs | Functions
CommonCwiseUnaryOps.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef internal::conditional
< NumTraits< Scalar >
::IsComplex, const
CwiseUnaryOp
< internal::scalar_conjugate_op
< Scalar >, const Derived >
, const Derived & >::type 
ConjugateReturnType
typedef CwiseUnaryOp
< internal::scalar_imag_op
< Scalar >, const Derived > 
ImagReturnType
typedef CwiseUnaryView
< internal::scalar_imag_ref_op
< Scalar >, Derived > 
NonConstImagReturnType
typedef internal::conditional
< NumTraits< Scalar >
::IsComplex, CwiseUnaryView
< internal::scalar_real_ref_op
< Scalar >, Derived >, Derived & >
::type 
NonConstRealReturnType
typedef internal::conditional
< NumTraits< Scalar >
::IsComplex, const
CwiseUnaryOp
< internal::scalar_real_op
< Scalar >, const Derived >
, const Derived & >::type 
RealReturnType
typedef CwiseUnaryOp
< internal::scalar_multiple_op
< Scalar >, const Derived > 
ScalarMultipleReturnType
typedef CwiseUnaryOp
< internal::scalar_quotient1_op
< Scalar >, const Derived > 
ScalarQuotient1ReturnType

Functions

template<typename NewType >
internal::cast_return_type
< Derived, const CwiseUnaryOp
< internal::scalar_cast_op
< typename internal::traits
< Derived >::Scalar, NewType >
, const Derived > >::type 
cast () const
ConjugateReturnType conjugate () const
const ImagReturnType imag () const
const ScalarMultipleReturnType operator* (const Scalar &scalar) const
const CwiseUnaryOp
< internal::scalar_multiple2_op
< Scalar, std::complex< Scalar >
>, const Derived > 
operator* (const std::complex< Scalar > &scalar) const
const ScalarMultipleReturnType operator* (const Scalar &scalar, const StorageBaseType &matrix)
const CwiseUnaryOp
< internal::scalar_multiple2_op
< Scalar, std::complex< Scalar >
>, const Derived > 
operator* (const std::complex< Scalar > &scalar, const StorageBaseType &matrix)
const CwiseUnaryOp
< internal::scalar_opposite_op
< typename internal::traits
< Derived >::Scalar >, const
Derived > 
operator- () const
const CwiseUnaryOp
< internal::scalar_quotient1_op
< typename internal::traits
< Derived >::Scalar >, const
Derived > 
operator/ (const Scalar &scalar) const
RealReturnType real () const
template<typename CustomUnaryOp >
const CwiseUnaryOp
< CustomUnaryOp, const Derived > 
unaryExpr (const CustomUnaryOp &func=CustomUnaryOp()) const
 Apply a unary operator coefficient-wise.
template<typename CustomViewOp >
const CwiseUnaryView
< CustomViewOp, const Derived > 
unaryViewExpr (const CustomViewOp &func=CustomViewOp()) const

Typedef Documentation

Definition at line 38 of file CommonCwiseUnaryOps.h.

Definition at line 50 of file CommonCwiseUnaryOps.h.

Definition at line 52 of file CommonCwiseUnaryOps.h.

Definition at line 48 of file CommonCwiseUnaryOps.h.

Definition at line 43 of file CommonCwiseUnaryOps.h.

Definition at line 31 of file CommonCwiseUnaryOps.h.

Definition at line 33 of file CommonCwiseUnaryOps.h.


Function Documentation

template<typename NewType >
internal::cast_return_type<Derived,const CwiseUnaryOp<internal::scalar_cast_op<typename internal::traits<Derived>::Scalar, NewType>, const Derived> >::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

Definition at line 107 of file CommonCwiseUnaryOps.h.

ConjugateReturnType conjugate ( ) const [inline]
Returns:
an expression of the complex conjugate of *this.
See also:
adjoint()

Definition at line 116 of file CommonCwiseUnaryOps.h.

NonConstImagReturnType imag ( ) const [inline]
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()

Definition at line 131 of file CommonCwiseUnaryOps.h.

const ScalarMultipleReturnType operator* ( const Scalar scalar) const [inline]
Returns:
an expression of *this scaled by the scalar factor scalar

Definition at line 64 of file CommonCwiseUnaryOps.h.

const CwiseUnaryOp<internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >, const Derived> operator* ( const std::complex< Scalar > &  scalar) const [inline]

Overloaded for efficient real matrix times complex scalar value

Definition at line 84 of file CommonCwiseUnaryOps.h.

friend const ScalarMultipleReturnType operator* ( const Scalar scalar,
const StorageBaseType &  matrix 
) [inline]

Definition at line 91 of file CommonCwiseUnaryOps.h.

friend const CwiseUnaryOp<internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >, const Derived> operator* ( const std::complex< Scalar > &  scalar,
const StorageBaseType &  matrix 
) [inline]

Definition at line 95 of file CommonCwiseUnaryOps.h.

const CwiseUnaryOp<internal::scalar_opposite_op<typename internal::traits<Derived>::Scalar>, const Derived> operator- ( ) const [inline]
Returns:
an expression of the opposite of *this

Definition at line 59 of file CommonCwiseUnaryOps.h.

const CwiseUnaryOp<internal::scalar_quotient1_op<typename internal::traits<Derived>::Scalar>, const Derived> operator/ ( const Scalar scalar) const [inline]
Returns:
an expression of *this divided by the scalar value scalar

Definition at line 76 of file CommonCwiseUnaryOps.h.

NonConstRealReturnType real ( ) const [inline]
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()

Definition at line 125 of file CommonCwiseUnaryOps.h.

template<typename CustomUnaryOp >
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:

#include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;

// define function to be applied coefficient-wise
double ramp(double x)
{
  if (x > 0)
    return x;
  else 
    return 0;
}

int main(int, char**)
{
  Matrix4d m1 = Matrix4d::Random();
  cout << m1 << endl << "becomes: " << endl << m1.unaryExpr(ptr_fun(ramp)) << endl;
  return 0;
}

Output:

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

Example:

#include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;

// define a custom template unary functor
template<typename Scalar>
struct CwiseClampOp {
  CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {}
  const Scalar operator()(const Scalar& x) const { return x<m_inf ? m_inf : (x>m_sup ? m_sup : x); }
  Scalar m_inf, m_sup;
};

int main(int, char**)
{
  Matrix4d m1 = Matrix4d::Random();
  cout << m1 << endl << "becomes: " << endl << m1.unaryExpr(CwiseClampOp<double>(-0.5,0.5)) << endl;
  return 0;
}

Output:

See also:
class CwiseUnaryOp, class CwiseBinaryOp

Definition at line 154 of file CommonCwiseUnaryOps.h.

template<typename CustomViewOp >
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:

#include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;

// define a custom template unary functor
template<typename Scalar>
struct CwiseClampOp {
  CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {}
  const Scalar operator()(const Scalar& x) const { return x<m_inf ? m_inf : (x>m_sup ? m_sup : x); }
  Scalar m_inf, m_sup;
};

int main(int, char**)
{
  Matrix4d m1 = Matrix4d::Random();
  cout << m1 << endl << "becomes: " << endl << m1.unaryExpr(CwiseClampOp<double>(-0.5,0.5)) << endl;
  return 0;
}

Output:

See also:
class CwiseUnaryOp, class CwiseBinaryOp

Definition at line 172 of file CommonCwiseUnaryOps.h.



re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:33:44