📄 fmg.m
字号:
%FMG Full Multigrid Solver
%
% [X,RESIDS,ITS] = FMG(A,B) uses the full-multigrid cycle to
% solve the linear system AX=B. RESIDS is the final residual
% and ITS is 1.
%
% Accesses global variables in "include_globals"
% James Bordner and Faisal Saied
% Department of Computer Science
% University of Illinois at Urbana-Champaign
% 10 April 1995
% Modified for Matlab Version 6 Compatability
% Ryan McKenzie
% University of Kentucky Center for Computational Sciences
% April 2004
%
% For some reason, locally generated variables cannot be seen outside the scope of a
% particular function in version 6 unless they have a global reference. This seems to
% only occur when the newly generated variable is passed as a parameter. I have taken
% locally generated variables throughout MGLab and "bridged" them to their destination
% routines using global references. It's an ugly fix, so maybe someone should come up
% with a more centralized solution.
function [x,resids,its] = fmg(A,b,x)
include_globals
include_bridge_globals
% gobally referencing variables from the solve routine "bridge"
b = b_in_sol_method;
A = A_in_sol_method;
x = fmg_cycle(1,b);
rn = norm(b-A*x);
results=update_results([],'Full Multigrid',1,rn);
its=results(:,1);
resids=results(:,4);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -