Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType > Class Template Reference

Generic expression where a coefficient-wise binary operator is applied to two expressions. More...

+ Inheritance diagram for Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >:

Public Types

typedef CwiseBinaryOpImpl< BinaryOp, LhsType, RhsType, typename internal::cwise_promote_storage_type< typename internal::traits< LhsType >::StorageKind, typename internal::traits< Rhs >::StorageKind, BinaryOp >::ret >::Base Base
 
typedef internal::remove_all_t< BinaryOpFunctor
 
typedef internal::remove_all_t< LhsType > Lhs
 
typedef internal::ref_selector< LhsType >::type LhsNested
 
typedef std::remove_reference_t< LhsNestedLhsNested_
 
typedef internal::remove_all_t< RhsType > Rhs
 
typedef internal::ref_selector< RhsType >::type RhsNested
 
typedef std::remove_reference_t< RhsNestedRhsNested_
 

Public Member Functions

EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
 
 CwiseBinaryOp (const Lhs &aLhs, const Rhs &aRhs, const BinaryOp &func=BinaryOp())
 
const BinaryOpfunctor () const
 
const LhsNested_lhs () const
 
const RhsNested_rhs () const
 
EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
 

Protected Attributes

const BinaryOp m_functor
 
LhsNested m_lhs
 
RhsNested m_rhs
 

Detailed Description

template<typename BinaryOp, typename LhsType, typename RhsType>
class Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >

Generic expression where a coefficient-wise binary operator is applied to two expressions.

Template Parameters
BinaryOptemplate functor implementing the operator
LhsTypethe type of the left-hand side
RhsTypethe type of the right-hand side

This class represents an expression where a coefficient-wise binary operator is applied to two expressions. It is the return type of binary operators, by which we mean only those binary operators where both the left-hand side and the right-hand side are Eigen expressions. For example, the return type of matrix1+matrix2 is a CwiseBinaryOp.

Most of the time, this is the only way that it is used, so you typically don't have to name CwiseBinaryOp types explicitly.

See also
MatrixBase::binaryExpr(const MatrixBase<OtherDerived> &,const CustomBinaryOp &) const, class CwiseUnaryOp, class CwiseNullaryOp

Definition at line 79 of file CwiseBinaryOp.h.

Member Typedef Documentation

◆ Base

template<typename BinaryOp , typename LhsType , typename RhsType >
typedef CwiseBinaryOpImpl< BinaryOp, LhsType, RhsType, typename internal::cwise_promote_storage_type<typename internal::traits<LhsType>::StorageKind, typename internal::traits<Rhs>::StorageKind, BinaryOp>::ret>::Base Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >::Base

Definition at line 97 of file CwiseBinaryOp.h.

◆ Functor

template<typename BinaryOp , typename LhsType , typename RhsType >
typedef internal::remove_all_t<BinaryOp> Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >::Functor

Definition at line 89 of file CwiseBinaryOp.h.

◆ Lhs

template<typename BinaryOp , typename LhsType , typename RhsType >
typedef internal::remove_all_t<LhsType> Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >::Lhs

Definition at line 90 of file CwiseBinaryOp.h.

◆ LhsNested

template<typename BinaryOp , typename LhsType , typename RhsType >
typedef internal::ref_selector<LhsType>::type Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >::LhsNested

Definition at line 103 of file CwiseBinaryOp.h.

◆ LhsNested_

template<typename BinaryOp , typename LhsType , typename RhsType >
typedef std::remove_reference_t<LhsNested> Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >::LhsNested_

Definition at line 105 of file CwiseBinaryOp.h.

◆ Rhs

template<typename BinaryOp , typename LhsType , typename RhsType >
typedef internal::remove_all_t<RhsType> Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >::Rhs

Definition at line 91 of file CwiseBinaryOp.h.

◆ RhsNested

template<typename BinaryOp , typename LhsType , typename RhsType >
typedef internal::ref_selector<RhsType>::type Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >::RhsNested

Definition at line 104 of file CwiseBinaryOp.h.

◆ RhsNested_

template<typename BinaryOp , typename LhsType , typename RhsType >
typedef std::remove_reference_t<RhsNested> Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >::RhsNested_

Definition at line 106 of file CwiseBinaryOp.h.

Constructor & Destructor Documentation

◆ CwiseBinaryOp()

template<typename BinaryOp , typename LhsType , typename RhsType >
Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >::CwiseBinaryOp ( const Lhs aLhs,
const Rhs aRhs,
const BinaryOp func = BinaryOp() 
)
inline

Definition at line 115 of file CwiseBinaryOp.h.

116  : m_lhs(aLhs), m_rhs(aRhs), m_functor(func)
117  {
118  eigen_assert(aLhs.rows() == aRhs.rows() && aLhs.cols() == aRhs.cols());
119  }
#define eigen_assert(x)
Definition: Macros.h:902
const BinaryOp m_functor

Member Function Documentation

◆ cols()

template<typename BinaryOp , typename LhsType , typename RhsType >
EIGEN_CONSTEXPR Index Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >::cols ( ) const
inline

Definition at line 127 of file CwiseBinaryOp.h.

127  {
128  // return the fixed size type if available to enable compile time optimizations
129  return internal::traits<internal::remove_all_t<LhsNested>>::ColsAtCompileTime==Dynamic ? m_rhs.cols() : m_lhs.cols();
130  }
const int Dynamic
Definition: Constants.h:24

◆ functor()

template<typename BinaryOp , typename LhsType , typename RhsType >
const BinaryOp& Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >::functor ( ) const
inline
Returns
the functor representing the binary operation

Definition at line 140 of file CwiseBinaryOp.h.

140 { return m_functor; }

◆ lhs()

template<typename BinaryOp , typename LhsType , typename RhsType >
const LhsNested_& Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >::lhs ( ) const
inline
Returns
the left hand side nested expression

Definition at line 134 of file CwiseBinaryOp.h.

134 { return m_lhs; }

◆ rhs()

template<typename BinaryOp , typename LhsType , typename RhsType >
const RhsNested_& Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >::rhs ( ) const
inline
Returns
the right hand side nested expression

Definition at line 137 of file CwiseBinaryOp.h.

137 { return m_rhs; }

◆ rows()

template<typename BinaryOp , typename LhsType , typename RhsType >
EIGEN_CONSTEXPR Index Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >::rows ( ) const
inline

Definition at line 122 of file CwiseBinaryOp.h.

122  {
123  // return the fixed size type if available to enable compile time optimizations
124  return internal::traits<internal::remove_all_t<LhsNested>>::RowsAtCompileTime==Dynamic ? m_rhs.rows() : m_lhs.rows();
125  }

Member Data Documentation

◆ m_functor

template<typename BinaryOp , typename LhsType , typename RhsType >
const BinaryOp Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >::m_functor
protected

Definition at line 145 of file CwiseBinaryOp.h.

◆ m_lhs

template<typename BinaryOp , typename LhsType , typename RhsType >
LhsNested Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >::m_lhs
protected

Definition at line 143 of file CwiseBinaryOp.h.

◆ m_rhs

template<typename BinaryOp , typename LhsType , typename RhsType >
RhsNested Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >::m_rhs
protected

Definition at line 144 of file CwiseBinaryOp.h.


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