mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
makes SparseView a true sparse expression and fix use of nesting types
This commit is contained in:
parent
f3b875e434
commit
99e4afd43e
@ -27,11 +27,16 @@
|
|||||||
#define EIGEN_SPARSEVIEW_H
|
#define EIGEN_SPARSEVIEW_H
|
||||||
|
|
||||||
template<typename MatrixType>
|
template<typename MatrixType>
|
||||||
struct ei_traits<SparseView<MatrixType> > : ei_traits<MatrixType> {};
|
struct ei_traits<SparseView<MatrixType> > : ei_traits<MatrixType>
|
||||||
|
{
|
||||||
|
typedef int Index;
|
||||||
|
typedef Sparse StorageKind;
|
||||||
|
};
|
||||||
|
|
||||||
template<typename MatrixType>
|
template<typename MatrixType>
|
||||||
class SparseView : public SparseMatrixBase<SparseView<MatrixType> >
|
class SparseView : public SparseMatrixBase<SparseView<MatrixType> >
|
||||||
{
|
{
|
||||||
|
typedef typename MatrixType::Nested MatrixTypeNested;
|
||||||
public:
|
public:
|
||||||
EIGEN_SPARSE_PUBLIC_INTERFACE(SparseView)
|
EIGEN_SPARSE_PUBLIC_INTERFACE(SparseView)
|
||||||
|
|
||||||
@ -47,18 +52,18 @@ public:
|
|||||||
inline Index outerSize() const { return m_matrix.outerSize(); }
|
inline Index outerSize() const { return m_matrix.outerSize(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const typename MatrixType::Nested m_matrix;
|
const MatrixTypeNested m_matrix;
|
||||||
Scalar m_reference;
|
Scalar m_reference;
|
||||||
typename NumTraits<Scalar>::Real m_epsilon;
|
typename NumTraits<Scalar>::Real m_epsilon;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename MatrixType>
|
template<typename MatrixType>
|
||||||
class SparseView<MatrixType>::InnerIterator : public MatrixType::InnerIterator
|
class SparseView<MatrixType>::InnerIterator : public MatrixTypeNested::InnerIterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename MatrixType::InnerIterator IterBase;
|
typedef typename MatrixTypeNested::InnerIterator IterBase;
|
||||||
InnerIterator(const SparseView& view, Index outer) :
|
InnerIterator(const SparseView& view, Index outer) :
|
||||||
DenseBase<MatrixType>::InnerIterator(view.m_matrix, outer), m_view(view)
|
IterBase(view.m_matrix, outer), m_view(view)
|
||||||
{
|
{
|
||||||
incrementToNonZero();
|
incrementToNonZero();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user