Skip to content

Math.NET Numerics and CSparse

wo80 edited this page Sep 16, 2015 · 19 revisions

Math.NET Numerics (version 3.x) doesn't provide any direct solvers for sparse matrices. On this page you will learn how to solve large systems in Math.NET Numerics using CSparse.

One difficulty you will face, is that Math.NET and CSparse use differnet storage schemes. While Math.NET uses Compressed Sparse Row storage (CSR), CSparse uses Compressed Sparse Column storage (CSC). Both schemes are closely related: If a sparse matrix is stored as CSR, its transpose will be the original matrix represented in CSC.

So the approach which immediately comes to mind, is to transpose the Math.NET matrix and feed the storage data to the CSparse solver routines. This involves allocating memory for the transposed matrix, and as you will see in a moment, there's an easy way to avoid this.

I will now present a convenient approach, which closely follows the design of Math.NET's dense solvers (only the LU case will be covered here).

Clone this wiki locally