Cwise< ExpressionType > Class Template Reference

Pseudo expression providing additional coefficient-wise operations. More...

List of all members.

Public Types

typedef ei_meta_if
< ei_must_nest_by_value
< ExpressionType >::ret,
ExpressionType, const
ExpressionType & >::ret 
ExpressionTypeNested
typedef ei_traits
< ExpressionType >::Scalar 
Scalar
typedef CwiseUnaryOp
< ei_scalar_add_op< Scalar >
, ExpressionType > 
ScalarAddReturnType

Public Member Functions

const ExpressionType & _expression () const
const CwiseUnaryOp
< ei_scalar_abs_op< typename
ei_traits< ExpressionType >
::Scalar >, ExpressionType > 
abs () const
const CwiseUnaryOp
< ei_scalar_abs2_op< typename
ei_traits< ExpressionType >
::Scalar >, ExpressionType > 
abs2 () const
const CwiseUnaryOp
< ei_scalar_cos_op< typename
ei_traits< ExpressionType >
::Scalar >, ExpressionType > 
cos () const
const CwiseUnaryOp
< ei_scalar_cube_op< typename
ei_traits< ExpressionType >
::Scalar >, ExpressionType > 
cube () const
 Cwise (const ExpressionType &matrix)
const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE (std::not_equal_to) operator!
const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE (std::equal_to) operator
const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE (std::greater_equal) operator>
const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE (std::greater) operator>(Scalar s) const
const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE (std::less_equal) operator<
const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE (std::less) operator<(Scalar s) const
const CwiseUnaryOp
< ei_scalar_exp_op< typename
ei_traits< ExpressionType >
::Scalar >, ExpressionType > 
exp () const
const CwiseUnaryOp
< ei_scalar_inverse_op
< typename ei_traits
< ExpressionType >::Scalar >
, ExpressionType > 
inverse () const
const CwiseUnaryOp
< ei_scalar_log_op< typename
ei_traits< ExpressionType >
::Scalar >, ExpressionType > 
log () const
template<typename OtherDerived >
const CwiseBinaryOp
< ei_scalar_max_op< typename
ei_traits< ExpressionType >
::Scalar >, ExpressionType,
OtherDerived > 
max (const MatrixBase< OtherDerived > &other) const
template<typename OtherDerived >
const CwiseBinaryOp
< ei_scalar_min_op< typename
ei_traits< ExpressionType >
::Scalar >, ExpressionType,
OtherDerived > 
min (const MatrixBase< OtherDerived > &other) const
template<typename OtherDerived >
const CwiseBinaryOp
< std::not_equal_to< typename
ei_traits< ExpressionType >
::Scalar >, ExpressionType,
OtherDerived > 
operator!= (const MatrixBase< OtherDerived > &other) const
template<typename OtherDerived >
const
EIGEN_CWISE_PRODUCT_RETURN_TYPE 
operator* (const MatrixBase< OtherDerived > &other) const
template<typename OtherDerived >
ExpressionType & operator*= (const MatrixBase< OtherDerived > &other)
const ScalarAddReturnType operator+ (const Scalar &scalar) const
ExpressionType & operator+= (const Scalar &scalar)
const ScalarAddReturnType operator- (const Scalar &scalar) const
ExpressionType & operator-= (const Scalar &scalar)
template<typename OtherDerived >
const CwiseBinaryOp
< ei_scalar_quotient_op
< typename ei_traits
< ExpressionType >::Scalar >
, ExpressionType, OtherDerived > 
operator/ (const MatrixBase< OtherDerived > &other) const
template<typename OtherDerived >
ExpressionType & operator/= (const MatrixBase< OtherDerived > &other)
template<typename OtherDerived >
const CwiseBinaryOp< std::less
< typename ei_traits
< ExpressionType >::Scalar >
, ExpressionType, OtherDerived > 
operator< (const MatrixBase< OtherDerived > &other) const
template<typename OtherDerived >
const CwiseBinaryOp
< std::less_equal< typename
ei_traits< ExpressionType >
::Scalar >, ExpressionType,
OtherDerived > 
operator<= (const MatrixBase< OtherDerived > &other) const
template<typename OtherDerived >
const CwiseBinaryOp
< std::equal_to< typename
ei_traits< ExpressionType >
::Scalar >, ExpressionType,
OtherDerived > 
operator== (const MatrixBase< OtherDerived > &other) const
template<typename OtherDerived >
const CwiseBinaryOp
< std::greater< typename
ei_traits< ExpressionType >
::Scalar >, ExpressionType,
OtherDerived > 
operator> (const MatrixBase< OtherDerived > &other) const
template<typename OtherDerived >
const CwiseBinaryOp
< std::greater_equal< typename
ei_traits< ExpressionType >
::Scalar >, ExpressionType,
OtherDerived > 
operator>= (const MatrixBase< OtherDerived > &other) const
const CwiseUnaryOp
< ei_scalar_pow_op< typename
ei_traits< ExpressionType >
::Scalar >, ExpressionType > 
pow (const Scalar &exponent) const
const CwiseUnaryOp
< ei_scalar_sin_op< typename
ei_traits< ExpressionType >
::Scalar >, ExpressionType > 
sin () const
const CwiseUnaryOp
< ei_scalar_sqrt_op< typename
ei_traits< ExpressionType >
::Scalar >, ExpressionType > 
sqrt () const
const CwiseUnaryOp
< ei_scalar_square_op
< typename ei_traits
< ExpressionType >::Scalar >
, ExpressionType > 
square () const

Protected Attributes

ExpressionTypeNested m_matrix

Related Functions

(Note that these are not member functions.)



const ScalarAddReturnType operator+ (const Scalar &scalar, const Cwise &mat)

Detailed Description

template<typename ExpressionType>
class Eigen::Cwise< ExpressionType >

Pseudo expression providing additional coefficient-wise operations.

Parameters:
ExpressionType the type of the object on which to do coefficient-wise operations

This class represents an expression with additional coefficient-wise features. It is the return type of MatrixBase::cwise() and most of the time this is the only way it is used.

Note that some methods are defined in the Array module.

Example:

Vector3d v(-1,2,-3);
cout << "the absolute values:" << endl << v.cwise().abs() << endl;
cout << "the absolute values plus one:" << endl << v.cwise().abs().cwise()+1 << endl;
cout << "sum of the squares: " << v.cwise().square().sum() << endl;

Output:

the absolute values:
1
2
3
the absolute values plus one:
2
3
4
sum of the squares: 14
See also:
MatrixBase::cwise() const, MatrixBase::cwise()

Member Function Documentation

const CwiseUnaryOp< ei_scalar_abs_op< typename ei_traits< ExpressionType >::Scalar >, ExpressionType > abs (  )  const [inline]
Returns:
an expression of the coefficient-wise absolute value of *this

Example:

Vector3d v(1,-2,-3);
cout << v.cwise().abs() << endl;

Output:

1
2
3
See also:
abs2()
const CwiseUnaryOp< ei_scalar_abs2_op< typename ei_traits< ExpressionType >::Scalar >, ExpressionType > abs2 (  )  const [inline]
Returns:
an expression of the coefficient-wise squared absolute value of *this

Example:

Vector3d v(1,-2,-3);
cout << v.cwise().abs2() << endl;

Output:

1
4
9
See also:
abs(), square()
const CwiseBinaryOp< ei_scalar_max_op< typename ei_traits< ExpressionType >::Scalar >, ExpressionType, OtherDerived > max ( const MatrixBase< OtherDerived > &  other  )  const [inline]
Returns:
an expression of the coefficient-wise max of *this and other

Example:

Vector3d v(2,3,4), w(4,2,3);
cout << v.cwise().max(w) << endl;

Output:

4
3
4
See also:
class CwiseBinaryOp
const CwiseBinaryOp< ei_scalar_min_op< typename ei_traits< ExpressionType >::Scalar >, ExpressionType, OtherDerived > min ( const MatrixBase< OtherDerived > &  other  )  const [inline]
Returns:
an expression of the coefficient-wise min of *this and other

Example:

Vector3d v(2,3,4), w(4,2,3);
cout << v.cwise().min(w) << endl;

Output:

2
2
3
See also:
class CwiseBinaryOp
const EIGEN_CWISE_PRODUCT_RETURN_TYPE operator* ( const MatrixBase< OtherDerived > &  other  )  const [inline]
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.cwise() * 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
See also:
class CwiseBinaryOp, operator/(), square()
ExpressionType & operator*= ( const MatrixBase< OtherDerived > &  other  )  [inline]

Replaces this expression by its coefficient-wise product with other.

Example:

Vector3d v(1,2,3);
Vector3d w(2,3,0);
v.cwise() *= w;
cout << v << endl;

Output:

2
6
0
See also:
operator*(), operator/=()
const Cwise< ExpressionType >::ScalarAddReturnType operator+ ( const Scalar &  scalar  )  const [inline]

This is defined in the Array module.

 #include <Eigen/Array> 
Returns:
an expression of *this with each coeff incremented by the constant scalar

Example:

Vector3d v(1,2,3);
cout << v.cwise()+5 << endl;

Output:

6
7
8
See also:
operator+=(), operator-()
ExpressionType & operator+= ( const Scalar &  scalar  )  [inline]

This is defined in the Array module.

 #include <Eigen/Array> 

Adds the given scalar to each coeff of this expression.

Example:

Vector3d v(1,2,3);
v.cwise() += 5;
cout << v << endl;

Output:

6
7
8
See also:
operator+(), operator-=()
const Cwise< ExpressionType >::ScalarAddReturnType operator- ( const Scalar &  scalar  )  const [inline]

This is defined in the Array module.

 #include <Eigen/Array> 
Returns:
an expression of *this with each coeff decremented by the constant scalar

Example:

Vector3d v(1,2,3);
cout << v.cwise()-5 << endl;

Output:

-4
-3
-2
See also:
operator+(), operator-=()
ExpressionType & operator-= ( const Scalar &  scalar  )  [inline]

This is defined in the Array module.

 #include <Eigen/Array> 

Substracts the given scalar from each coeff of this expression.

Example:

Vector3d v(1,2,3);
v.cwise() -= 5;
cout << v << endl;

Output:

-4
-3
-2
See also:
operator+=(), operator-()
const CwiseBinaryOp< ei_scalar_quotient_op< typename ei_traits< ExpressionType >::Scalar >, ExpressionType, OtherDerived > operator/ ( const MatrixBase< OtherDerived > &  other  )  const [inline]
Returns:
an expression of the coefficient-wise quotient of *this and other

Example:

Vector3d v(2,3,4), w(4,2,3);
cout << v.cwise()/w << endl;

Output:

0.5
1.5
1.33
See also:
class CwiseBinaryOp, operator*(), inverse()
ExpressionType & operator/= ( const MatrixBase< OtherDerived > &  other  )  [inline]

Replaces this expression by its coefficient-wise quotient by other.

Example:

Vector3d v(3,2,4);
Vector3d w(5,4,2);
v.cwise() /= w;
cout << v << endl;

Output:

0.6
0.5
2
See also:
operator/(), operator*=()

Friends And Related Function Documentation

const ScalarAddReturnType operator+ ( const Scalar &  scalar,
const Cwise< ExpressionType > &  mat 
) [friend]

The documentation for this class was generated from the following files:

Generated on Mon Aug 31 17:48:40 2009 for Eigen by  doxygen 1.6.1