mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-05-06 02:34:05 +08:00
Add evaluator for DynamicSparseMatrix
This commit is contained in:
parent
1c4b69c5fb
commit
b3d63b4db2
@ -352,6 +352,38 @@ class DynamicSparseMatrix<Scalar,_Options,_Index>::ReverseInnerIterator : public
|
|||||||
const Index m_outer;
|
const Index m_outer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef EIGEN_ENABLE_EVALUATORS
|
||||||
|
namespace internal {
|
||||||
|
|
||||||
|
template<typename _Scalar, int _Options, typename _Index>
|
||||||
|
struct evaluator<DynamicSparseMatrix<_Scalar,_Options,_Index> >
|
||||||
|
: evaluator_base<DynamicSparseMatrix<_Scalar,_Options,_Index> >
|
||||||
|
{
|
||||||
|
typedef _Scalar Scalar;
|
||||||
|
typedef _Index Index;
|
||||||
|
typedef DynamicSparseMatrix<_Scalar,_Options,_Index> SparseMatrixType;
|
||||||
|
typedef typename SparseMatrixType::InnerIterator InnerIterator;
|
||||||
|
typedef typename SparseMatrixType::ReverseInnerIterator ReverseInnerIterator;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
CoeffReadCost = NumTraits<_Scalar>::ReadCost,
|
||||||
|
Flags = SparseMatrixType::Flags
|
||||||
|
};
|
||||||
|
|
||||||
|
evaluator() : m_matrix(0) {}
|
||||||
|
evaluator(const SparseMatrixType &mat) : m_matrix(&mat) {}
|
||||||
|
|
||||||
|
operator SparseMatrixType&() { return m_matrix->const_cast_derived(); }
|
||||||
|
operator const SparseMatrixType&() const { return *m_matrix; }
|
||||||
|
|
||||||
|
Scalar coeff(Index row, Index col) const { return m_matrix->coeff(row,col); }
|
||||||
|
|
||||||
|
const SparseMatrixType *m_matrix;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
|
||||||
#endif // EIGEN_DYNAMIC_SPARSEMATRIX_H
|
#endif // EIGEN_DYNAMIC_SPARSEMATRIX_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user