sparse module:

* add row(i), col(i) functions
* add prune() function to remove small coefficients
This commit is contained in:
Gael Guennebaud
2009-01-21 18:46:04 +00:00
parent 25f1658fce
commit 52cf07d266
8 changed files with 138 additions and 17 deletions

View File

@@ -74,7 +74,7 @@ class DynamicSparseMatrix
std::vector<CompressedStorage<Scalar> > m_data;
public:
inline int rows() const { return IsRowMajor ? outerSize() : m_innerSize; }
inline int cols() const { return IsRowMajor ? m_innerSize : outerSize(); }
inline int innerSize() const { return m_innerSize; }
@@ -102,8 +102,6 @@ class DynamicSparseMatrix
return m_data[outer].atWithInsertion(inner);
}
public:
class InnerIterator;
inline void setZero()
@@ -176,6 +174,12 @@ class DynamicSparseMatrix
/** Does nothing. Provided for compatibility with SparseMatrix. */
inline void endFill() {}
void prune(Scalar reference, RealScalar epsilon = precision<RealScalar>())
{
for (int j=0; j<outerSize(); ++j)
m_data[j].prune(reference,epsilon);
}
/** Resize the matrix without preserving the data (the matrix is set to zero)
*/