Patch to implement the decoding methods for the five classes listed above, plus updates to their respective unit tests.
In order to make the decoding easier I made some changes to what asFormatString() produces for the matrix classes. The string representing the actual data in the matrix is prefixed by a two-character code indicating the matrix type and the string '(N,M)' where N is number of rows and M is the number of columns. For instance in TestSparseMatrix the 3x2 sparse matrix produces the output from asFormatString: sm(3,2)[ [s2, 0:1.1, 1:2.2, ] [s2, 0:3.3, 1:4.4, ] [s2, 0:5.5, 1:6.6, ] ]
As much as possible I have tried to keep the way in which matrices are decoded similar to the way in which vectors are currently decoded. Thus to decode a matrix you would call the static method decodeMatrix in AbstractMatrix, which would in turn call the respective decodeFormat method in the appropriate matrix class. In order to decode the rows of the matrix I have used the decodeVector method.
Couple of things I am currently not happy with:
SparseColumnMatrix does not output a sparse representation, as the asFormatString method of SparseVector will produce a row wise representation of the vector. At the moment it will basically output the same as a DenseMatrix representation. Arguably we could output the transpose of the matrix as series of sparse rows and just ensure when the matrix is decoded we obtain correct matrix.
Fair amount of shared code between the decodeFormat methods implemented in each of the five classes. Potentially some it it could be moved into the AbstractMatrix method.
Your thoughts and suggestions would be welcome.