Eigen::Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType > Class Template Reference

Expression of a coefficient wise version of the C++ ternary operator ?: More...

Inherits internal::dense_xpr_base::type, and Eigen::internal::no_assignment_operator.

Public Types

typedef internal::dense_xpr_base< Select >::type Base
 

Public Member Functions

const Scalar coeff (Index i) const
 
const Scalar coeff (Index i, Index j) const
 
EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
 
const ConditionMatrixType & conditionMatrix () const
 
const ElseMatrixType & elseMatrix () const
 
EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
 
 Select (const ConditionMatrixType &a_conditionMatrix, const ThenMatrixType &a_thenMatrix, const ElseMatrixType &a_elseMatrix)
 
const ThenMatrixType & thenMatrix () const
 

Protected Attributes

ConditionMatrixType::Nested m_condition
 
ElseMatrixType::Nested m_else
 
ThenMatrixType::Nested m_then
 

Detailed Description

template<typename ConditionMatrixType, typename ThenMatrixType, typename ElseMatrixType>
class Eigen::Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType >

Expression of a coefficient wise version of the C++ ternary operator ?:

Template Parameters
ConditionMatrixTypethe type of the condition expression which must be a boolean matrix
ThenMatrixTypethe type of the then expression
ElseMatrixTypethe type of the else expression

This class represents an expression of a coefficient wise version of the C++ ternary operator ?:. It is the return type of DenseBase::select() and most of the time this is the only way it is used.

See also
DenseBase::select(const DenseBase<ThenDerived>&, const DenseBase<ElseDerived>&) const

Definition at line 54 of file Select.h.

Member Typedef Documentation

◆ Base

template<typename ConditionMatrixType , typename ThenMatrixType , typename ElseMatrixType >
typedef internal::dense_xpr_base<Select>::type Eigen::Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType >::Base

Definition at line 59 of file Select.h.

Constructor & Destructor Documentation

◆ Select()

template<typename ConditionMatrixType , typename ThenMatrixType , typename ElseMatrixType >
Eigen::Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType >::Select ( const ConditionMatrixType &  a_conditionMatrix,
const ThenMatrixType &  a_thenMatrix,
const ElseMatrixType &  a_elseMatrix 
)
inline

Definition at line 63 of file Select.h.

66  : m_condition(a_conditionMatrix), m_then(a_thenMatrix), m_else(a_elseMatrix)
67  {
68  eigen_assert(m_condition.rows() == m_then.rows() && m_condition.rows() == m_else.rows());
69  eigen_assert(m_condition.cols() == m_then.cols() && m_condition.cols() == m_else.cols());
70  }
#define eigen_assert(x)
Definition: Macros.h:902
ElseMatrixType::Nested m_else
Definition: Select.h:113
ConditionMatrixType::Nested m_condition
Definition: Select.h:111
ThenMatrixType::Nested m_then
Definition: Select.h:112

Member Function Documentation

◆ coeff() [1/2]

template<typename ConditionMatrixType , typename ThenMatrixType , typename ElseMatrixType >
const Scalar Eigen::Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType >::coeff ( Index  i) const
inline

Definition at line 87 of file Select.h.

88  {
89  if (m_condition.coeff(i))
90  return m_then.coeff(i);
91  else
92  return m_else.coeff(i);
93  }

◆ coeff() [2/2]

template<typename ConditionMatrixType , typename ThenMatrixType , typename ElseMatrixType >
const Scalar Eigen::Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType >::coeff ( Index  i,
Index  j 
) const
inline

Definition at line 78 of file Select.h.

79  {
80  if (m_condition.coeff(i,j))
81  return m_then.coeff(i,j);
82  else
83  return m_else.coeff(i,j);
84  }
std::ptrdiff_t j

◆ cols()

template<typename ConditionMatrixType , typename ThenMatrixType , typename ElseMatrixType >
EIGEN_CONSTEXPR Index Eigen::Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType >::cols ( void  ) const
inline

Definition at line 75 of file Select.h.

75 { return m_condition.cols(); }

◆ conditionMatrix()

template<typename ConditionMatrixType , typename ThenMatrixType , typename ElseMatrixType >
const ConditionMatrixType& Eigen::Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType >::conditionMatrix ( ) const
inline

Definition at line 95 of file Select.h.

96  {
97  return m_condition;
98  }

◆ elseMatrix()

template<typename ConditionMatrixType , typename ThenMatrixType , typename ElseMatrixType >
const ElseMatrixType& Eigen::Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType >::elseMatrix ( ) const
inline

Definition at line 105 of file Select.h.

106  {
107  return m_else;
108  }

◆ rows()

template<typename ConditionMatrixType , typename ThenMatrixType , typename ElseMatrixType >
EIGEN_CONSTEXPR Index Eigen::Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType >::rows ( void  ) const
inline

Definition at line 73 of file Select.h.

73 { return m_condition.rows(); }

◆ thenMatrix()

template<typename ConditionMatrixType , typename ThenMatrixType , typename ElseMatrixType >
const ThenMatrixType& Eigen::Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType >::thenMatrix ( ) const
inline

Definition at line 100 of file Select.h.

101  {
102  return m_then;
103  }

Member Data Documentation

◆ m_condition

template<typename ConditionMatrixType , typename ThenMatrixType , typename ElseMatrixType >
ConditionMatrixType::Nested Eigen::Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType >::m_condition
protected

Definition at line 111 of file Select.h.

◆ m_else

template<typename ConditionMatrixType , typename ThenMatrixType , typename ElseMatrixType >
ElseMatrixType::Nested Eigen::Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType >::m_else
protected

Definition at line 113 of file Select.h.

◆ m_then

template<typename ConditionMatrixType , typename ThenMatrixType , typename ElseMatrixType >
ThenMatrixType::Nested Eigen::Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType >::m_then
protected

Definition at line 112 of file Select.h.


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