mathnet-numerics icon indicating copy to clipboard operation
mathnet-numerics copied to clipboard

how to solve a left matrix division efficiently for a very large sparse matrix?

Open bigworld12 opened this issue 7 years ago • 5 comments

let's assume the following matrices a sparse matrix 'kk' 26400x26400 a vector 'fg' 26400x1 delta = kk\fg evaluating delta in matlab takes about ~0.8 seconds but as there is no left matrix division that i know of in Math.Net i tried to emulate in these ways 1 : delta = kk.Solve(fg); 2 : delta = kk.Inverse() * fg; but even after 3 whole minutes, it was still evaluating, so am i missing something here?

bigworld12 avatar Feb 24 '18 05:02 bigworld12

@bigworld12, I believe Math.Net doesn't provide any direct solvers for sparse matrices. It will try to solve it as a dense matrix which will take a very long time. I use CSparse.Net for sparse matrices (https://github.com/wo80/CSparse.NET/wiki/Math.NET-Numerics-and-CSparse)

ajos6183 avatar Feb 27 '18 03:02 ajos6183

(Have you tried the iterative solvers, i.e. SolveIterative?)

cdrnet avatar Feb 27 '18 05:02 cdrnet

@cdrnet which one of them ? (the matrix is square and non-symmetric) @ajos6183 i already used that but it doesn't have UMFPACK so it gave poor performance with larger matrices compared to matlab

bigworld12 avatar Feb 27 '18 07:02 bigworld12

@bigworld12, I may be wrong but would this work? https://numerics.mathdotnet.com/api/MathNet.Numerics.LinearAlgebra.Double.Solvers/TFQMR.htm

ajos6183 avatar Mar 01 '18 03:03 ajos6183

Sorry for the necroing, but what is the suggested approach currently?

ChristoWolf avatar Mar 20 '24 15:03 ChristoWolf