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> >
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 & HereditaryBits,
54 template<
typename ConditionMatrixType,
typename ThenMatrixType,
typename ElseMatrixType>
61 EIGEN_DENSE_PUBLIC_INTERFACE(
Select)
63 Select(
const ConditionMatrixType& a_conditionMatrix,
64 const ThenMatrixType& a_thenMatrix,
65 const ElseMatrixType& a_elseMatrix)
66 : m_condition(a_conditionMatrix), m_then(a_thenMatrix), m_else(a_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;
121 template<
typename Derived>
122 template<
typename ThenDerived,
typename ElseDerived>
135 template<
typename Derived>
136 template<
typename ThenDerived>
142 derived(), thenMatrix.derived(), ThenDerived::Constant(rows(),cols(),elseScalar));
150 template<
typename Derived>
151 template<
typename ElseDerived>
157 derived(), ElseDerived::Constant(rows(),cols(),thenScalar), elseMatrix.derived());
162 #endif // EIGEN_SELECT_H Definition: gtest_unittest.cc:5031
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:41
Definition: XprHelper.h:32
Definition: XprHelper.h:350
Definition: BandTriangularSolver.h:13
The type used to identify a dense storage.
Definition: Constants.h:428
const Select< Derived, ThenDerived, ElseDerived > select(const DenseBase< ThenDerived > &thenMatrix, const DenseBase< ElseDerived > &elseMatrix) const
Definition: Select.h:124
Definition: ForwardDeclarations.h:17
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48
Expression of a coefficient wise version of the C++ ternary operator ?:
Definition: Select.h:55