mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-14 04:35:57 +08:00
Rationalize the use of Index type in iterators
This commit is contained in:
parent
9b833aff42
commit
4f28ccdd0e
@ -73,7 +73,7 @@ class CwiseBinaryOpImpl<BinaryOp,Lhs,Rhs,Sparse>::InnerIterator
|
|||||||
typedef internal::sparse_cwise_binary_op_inner_iterator_selector<
|
typedef internal::sparse_cwise_binary_op_inner_iterator_selector<
|
||||||
BinaryOp,Lhs,Rhs, InnerIterator> Base;
|
BinaryOp,Lhs,Rhs, InnerIterator> Base;
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE InnerIterator(const CwiseBinaryOpImpl& binOp, typename CwiseBinaryOpImpl::Index outer)
|
EIGEN_STRONG_INLINE InnerIterator(const CwiseBinaryOpImpl& binOp, Index outer)
|
||||||
: Base(binOp.derived(),outer)
|
: Base(binOp.derived(),outer)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
@ -111,6 +111,7 @@ template<typename Lhs, typename Rhs, bool Transpose>
|
|||||||
class SparseDenseOuterProduct<Lhs,Rhs,Transpose>::InnerIterator : public _LhsNested::InnerIterator
|
class SparseDenseOuterProduct<Lhs,Rhs,Transpose>::InnerIterator : public _LhsNested::InnerIterator
|
||||||
{
|
{
|
||||||
typedef typename _LhsNested::InnerIterator Base;
|
typedef typename _LhsNested::InnerIterator Base;
|
||||||
|
typedef typename SparseDenseOuterProduct::Index Index;
|
||||||
public:
|
public:
|
||||||
EIGEN_STRONG_INLINE InnerIterator(const SparseDenseOuterProduct& prod, Index outer)
|
EIGEN_STRONG_INLINE InnerIterator(const SparseDenseOuterProduct& prod, Index outer)
|
||||||
: Base(prod.lhs(), 0), m_outer(outer), m_factor(prod.rhs().coeff(outer))
|
: Base(prod.lhs(), 0), m_outer(outer), m_factor(prod.rhs().coeff(outer))
|
||||||
|
@ -34,26 +34,28 @@ template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::InnerItera
|
|||||||
: public _MatrixTypeNested::InnerIterator
|
: public _MatrixTypeNested::InnerIterator
|
||||||
{
|
{
|
||||||
typedef typename _MatrixTypeNested::InnerIterator Base;
|
typedef typename _MatrixTypeNested::InnerIterator Base;
|
||||||
|
typedef typename TransposeImpl::Index Index;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE InnerIterator(const TransposeImpl& trans, typename TransposeImpl<MatrixType,Sparse>::Index outer)
|
EIGEN_STRONG_INLINE InnerIterator(const TransposeImpl& trans, typename TransposeImpl<MatrixType,Sparse>::Index outer)
|
||||||
: Base(trans.derived().nestedExpression(), outer)
|
: Base(trans.derived().nestedExpression(), outer)
|
||||||
{}
|
{}
|
||||||
inline typename TransposeImpl<MatrixType,Sparse>::Index row() const { return Base::col(); }
|
Index row() const { return Base::col(); }
|
||||||
inline typename TransposeImpl<MatrixType,Sparse>::Index col() const { return Base::row(); }
|
Index col() const { return Base::row(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::ReverseInnerIterator
|
template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::ReverseInnerIterator
|
||||||
: public _MatrixTypeNested::ReverseInnerIterator
|
: public _MatrixTypeNested::ReverseInnerIterator
|
||||||
{
|
{
|
||||||
typedef typename _MatrixTypeNested::ReverseInnerIterator Base;
|
typedef typename _MatrixTypeNested::ReverseInnerIterator Base;
|
||||||
|
typedef typename TransposeImpl::Index Index;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE ReverseInnerIterator(const TransposeImpl& xpr, typename TransposeImpl<MatrixType,Sparse>::Index outer)
|
EIGEN_STRONG_INLINE ReverseInnerIterator(const TransposeImpl& xpr, typename TransposeImpl<MatrixType,Sparse>::Index outer)
|
||||||
: Base(xpr.derived().nestedExpression(), outer)
|
: Base(xpr.derived().nestedExpression(), outer)
|
||||||
{}
|
{}
|
||||||
inline typename TransposeImpl<MatrixType,Sparse>::Index row() const { return Base::col(); }
|
Index row() const { return Base::col(); }
|
||||||
inline typename TransposeImpl<MatrixType,Sparse>::Index col() const { return Base::row(); }
|
Index col() const { return Base::row(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
@ -66,6 +66,7 @@ template<typename MatrixType, int Mode>
|
|||||||
class SparseTriangularView<MatrixType,Mode>::InnerIterator : public MatrixTypeNestedCleaned::InnerIterator
|
class SparseTriangularView<MatrixType,Mode>::InnerIterator : public MatrixTypeNestedCleaned::InnerIterator
|
||||||
{
|
{
|
||||||
typedef typename MatrixTypeNestedCleaned::InnerIterator Base;
|
typedef typename MatrixTypeNestedCleaned::InnerIterator Base;
|
||||||
|
typedef typename SparseTriangularView::Index Index;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE InnerIterator(const SparseTriangularView& view, Index outer)
|
EIGEN_STRONG_INLINE InnerIterator(const SparseTriangularView& view, Index outer)
|
||||||
@ -135,6 +136,7 @@ template<typename MatrixType, int Mode>
|
|||||||
class SparseTriangularView<MatrixType,Mode>::ReverseInnerIterator : public MatrixTypeNestedCleaned::ReverseInnerIterator
|
class SparseTriangularView<MatrixType,Mode>::ReverseInnerIterator : public MatrixTypeNestedCleaned::ReverseInnerIterator
|
||||||
{
|
{
|
||||||
typedef typename MatrixTypeNestedCleaned::ReverseInnerIterator Base;
|
typedef typename MatrixTypeNestedCleaned::ReverseInnerIterator Base;
|
||||||
|
typedef typename SparseTriangularView::Index Index;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE ReverseInnerIterator(const SparseTriangularView& view, Index outer)
|
EIGEN_STRONG_INLINE ReverseInnerIterator(const SparseTriangularView& view, Index outer)
|
||||||
|
@ -56,6 +56,7 @@ protected:
|
|||||||
template<typename MatrixType>
|
template<typename MatrixType>
|
||||||
class SparseView<MatrixType>::InnerIterator : public _MatrixTypeNested::InnerIterator
|
class SparseView<MatrixType>::InnerIterator : public _MatrixTypeNested::InnerIterator
|
||||||
{
|
{
|
||||||
|
typedef typename SparseView::Index Index;
|
||||||
public:
|
public:
|
||||||
typedef typename _MatrixTypeNested::InnerIterator IterBase;
|
typedef typename _MatrixTypeNested::InnerIterator IterBase;
|
||||||
InnerIterator(const SparseView& view, Index outer) :
|
InnerIterator(const SparseView& view, Index outer) :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user