32struct traits<
Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
38 typedef typename ConditionMatrixType::Nested ConditionMatrixNested;
39 typedef typename ThenMatrixType::Nested ThenMatrixNested;
40 typedef typename ElseMatrixType::Nested ElseMatrixNested;
42 RowsAtCompileTime = ConditionMatrixType::RowsAtCompileTime,
43 ColsAtCompileTime = ConditionMatrixType::ColsAtCompileTime,
44 MaxRowsAtCompileTime = ConditionMatrixType::MaxRowsAtCompileTime,
45 MaxColsAtCompileTime = ConditionMatrixType::MaxColsAtCompileTime,
46 Flags = (
unsigned int)ThenMatrixType::Flags & ElseMatrixType::Flags &
RowMajorBit
58 EIGEN_DENSE_PUBLIC_INTERFACE(
Select)
60 inline EIGEN_DEVICE_FUNC
61 Select(
const ConditionMatrixType& a_conditionMatrix,
62 const ThenMatrixType& a_thenMatrix,
63 const ElseMatrixType& a_elseMatrix)
64 : m_condition(a_conditionMatrix), m_then(a_thenMatrix), m_else(a_elseMatrix)
66 eigen_assert(m_condition.rows() == m_then.rows() && m_condition.rows() == m_else.rows());
67 eigen_assert(m_condition.cols() == m_then.cols() && m_condition.cols() == m_else.cols());
70 inline EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
71 Index rows()
const EIGEN_NOEXCEPT {
return m_condition.rows(); }
72 inline EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
73 Index cols()
const EIGEN_NOEXCEPT {
return m_condition.cols(); }
75 inline EIGEN_DEVICE_FUNC
78 if (m_condition.coeff(i,j))
79 return m_then.coeff(i,j);
81 return m_else.coeff(i,j);
84 inline EIGEN_DEVICE_FUNC
85 const Scalar coeff(
Index i)
const
87 if (m_condition.coeff(i))
88 return m_then.coeff(i);
90 return m_else.coeff(i);
93 inline EIGEN_DEVICE_FUNC
const ConditionMatrixType& conditionMatrix()
const
98 inline EIGEN_DEVICE_FUNC
const ThenMatrixType& thenMatrix()
const
103 inline EIGEN_DEVICE_FUNC
const ElseMatrixType& elseMatrix()
const
109 typename ConditionMatrixType::Nested m_condition;
110 typename ThenMatrixType::Nested m_then;
111 typename ElseMatrixType::Nested m_else;
EIGEN_DEVICE_FUNC const Select< Derived, ThenDerived, ElseDerived > select(const DenseBase< ThenDerived > &thenMatrix, const DenseBase< ElseDerived > &elseMatrix) const
Definition Select.h:126