this is essentially backporting all the changes made in the Sparse module up to KDE SVN revision r945600, aka changeset:

df9dfa1455


This is what is needed to make Step (in KDE/kdeedu) build.

The rest of Eigen (outside of Sparse) is unaffected except for a few trivial changes that were needed.

calling this 2.0.3, will tag if no problem.
This commit is contained in:
Benoit Jacob
2009-06-04 18:02:20 +02:00
parent 12570d97ce
commit 5a18f7545d
25 changed files with 822 additions and 254 deletions

View File

@@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2008-2009 Gael Guennebaud <g.gael@free.fr>
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -83,6 +83,9 @@ class DynamicSparseMatrix
inline int innerSize() const { return m_innerSize; }
inline int outerSize() const { return m_data.size(); }
inline int innerNonZeros(int j) const { return m_data[j].size(); }
std::vector<CompressedStorage<Scalar> >& _data() { return m_data; }
const std::vector<CompressedStorage<Scalar> >& _data() const { return m_data; }
/** \returns the coefficient value at given position \a row, \a col
* This operation involes a log(rho*outer_size) binary search.
@@ -125,11 +128,14 @@ class DynamicSparseMatrix
/** Set the matrix to zero and reserve the memory for \a reserveSize nonzero coefficients. */
inline void startFill(int reserveSize = 1000)
{
int reserveSizePerVector = std::max(reserveSize/outerSize(),4);
for (int j=0; j<outerSize(); ++j)
if (outerSize()>0)
{
m_data[j].clear();
m_data[j].reserve(reserveSizePerVector);
int reserveSizePerVector = std::max(reserveSize/outerSize(),4);
for (int j=0; j<outerSize(); ++j)
{
m_data[j].clear();
m_data[j].reserve(reserveSizePerVector);
}
}
}
@@ -215,7 +221,7 @@ class DynamicSparseMatrix
}
inline DynamicSparseMatrix()
: m_innerSize(0)
: m_innerSize(0), m_data(0)
{
ei_assert(innerSize()==0 && outerSize()==0);
}