10 #ifndef EIGEN_SELECT_H 11 #define EIGEN_SELECT_H 31 template<
typename ConditionMatrixType,
typename ThenMatrixType,
typename ElseMatrixType>
32 struct traits<
Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
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 51 template<
typename ConditionMatrixType,
typename ThenMatrixType,
typename ElseMatrixType>
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());
78 if (m_condition.coeff(i,j))
79 return m_then.coeff(i,j);
81 return m_else.coeff(i,j);
87 if (m_condition.coeff(i))
88 return m_then.coeff(i);
90 return m_else.coeff(i);
123 template<
typename Derived>
124 template<
typename ThenDerived,
typename ElseDerived>
137 template<
typename Derived>
138 template<
typename ThenDerived>
144 derived(), thenMatrix.derived(), ThenDerived::Constant(
rows(),
cols(),elseScalar));
152 template<
typename Derived>
153 template<
typename ElseDerived>
159 derived(), ElseDerived::Constant(
rows(),
cols(),thenScalar), elseMatrix.derived());
164 #endif // EIGEN_SELECT_H
traits< ThenMatrixType >::XprKind XprKind
EIGEN_DEVICE_FUNC const Select< Derived, ThenDerived, ElseDerived > select(const DenseBase< ThenDerived > &thenMatrix, const DenseBase< ElseDerived > &elseMatrix) const
Namespace containing all symbols from the Eigen library.
ThenMatrixType::Nested ThenMatrixNested
EIGEN_DEVICE_FUNC const ConditionMatrixType & conditionMatrix() const
ElseMatrixType::Nested m_else
EIGEN_DEVICE_FUNC const Scalar coeff(Index i) const
const unsigned int RowMajorBit
Base class for all dense matrices, vectors, and arrays.
internal::dense_xpr_base< Select >::type Base
EIGEN_DEVICE_FUNC const ThenMatrixType & thenMatrix() const
EIGEN_DEVICE_FUNC const Scalar coeff(Index i, Index j) const
ElseMatrixType::Nested ElseMatrixNested
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
EIGEN_DEVICE_FUNC const ElseMatrixType & elseMatrix() const
#define EIGEN_DEVICE_FUNC
EIGEN_DEVICE_FUNC Select(const ConditionMatrixType &a_conditionMatrix, const ThenMatrixType &a_thenMatrix, const ElseMatrixType &a_elseMatrix)
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
traits< ThenMatrixType >::Scalar Scalar
ConditionMatrixType::Nested ConditionMatrixNested
ThenMatrixType::Nested m_then
ConditionMatrixType::Nested m_condition
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Expression of a coefficient wise version of the C++ ternary operator ?: