This project has moved and is read-only. For the latest updates, please go here.

Sparse matrix support and redimensioning an array

Oct 3, 2012 at 5:04 AM


Just starting out with the library.

1.  What functions have been optimized for sparse matrix support?  My matrices tend to be 200x200 or so, so I doubt it will matter much speed wise one way or the other.

2.  How does one change the size of a matrix after it has been declared

Private mWinMatrix As New DenseMatrix(1)

Can I grow mWinMatrix now?


Oct 9, 2012 at 4:15 PM
Edited Oct 9, 2012 at 4:16 PM


1. Optimized sparse algorithms was the primary subject of the recent linear algebra refactorings, but it's not finished yet. For 200x200 matrices I'd recommend to go dense for now if memory usage is not an issue, at least until we finished that process. Most structural operations (e.g. SubMatrix) as well as +,-,*,.*,./,transpose* should be optimized by now, but I can check if you're interested in a specific operation

2. Existing matrices cannot ever be resized, but you can create a new one with a different size, based on an existing one (see CopyTo, SubMatrix, SetSubMatrix, Append, Stack, DiagonalStack, Insert*, Permute*; you can also access the .Storage scheme directly with more options). What are you trying to achieve?


Oct 9, 2012 at 8:23 PM

Thanks for the response Christoph,

1.  I will go with dense matrices for now.

2.  A matrix needs to be global within my class.  I do not however know the proper dimensons of the matrix until a database operation which occurs as a method of the class.  Therefore I define the matrx at the start of the class

Dim mWinMatrix As New DenseMatrix (1)

Later when the database operations are complete and I know the proper size the matrix should be, I need to "Redimension it".

I am currently using:  mWinMatrix = mWinMatrix.CreateMatrix(correct dimension, correct dimension) and it appears to be working.