Quantcast
Channel: Math.NET Numerics
Viewing all articles
Browse latest Browse all 971

New Post: How to load data into matrix

$
0
0

New to matrices ... coming from relational database background ...

I've got a database table that has: rowkey, columnkey, cellvalue which is read in from SQL to a reader

and the keys are in a hashtable which allows lookup based on key to get row and col IDs. (same set of keys can be in either row or column)

Problem is that it's taking about 4 hours to load ~2M datapoints into a 10500x10500 SparseMatrix A in memory for calculation by looping over the following C# stmt:

                 A [ (int)idHash [reader[0].ToString()], (int)idHash [reader[1].ToString()] ] = reader.GetDouble(2);

I was looking for a "bulk load" function and see SetColumn and SetRow but just not sure, since it's sparse data, whether it's worth it to prepare by columns or ? ... 

Any ideas on how to speed this process up?

Thanks!


Viewing all articles
Browse latest Browse all 971

Trending Articles