Azzera filtri
Azzera filtri

Iterative Solvers in MATLAB

10 visualizzazioni (ultimi 30 giorni)
Sanket
Sanket il 31 Mag 2011
Commentato: Pranav Gupta il 22 Mag 2020
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 Commento
Pranav Gupta
Pranav Gupta il 22 Mag 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.

Accedi per commentare.

Risposte (2)

Laura Proctor
Laura Proctor il 31 Mag 2011
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 Commento
Sanket
Sanket il 31 Mag 2011
Matlab is running the cholinc command for now. I will get back to you after it is executed

Accedi per commentare.


Sanket
Sanket il 1 Giu 2011
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

Categorie

Scopri di più su Sparse Matrices in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by