Iterative Solvers in MATLAB

10 次查看(过去 30 天)
Sanket
Sanket 2011-5-31
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 个评论
Pranav Gupta
Pranav Gupta 2020-5-22
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.

请先登录,再进行评论。

回答(2 个)

Laura Proctor
Laura Proctor 2011-5-31
Try the pcg function in MATLAB.
From the documentation:
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.
  1 个评论
Sanket
Sanket 2011-5-31
Matlab is running the cholinc command for now. I will get back to you after it is executed

请先登录,再进行评论。


Sanket
Sanket 2011-6-1
I used the following command, [matlab_solution,flag,relres,iter,res]=pcg(stiffness,rhs,[],200000,R',R);
After 1669 iterations, the solver stopped giving flag 3 with relres=14.0242.
The solution obtained is way incorrect. Do you know what could solve it?
One of the conditions in pcg is square matrix must be symmetric and positive definite. How would I verify that?
Also, I tried cond and condest function but I get out of memory errors.
Sanket

类别

Help CenterFile Exchange 中查找有关 Sparse Matrices 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by