# Improving sparse matrix storage CRS by allowing the user to provide the sparsity structure of the matrix.

I'm new to math.net, but I've found some issues with the libraries.

One of these is related to sparsematrix and sparsecompressedrowstorage

I've also wrote a post within the discussion forum, but I've recieved no response.

The problem is simple: I've tried desperately to find a way to assign directly the sparse matrix in CRS format, but I've failed.

It seems that the CSR must be constructed starting from an already existing matrix. This would imply a big performace issue and memory allocation problems.

For istance, if one want to write a program to solve some physical problem with finite element of finite difference methods, a linear system solver is required, and with such problems large sparse matrix usually occurs (e.g. 10^8x10^8 double precision arrays). The solution to the problem would be writing the three arrays required by CSR method directly without working with the original two dimensional array representing the matrix. This, in turn, would avoid to allocate memory and save computational time required to pass the original matrix to the sparsematrix class. Resulting in better perfomance.

So my proposal is to allow for the possibility to build a sparsematrix or a sparsecompressedrowstorage by directly passing the three one dimensional arrays required by the CSR.

For example, it should be allowed some constructor like this

sparsematrix(of T)(rowpointer as integer(), columnindex as integer(), values as double())

where the rowpointer and columnindex are the two array containing the sparsity structure of the matrix, provided by the user, and values is the array containing the nonzero elements of the matrix, as per CSR format.

**1**vote