diff options
author | Gael Guennebaud <g.gael@free.fr> | 2011-12-04 12:19:26 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2011-12-04 12:19:26 +0100 |
commit | 32917515df2fb1568d852e5727b20ecb27acbe6b (patch) | |
tree | c3c089a568b32513850e747b09666b5c6f16cb0b /unsupported/Eigen/src/SparseExtra | |
parent | 1cdbae62db538c3fb73d5195facd1c1481b48696 (diff) |
make the accessors to internal sparse storage part of the public API and remove their "_" prefix.
Diffstat (limited to 'unsupported/Eigen/src/SparseExtra')
-rw-r--r-- | unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h | 17 | ||||
-rw-r--r-- | unsupported/Eigen/src/SparseExtra/RandomSetter.h | 16 | ||||
-rw-r--r-- | unsupported/Eigen/src/SparseExtra/SparseLDLTLegacy.h | 18 |
3 files changed, 34 insertions, 17 deletions
diff --git a/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h b/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h index ce39a17f7..d43149a8f 100644 --- a/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h +++ b/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h @@ -121,6 +121,7 @@ template<typename _Scalar, int _Options, typename _Index> } class InnerIterator; + class ReverseInnerIterator; void setZero() { @@ -348,4 +349,20 @@ class DynamicSparseMatrix<Scalar,_Options,_Index>::InnerIterator : public Sparse const Index m_outer; }; +template<typename Scalar, int _Options, typename _Index> +class DynamicSparseMatrix<Scalar,_Options,_Index>::ReverseInnerIterator : public SparseVector<Scalar,_Options,_Index>::ReverseInnerIterator +{ + typedef typename SparseVector<Scalar,_Options,_Index>::ReverseInnerIterator Base; + public: + ReverseInnerIterator(const DynamicSparseMatrix& mat, Index outer) + : Base(mat.m_data[outer]), m_outer(outer) + {} + + inline Index row() const { return IsRowMajor ? m_outer : Base::index(); } + inline Index col() const { return IsRowMajor ? Base::index() : m_outer; } + + protected: + const Index m_outer; +}; + #endif // EIGEN_DYNAMIC_SPARSEMATRIX_H diff --git a/unsupported/Eigen/src/SparseExtra/RandomSetter.h b/unsupported/Eigen/src/SparseExtra/RandomSetter.h index e1cbae086..137399060 100644 --- a/unsupported/Eigen/src/SparseExtra/RandomSetter.h +++ b/unsupported/Eigen/src/SparseExtra/RandomSetter.h @@ -268,12 +268,12 @@ class RandomSetter for (Index j=0; j<mp_target->outerSize(); ++j) { Index tmp = positions[j]; - mp_target->_outerIndexPtr()[j] = count; + mp_target->outerIndexPtr()[j] = count; positions[j] = count; count += tmp; } mp_target->makeCompressed(); - mp_target->_outerIndexPtr()[mp_target->outerSize()] = count; + mp_target->outerIndexPtr()[mp_target->outerSize()] = count; mp_target->resizeNonZeros(count); // pass 2 for (Index k=0; k<m_outerPackets; ++k) @@ -288,16 +288,16 @@ class RandomSetter // Note that we have to deal with at most 2^OuterPacketBits unsorted coefficients, // moreover those 2^OuterPacketBits coeffs are likely to be sparse, an so only a // small fraction of them have to be sorted, whence the following simple procedure: - Index posStart = mp_target->_outerIndexPtr()[outer]; + Index posStart = mp_target->outerIndexPtr()[outer]; Index i = (positions[outer]++) - 1; - while ( (i >= posStart) && (mp_target->_innerIndexPtr()[i] > inner) ) + while ( (i >= posStart) && (mp_target->innerIndexPtr()[i] > inner) ) { - mp_target->_valuePtr()[i+1] = mp_target->_valuePtr()[i]; - mp_target->_innerIndexPtr()[i+1] = mp_target->_innerIndexPtr()[i]; + mp_target->valuePtr()[i+1] = mp_target->valuePtr()[i]; + mp_target->innerIndexPtr()[i+1] = mp_target->innerIndexPtr()[i]; --i; } - mp_target->_innerIndexPtr()[i+1] = inner; - mp_target->_valuePtr()[i+1] = it->second.value; + mp_target->innerIndexPtr()[i+1] = inner; + mp_target->valuePtr()[i+1] = it->second.value; } } } diff --git a/unsupported/Eigen/src/SparseExtra/SparseLDLTLegacy.h b/unsupported/Eigen/src/SparseExtra/SparseLDLTLegacy.h index 1d60e0f1e..e85826acf 100644 --- a/unsupported/Eigen/src/SparseExtra/SparseLDLTLegacy.h +++ b/unsupported/Eigen/src/SparseExtra/SparseLDLTLegacy.h @@ -250,9 +250,9 @@ void SparseLDLT<_MatrixType,Backend>::_symbolic(const _MatrixType& a) ei_declare_aligned_stack_constructed_variable(Index, tags, size, 0); - const Index* Ap = a._outerIndexPtr(); - const Index* Ai = a._innerIndexPtr(); - Index* Lp = m_matrix._outerIndexPtr(); + const Index* Ap = a.outerIndexPtr(); + const Index* Ai = a.innerIndexPtr(); + Index* Lp = m_matrix.outerIndexPtr(); const Index* P = 0; Index* Pinv = 0; @@ -311,12 +311,12 @@ bool SparseLDLT<_MatrixType,Backend>::_numeric(const _MatrixType& a) assert(m_parent.size()==size); assert(m_nonZerosPerCol.size()==size); - const Index* Ap = a._outerIndexPtr(); - const Index* Ai = a._innerIndexPtr(); - const Scalar* Ax = a._valuePtr(); - const Index* Lp = m_matrix._outerIndexPtr(); - Index* Li = m_matrix._innerIndexPtr(); - Scalar* Lx = m_matrix._valuePtr(); + const Index* Ap = a.outerIndexPtr(); + const Index* Ai = a.innerIndexPtr(); + const Scalar* Ax = a.valuePtr(); + const Index* Lp = m_matrix.outerIndexPtr(); + Index* Li = m_matrix.innerIndexPtr(); + Scalar* Lx = m_matrix.valuePtr(); m_diag.resize(size); ei_declare_aligned_stack_constructed_variable(Scalar, y, size, 0); |