From a814ebe1807877b9a65f9b2845b6f6c265b783f3 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Fri, 22 Aug 2008 01:19:53 +0000 Subject: [PATCH] fix a number of compiler errors and warnings with gcc 4.3. There was a missing #include so I'm not sure how it compiled at all for you :) --- Eigen/Regression | 1 + Eigen/Sparse | 5 +++-- Eigen/src/Sparse/HashMatrix.h | 2 +- Eigen/src/Sparse/SparseArray.h | 1 + Eigen/src/Sparse/SparseMatrix.h | 2 +- Eigen/src/Sparse/SparseMatrixBase.h | 4 ++++ test/sparse.cpp | 2 +- 7 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Eigen/Regression b/Eigen/Regression index 8213ff77f..5504f922c 100644 --- a/Eigen/Regression +++ b/Eigen/Regression @@ -2,6 +2,7 @@ #define EIGEN_REGRESSION_MODULE_H #include "LU" +#include "QR" namespace Eigen { diff --git a/Eigen/Sparse b/Eigen/Sparse index 12ffc0c66..53bc4eccc 100644 --- a/Eigen/Sparse +++ b/Eigen/Sparse @@ -4,8 +4,9 @@ #include "Core" #include #include -#include -#include +#include +#include +#include namespace Eigen { diff --git a/Eigen/src/Sparse/HashMatrix.h b/Eigen/src/Sparse/HashMatrix.h index a0383574c..992486f5a 100644 --- a/Eigen/src/Sparse/HashMatrix.h +++ b/Eigen/src/Sparse/HashMatrix.h @@ -71,7 +71,7 @@ class HashMatrix : public SparseMatrixBase > public: - inline void startFill(int reserveSize = 1000) {} + inline void startFill(int /*reserveSize = 1000 --- currenty unused, don't generate a warning*/) {} inline Scalar& fill(int row, int col) { return coeffRef(row, col); } diff --git a/Eigen/src/Sparse/SparseArray.h b/Eigen/src/Sparse/SparseArray.h index bd82e6e9a..0315c93d9 100644 --- a/Eigen/src/Sparse/SparseArray.h +++ b/Eigen/src/Sparse/SparseArray.h @@ -51,6 +51,7 @@ template class SparseArray resize(other.size()); memcpy(m_values, other.m_values, m_size * sizeof(Scalar)); memcpy(m_indices, other.m_indices, m_size * sizeof(int)); + return *this; } void swap(SparseArray& other) diff --git a/Eigen/src/Sparse/SparseMatrix.h b/Eigen/src/Sparse/SparseMatrix.h index b34ed8fd2..dbc436f80 100644 --- a/Eigen/src/Sparse/SparseMatrix.h +++ b/Eigen/src/Sparse/SparseMatrix.h @@ -213,8 +213,8 @@ class SparseMatrix : public SparseMatrixBase > for (int j=0; j<=m_outerSize; ++j) m_outerIndex[j] = other.m_outerIndex[j]; m_data = other.m_data; - return *this; } + return *this; } template diff --git a/Eigen/src/Sparse/SparseMatrixBase.h b/Eigen/src/Sparse/SparseMatrixBase.h index 508972cbb..051d1cbc2 100644 --- a/Eigen/src/Sparse/SparseMatrixBase.h +++ b/Eigen/src/Sparse/SparseMatrixBase.h @@ -73,8 +73,10 @@ class SparseMatrixBase : public MatrixBase { Scalar v = it.value(); if (v!=Scalar(0)) + { if (OtherDerived::Flags & RowMajorBit) temp.fill(j,it.index()) = v; else temp.fill(it.index(),j) = v; + } } } temp.endFill(); @@ -100,8 +102,10 @@ class SparseMatrixBase : public MatrixBase { Scalar v = it.value(); if (v!=Scalar(0)) + { if (RowMajor) derived().fill(j,it.index()) = v; else derived().fill(it.index(),j) = v; + } } } derived().endFill(); diff --git a/test/sparse.cpp b/test/sparse.cpp index 3f6568c47..bac1091ce 100644 --- a/test/sparse.cpp +++ b/test/sparse.cpp @@ -61,7 +61,7 @@ template void sparse() VERIFY(nonzeroCoords.size()>0 && "re-run the test"); // test coeff and coeffRef - for (int i=0; i