Solving the arising equation with preconditioned iteration method.

조회 수: 3 (최근 30일)
Ziwen Gu
Ziwen Gu 2023년 12월 19일
댓글: Ziwen Gu 2023년 12월 20일
I want to use preconditioned iteration method, like pcg or gmres, to solve .
In each iteration, it has to solve some additional linear equation with , where M is a selected preconditioner for A.
My question is:
  1. What method will Matlab use to solve the arising eqution ?
  2. Based on the structure of M, I have a quick method to solve , how can I use my method instead of the defaulted one?
  3. Can I get souce code for pcg and gmres?(I tried and failed, because Matlab is not open sourced?) In this way I can write that part of code by myself.
Thanks a lot for your help!

채택된 답변

John D'Errico
John D'Errico 2023년 12월 20일
편집: John D'Errico 2023년 12월 20일
I'm not sure what you are talking about. BOTH PCG and GMRES are written in MATLAB itself. So the source code is provided to you. All you had to do was look.
Should you modify the code? NO! At least, if you do, then make a copy of it, with a new name. Do NOT modify the code and leave the name unchanged.
Can you provide your own solver? READ THE HELP! Here is the pertinent part:
X = PCG(A,B,TOL,MAXIT,M) and X = PCG(A,B,TOL,MAXIT,M1,M2) use the
% symmetric positive definite preconditioner M or M = M1*M2 and
% effectively solve the symmetric system inv(H)*A*inv(H')*Y = inv(H)*B
% for Y, where Y = H'*X and M = H*H'. The algorithm does not form H
% explicitly. If M is [] then a preconditioner is not applied. M may be a
% function handle MFUN returning M\X.
So you can provide a function handle that does the work.
  댓글 수: 1
Ziwen Gu
Ziwen Gu 2023년 12월 20일
Thanks a lot for your answer! Sorry I didn't find the pcg.m file, and neglected the function handle before. Really appreciate for your help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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