aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2008-12-17 18:37:04 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2008-12-17 18:37:04 +0000
commit6e138d0069a7c3d82b7119781bd1a8e8087db141 (patch)
tree3dc894ebd912e332515750fd0f6cb830a1829942 /Eigen
parent4cb63808d43e2ddd4d01f6378cb50af792cf44bd (diff)
more MSVC cmake fixes
Diffstat (limited to 'Eigen')
-rw-r--r--Eigen/Sparse2
-rw-r--r--Eigen/src/Sparse/SparseMatrix.h33
2 files changed, 28 insertions, 7 deletions
diff --git a/Eigen/Sparse b/Eigen/Sparse
index b8a10c9e0..b48f0c093 100644
--- a/Eigen/Sparse
+++ b/Eigen/Sparse
@@ -100,6 +100,8 @@ namespace Eigen {
# include "src/Sparse/UmfPackSupport.h"
#endif
+#include "src/Sparse/ConstrainedCG.h"
+
} // namespace Eigen
#endif // EIGEN_SPARSE_MODULE_H
diff --git a/Eigen/src/Sparse/SparseMatrix.h b/Eigen/src/Sparse/SparseMatrix.h
index d58d910e8..5a6b2e0d4 100644
--- a/Eigen/src/Sparse/SparseMatrix.h
+++ b/Eigen/src/Sparse/SparseMatrix.h
@@ -128,6 +128,17 @@ class SparseMatrix
class InnerIterator;
+ inline void setZero()
+ {
+ m_data.clear();
+ //if (m_outerSize)
+ memset(m_outerIndex, 0, (m_outerSize+1)*sizeof(int));
+// for (int i=0; i<m_outerSize; ++i)
+// m_outerIndex[i] = 0;
+// if (m_outerSize)
+// m_outerIndex[i] = 0;
+ }
+
/** \returns the number of non zero coefficients */
inline int nonZeros() const { return m_data.size(); }
@@ -137,10 +148,9 @@ class SparseMatrix
*/
inline void startFill(int reserveSize = 1000)
{
- m_data.clear();
+ std::cerr << this << " startFill\n";
+ setZero();
m_data.reserve(reserveSize);
- for (int i=0; i<=m_outerSize; ++i)
- m_outerIndex[i] = 0;
}
/**
@@ -188,7 +198,7 @@ class SparseMatrix
}
m_outerIndex[outer+1] = m_outerIndex[outer];
}
- //
+// std::cerr << this << " " << outer << " " << inner << " - " << m_outerIndex[outer] << " " << m_outerIndex[outer+1] << "\n";
assert(m_outerIndex[outer+1] == m_data.size() && "invalid outer index");
int startId = m_outerIndex[outer];
int id = m_outerIndex[outer+1]-1;
@@ -202,11 +212,17 @@ class SparseMatrix
--id;
}
m_data.index(id+1) = inner;
- return (m_data.value(id+1) = 0);
+ //return (m_data.value(id+1) = 0);
+ m_data.value(id+1) = 0;
+ std::cerr << m_outerIndex[outer] << " " << m_outerIndex[outer+1] << "\n";
+ return m_data.value(id+1);
}
+// inline void
+
inline void endFill()
{
+ std::cerr << this << " endFill\n";
int size = m_data.size();
int i = m_outerSize;
// find the last filled column
@@ -222,6 +238,7 @@ class SparseMatrix
void resize(int rows, int cols)
{
+ std::cerr << this << " resize " << rows << "x" << cols << "\n";
const int outerSize = RowMajor ? rows : cols;
m_innerSize = RowMajor ? cols : rows;
m_data.clear();
@@ -238,8 +255,10 @@ class SparseMatrix
}
inline SparseMatrix()
- : m_outerSize(0), m_innerSize(0), m_outerIndex(0)
- {}
+ : m_outerSize(-1), m_innerSize(0), m_outerIndex(0)
+ {
+ resize(0, 0);
+ }
inline SparseMatrix(int rows, int cols)
: m_outerSize(0), m_innerSize(0), m_outerIndex(0)