Hi Ken,
First of all, thanks a lot for contacting me via the la4j-email list. This is how I see an efficient collaboration between developers in contributors. Regarding your questions and issues.
* CRS matrices on-the-fly: You can easily create new sparse matrix with public constructor like this:
Matrix a = new CCSMatrix(500000, 500000);
It's not a problem having such a _big_ matrices, since la4j doesn't allocate the whole memory for sparse matrices. It will be growing on-demand. There is only one constraint: the maximum matrix you can handle with la4j is Integer.MAX_VALUE - 1 x Integer.MAX_VALUE - 1. This is a restriction from JVM - maximum array size, actually.
* Indexation: all the access operations like get/set are 0-index based. So, I don't see any issues with the examples you provided.
Documentation: You're right. The documentation is the weakest side of the la4j library. So, I'm currently trying to fix this and put as much effort into this as possible. You can also participate
in this. Anyway, regarding your question. CCSMatrix implements a well-known "
Compressed Column Storage" format of sparse matrices. So, in CCSMatrix, the
rowIndices array contains a row-index for every value in
values array. While,
columnPointers array contains a value-index, starting from each, the i-th column is represented in
values array. So, normally, you don't need to handle this in your application code. It's kind of tricky, but it can boost the performance of generating new sparse matrices, by using a specialised constructor. But, still, I would suggest you to avoid this approach, until you prove that this a bottleneck.
Sparse solvers: For now, all the solvers logic is built on top of primitive set/get operations, which means there is no performance improvements of using sparse data. So, the la4j library is currently handling sparse entries for reducing memory footprint. But, that doesn't mean, sparse entries are slow. They work Ok, but should be improved for sure. I'm currently in the middle of doing this. The next la4j release will be arising this issue (as well as in-place operations). Which means, you can write you application code in terms of la4j API and get the performance boost after updating the library installation (w/o changing the code). The new version should be available this summer (or earlier, it depends on contributors' activity as well).
And the last but not least thing. I've just updated the version of la4j. The latest one is 0.4.9. Please, don't forget to update your Maven config in order to get the latest version.
Let me know, should you have any further questions!