mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-14 18:33:16 +08:00
fix a number of compiler errors and warnings with gcc 4.3. There was a missing
#include<algorithm> so I'm not sure how it compiled at all for you :)
This commit is contained in:
parent
db628c6ad7
commit
a814ebe180
@ -2,6 +2,7 @@
|
|||||||
#define EIGEN_REGRESSION_MODULE_H
|
#define EIGEN_REGRESSION_MODULE_H
|
||||||
|
|
||||||
#include "LU"
|
#include "LU"
|
||||||
|
#include "QR"
|
||||||
|
|
||||||
namespace Eigen {
|
namespace Eigen {
|
||||||
|
|
||||||
|
@ -4,8 +4,9 @@
|
|||||||
#include "Core"
|
#include "Core"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace Eigen {
|
namespace Eigen {
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ class HashMatrix : public SparseMatrixBase<HashMatrix<_Scalar, _Flags> >
|
|||||||
|
|
||||||
public:
|
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); }
|
inline Scalar& fill(int row, int col) { return coeffRef(row, col); }
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ template<typename Scalar> class SparseArray
|
|||||||
resize(other.size());
|
resize(other.size());
|
||||||
memcpy(m_values, other.m_values, m_size * sizeof(Scalar));
|
memcpy(m_values, other.m_values, m_size * sizeof(Scalar));
|
||||||
memcpy(m_indices, other.m_indices, m_size * sizeof(int));
|
memcpy(m_indices, other.m_indices, m_size * sizeof(int));
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void swap(SparseArray& other)
|
void swap(SparseArray& other)
|
||||||
|
@ -213,8 +213,8 @@ class SparseMatrix : public SparseMatrixBase<SparseMatrix<_Scalar, _Flags> >
|
|||||||
for (int j=0; j<=m_outerSize; ++j)
|
for (int j=0; j<=m_outerSize; ++j)
|
||||||
m_outerIndex[j] = other.m_outerIndex[j];
|
m_outerIndex[j] = other.m_outerIndex[j];
|
||||||
m_data = other.m_data;
|
m_data = other.m_data;
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
|
@ -73,8 +73,10 @@ class SparseMatrixBase : public MatrixBase<Derived>
|
|||||||
{
|
{
|
||||||
Scalar v = it.value();
|
Scalar v = it.value();
|
||||||
if (v!=Scalar(0))
|
if (v!=Scalar(0))
|
||||||
|
{
|
||||||
if (OtherDerived::Flags & RowMajorBit) temp.fill(j,it.index()) = v;
|
if (OtherDerived::Flags & RowMajorBit) temp.fill(j,it.index()) = v;
|
||||||
else temp.fill(it.index(),j) = v;
|
else temp.fill(it.index(),j) = v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
temp.endFill();
|
temp.endFill();
|
||||||
@ -100,8 +102,10 @@ class SparseMatrixBase : public MatrixBase<Derived>
|
|||||||
{
|
{
|
||||||
Scalar v = it.value();
|
Scalar v = it.value();
|
||||||
if (v!=Scalar(0))
|
if (v!=Scalar(0))
|
||||||
|
{
|
||||||
if (RowMajor) derived().fill(j,it.index()) = v;
|
if (RowMajor) derived().fill(j,it.index()) = v;
|
||||||
else derived().fill(it.index(),j) = v;
|
else derived().fill(it.index(),j) = v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
derived().endFill();
|
derived().endFill();
|
||||||
|
@ -61,7 +61,7 @@ template<typename Scalar> void sparse()
|
|||||||
VERIFY(nonzeroCoords.size()>0 && "re-run the test");
|
VERIFY(nonzeroCoords.size()>0 && "re-run the test");
|
||||||
|
|
||||||
// test coeff and coeffRef
|
// test coeff and coeffRef
|
||||||
for (int i=0; i<zeroCoords.size(); ++i)
|
for (int i=0; i<(int)zeroCoords.size(); ++i)
|
||||||
{
|
{
|
||||||
VERIFY_IS_MUCH_SMALLER_THAN( m.coeff(zeroCoords[i].x(),zeroCoords[i].y()), eps );
|
VERIFY_IS_MUCH_SMALLER_THAN( m.coeff(zeroCoords[i].x(),zeroCoords[i].y()), eps );
|
||||||
VERIFY_RAISES_ASSERT( m.coeffRef(zeroCoords[0].x(),zeroCoords[0].y()) = 5 );
|
VERIFY_RAISES_ASSERT( m.coeffRef(zeroCoords[0].x(),zeroCoords[0].y()) = 5 );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user