mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-12 09:23:12 +08:00
Make loadMarket use the sparse-matrix index type, thus enabling loading huge matrices.
This commit is contained in:
parent
ba694ce8cf
commit
d79516660c
@ -133,6 +133,7 @@ template<typename SparseMatrixType>
|
||||
bool loadMarket(SparseMatrixType& mat, const std::string& filename)
|
||||
{
|
||||
typedef typename SparseMatrixType::Scalar Scalar;
|
||||
typedef typename SparseMatrixType::Index Index;
|
||||
std::ifstream input(filename.c_str(),std::ios::in);
|
||||
if(!input)
|
||||
return false;
|
||||
@ -142,11 +143,11 @@ bool loadMarket(SparseMatrixType& mat, const std::string& filename)
|
||||
|
||||
bool readsizes = false;
|
||||
|
||||
typedef Triplet<Scalar,int> T;
|
||||
typedef Triplet<Scalar,Index> T;
|
||||
std::vector<T> elements;
|
||||
|
||||
int M(-1), N(-1), NNZ(-1);
|
||||
int count = 0;
|
||||
Index M(-1), N(-1), NNZ(-1);
|
||||
Index count = 0;
|
||||
while(input.getline(buffer, maxBuffersize))
|
||||
{
|
||||
// skip comments
|
||||
@ -169,7 +170,7 @@ bool loadMarket(SparseMatrixType& mat, const std::string& filename)
|
||||
}
|
||||
else
|
||||
{
|
||||
int i(-1), j(-1);
|
||||
Index i(-1), j(-1);
|
||||
Scalar value;
|
||||
if( internal::GetMarketLine(line, M, N, i, j, value) )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user