55class Select : internal::no_assignment_operator,
56 public internal::dense_xpr_base< Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >::type
60 typedef typename internal::dense_xpr_base<Select>::type Base;
61 EIGEN_DENSE_PUBLIC_INTERFACE(Select)
63 Select(
const ConditionMatrixType& conditionMatrix,
64 const ThenMatrixType& thenMatrix,
65 const ElseMatrixType& elseMatrix)
66 : m_condition(conditionMatrix), m_then(thenMatrix), m_else(elseMatrix)
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());
72 Index rows()
const {
return m_condition.rows(); }
73 Index cols()
const {
return m_condition.cols(); }
75 const Scalar coeff(Index i, Index j)
const
77 if (m_condition.coeff(i,j))
78 return m_then.coeff(i,j);
80 return m_else.coeff(i,j);
83 const Scalar coeff(Index i)
const
85 if (m_condition.coeff(i))
86 return m_then.coeff(i);
88 return m_else.coeff(i);
91 const ConditionMatrixType& conditionMatrix()
const
96 const ThenMatrixType& thenMatrix()
const
101 const ElseMatrixType& elseMatrix()
const
107 typename ConditionMatrixType::Nested m_condition;
108 typename ThenMatrixType::Nested m_then;
109 typename ElseMatrixType::Nested m_else;
const Select< Derived, ThenDerived, ElseDerived > select(const DenseBase< ThenDerived > &thenMatrix, const DenseBase< ElseDerived > &elseMatrix) const
Definition Select.h:124