Iterative Solvers in MATLAB
10 views (last 30 days)
Show older comments
Hello Experts,
I am trying to Solve Ax=B in MATLAB, where A is square matrix of size ~500,000 and B is the vector of same size. I have solved similar equations in COMSOL with iterative solvers like Conjugate Gradient and Algebraic Multigrid Preconditioners.
I have tried many iterative solvers like cgs, bicgs, bicgstab, minres without any preconditioners in MATLAB. But none of them would converge (1e-6). I did not try any preconditioners because I never understood the way to include them in my solver.
Does anyone know how could I implement CG with Algebraic Multigrid Preconditioner in MATLAB? Any other inputs are also welcomed :)
Sanket
1 Comment
Pranav Gupta
on 22 May 2020
Hello Sanket,
It has been a while, but I am curious about your success with the AMG preconditioner. I have sparse non-Hermitian (complex symmetric) matrices (100000x100000) with density ~0.5% and ILU preconditioners, etc. are not working. I was wondering if you have suggestions for me, because AMG needs a Hermitian matrix, which I don't have.
Answers (2)
Laura Proctor
on 31 May 2011
The five-point finite difference approximation to Laplace's equation on a square, two-dimensional domain provides an example. The following statements use the preconditioned conjugate gradient method preconditioner M = R'*R, where R is the incomplete Cholesky factor of A.
A = delsq(numgrid('S',50));
b = ones(size(A,1),1);
tol = 1.e-3;
maxit = 10;
R = cholinc(A,tol);
[x,flag,err,iter,res] = pcg(A,b,tol,maxit,R',R);
Only four iterations are required to achieve the prescribed accuracy.
See Also
Categories
Find more on Sparse Matrices in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!