Alston
Alston

Reputation: 33

How to solve Ax=b with matlab where A is a large unsymmetric sparse matrix?

I'm doing with Ax = b where A is very large (over 1m*1m size), non-symmetrical sparse matrix in matlab. I build A in sparse way. However, using A\b directly is too slow. I tried gmres. However, without pre-conditioner I cannot get the right answer and with pre-conditioner (ilu for instance) it's also too slow.

How can I solve this problem efficiently? Thx.

Upvotes: 1

Views: 427

Answers (1)

paul-g
paul-g

Reputation: 3886

It's difficult to give a definitive answer, since it depends on the particulars of the system you are solving. Unfortunately this involves a lot of trial and error on your side and there is no guaranteed method that will work for any system. Here are a few things to consider:

  1. How sparse is the system and how slow is too slow? 1M x 1M is a fairly large system, but the work depends on the number of non-zeros; so if your system has many nonzeros, then yes, it will take a while to run; another aspect that could lead to a long running time is the poor numerical conditioning of your system (see 1 and 2); preconditioning should help with this, as long as you use an effective preconditioner
  2. Try a different iterative method: for example the BiCG method or BiCGStab, which should also work for unsymmetric systems
  3. Try to tweak the ILU pre-conditioner or use a different preconditioner: increasing the drop tolerance will result in a sparser pre-conditioner which may affect convergence, but reduce total work per iteration (values smaller than the drop tolerance are removed from the sparse matrix during factorization); you could also tweak the type of the precodntiioner ilu(0), crout, ilutp;
  4. Make sure you are using parallel and optimised implementations of the BLAS libraries, such as the Intel MKL Blas or at least Open BLAS; this should speed up the direct method a fair bit
  5. Finally you could try to use a different framework; other frameworks also allow you to select directly the level of fill-in of the ILU preconditioner (giving you more options to explore, which result in a denser preconditioner, but with better convergence behaviour); other frameworks like PetSC also support a wider range of preconditioners and iterative solvers;

Upvotes: 2

Related Questions