📄 tv_param.m
字号:
% tvparam.m% Setup gui parameters:% ttlbarcorrects vertical spacing by adjusting for title bar height. ttlbar = [0 75 0 0]; rowheight = [0 25 0 0]; % The vertical space required for a control (20 + 5) guifigsize = [20 scrn(4)-350 350 400]-ttlbar; guifigy = guifigsize(4)-20; %%% Resize window set(guifig,'position',guifigsize); % set "first" control positions a1size = [0 guifigsize(4)-65 floor(1/2*guifigsize(3)) 20]; b1size = [a1size(3)+3 guifigsize(4)-65 floor(1/6*guifigsize(3)) 20];% set data_name and data_size control positions % datasetuppos positions the text that reflects the current data set% datasizepos positions the text that reflects the current data set size (n by n) datasetuppos = [0 guifigy 2/3*guifigsize(3) 20]; datasizepos = [datasetuppos(3) guifigy 1/3*guifigsize(3) 20];% Set default parameter valuesbh = Kstarz * (hx*hy);uh = z;newt_steptol = 1e-5;newt_gradtol = 1e-5;newt_tab_flag = 1;newt_maxiter = 3;cg_steptol = 1e-3;cg_residtol = 1e-3;cg_tab_flag = 1;cg_maxiter = n/2;alpha = 1e-6;beta = 1;gam = 5*alpha;pcgflag = 0;Q_iter = 1;nu = 1;p0 = ceil(log(n)/(2*log(2))); %greatest integer( (log base 2 of n) / 2 )% Check for existence (figure_list(i)>0) of figure. If figure does not exist,% determine the appropriate figure number and store in figure_list.lastfig = max(findobj('type', 'figure'));if ( figure_list(3) > 0 ) cg_fig = figure_list(3);else cg_fig = lastfig + 1; lastfig = lastfig + 1; figure_list(3) = cg_fig;end%% After above (if else end), lastfig is the last figure handle.%% Technically, the "last figure" may not be created yet; but we keep track%% as if it were.if ( figure_list(4) > 0 ) newt_fig = figure_list(4);else % newt_fig = lastfig + 1; figure_list(4) = newt_fig;end% Setup the Graphic Controls for TV methodeval(hideall);set(ui_a16, ... 'style','text', ... 'string',datasetupflag, ... 'position',datasetuppos, ... 'backgroundcolor',bgcolor, ... 'foregroundcolor',[0 0 0], ... 'visible','on');set(ui_b16, ... 'string',[num2str(max(size(z))), ' by ', num2str(max(size(z))) ], ... 'style','text', ... 'position',datasizepos, ... 'backgroundcolor',bgcolor, ... 'foregroundcolor',[0 0 0], ... 'visible','on');% controls for parameter alphaset(ui_a1, ... 'backgroundcolor',bgcolor,... 'foregroundcolor',[1 1 1], ... 'style','text',... 'horizontalalignment','right',... 'string','Reg param alpha =',... 'position',a1size, ... 'visible','on');ui_b1_action = ['alpha=str2num(get(ui_b1,''string''));'];set(ui_b1, ... 'position',b1size, ... 'backgroundcolor',[1 1 1],... 'style','edit',... 'string',num2str(alpha),... 'callback',ui_b1_action,... 'visible','on');% controls for parameter betaset(ui_a2, ... 'backgroundcolor',bgcolor,... 'foregroundcolor',[1 1 1], ... 'style','text',... 'horizontalalignment','right',... 'string','Smoothing param beta =',... 'position',a1size-rowheight, ... 'visible','on');ui_b2_action = ['beta=str2num(get(ui_b2,''string''));'];set(ui_b2, ... 'position',b1size-rowheight, ... 'backgroundcolor',[1 1 1],... 'style','edit',... 'string',num2str(beta),... 'callback',ui_b2_action,... 'visible','on');% controls for parameter newt_maxiterset(ui_a3, ... 'backgroundcolor',bgcolor,... 'foregroundcolor',[1 1 1], ... 'style','text',... 'horizontalalignment','right',... 'string','Newton iter max =',... 'position',a1size-2*rowheight, ... 'visible','on');ui_b3_action = ['newt_maxiter=str2num(get(ui_b3,''string''));'];set(ui_b3, ... 'position',b1size-2*rowheight, ... 'backgroundcolor',[1 1 1],... 'style','edit',... 'string',num2str(newt_maxiter),... 'callback',ui_b3_action,... 'visible','on');% controls for parameter newt_steptolset(ui_a4, ... 'backgroundcolor',bgcolor,... 'foregroundcolor',[1 1 1], ... 'style','text',... 'horizontalalignment','right',... 'string','Newton step tol =',... 'position',a1size-3*rowheight, ... 'visible','on');ui_b4_action = ['newt_steptol=str2num(get(ui_b4,''string''));'];set(ui_b4, ... 'position',b1size-3*rowheight, ... 'backgroundcolor',[1 1 1],... 'style','edit',... 'string',num2str(newt_steptol),... 'callback',ui_b4_action,... 'visible','on');% controls for parameter newt_gradtolset(ui_a5, ... 'backgroundcolor',bgcolor,... 'foregroundcolor',[1 1 1], ... 'style','text',... 'horizontalalignment','right',... 'string','Newton grad tol =',... 'position',a1size-4*rowheight, ... 'visible','on');ui_b5_action = ['newt_gradtol=str2num(get(ui_b5,''string''));']; set(ui_b5, ... 'position',b1size-4*rowheight, ... 'backgroundcolor',[1 1 1],... 'style','edit',... 'string',num2str(newt_gradtol),... 'callback',ui_b5_action,... 'visible','on');% text label "Preconditioning"set(ui_a6, ... 'backgroundcolor',bgcolor,... 'foregroundcolor',[1 1 1], ... 'style','text',... 'horizontalalignment','right',... 'string','Preconditioning: =',... 'position',(a1size-5*rowheight).*[1 1 3/4 1], ... 'visible','on');% cg*_actions for all preconditioning methodscgmax_action = ['cg_maxiter=str2num(get(ui_b10,''string''));'];cgsteptol_action = ['cg_steptol=str2num(get(ui_b11,''string''));'];cgresidtol_action = ['cg_residtol=str2num(get(ui_b12,''string''));'];% controls for no preconditioninguia7pos=[0 a1size(2)-5.7*rowheight(2) 70 18];set(ui_a7, ... 'backgroundcolor',bgcolor,... 'foregroundcolor',[1 1 1], ... 'style','text',... 'horizontalalignment','right',... 'string','none',... 'position',uia7pos, ... 'visible','on');noprecond_action = ['pcgflag = 0;', ... 'set(ui_b8,''value'',0);', ... 'set(ui_b9,''value'',0);', ... 'set(ui_b20,''value'',0);', ... 'set(ui_a13,''visible'',''off'');', ... 'set(ui_a14,''visible'',''off'');', ... 'set(ui_a15,''visible'',''off'');', ... 'set(ui_b13,''visible'',''off'');', ... 'set(ui_b14,''visible'',''off'');', ... 'set(ui_b15,''visible'',''off'');'];uib7pos=[uia7pos(3) uia7pos(2) 18 uia7pos(4)];set(ui_b7, ... 'position',uib7pos, ... 'backgroundcolor',[1 1 1],... 'style','radio',... 'callback',noprecond_action,... 'value',1, ... 'visible','on');% controls for product preconditioninguia8pos=[uia7pos(3)+uib7pos(3) uia7pos(2) 61 uia7pos(4)];set(ui_a8, ... 'backgroundcolor',bgcolor,... 'foregroundcolor',[1 1 1], ... 'style','text',... 'horizontalalignment','right',... 'string', 'product', ... 'position',uia8pos, ... 'visible','on');gamma_action = ['gam = str2num(get(ui_b13,''string''));'];prodprecond_action = ['pcgflag = 1;', ... 'set(ui_b7,''value'',0);', ... 'set(ui_b9,''value'',0);', ... 'set(ui_b20,''value'',0);', ... 'set(ui_a13,''backgroundcolor'',bgcolor);', ... 'set(ui_a13,''foregroundcolor'',[1 1 1]);', ... 'set(ui_a13,''style'',''text'');',... 'set(ui_a13,''string'',''product param gamma'');', ... 'set(ui_a13,''horizontalalignment'',''right'');',... 'set(ui_a13,''position'',a1size-11*rowheight);', ... 'set(ui_a13,''visible'',''on'');', ... 'set(ui_a14,''visible'',''off'');', ... 'set(ui_a15,''visible'',''off'');', ... 'set(ui_b13,''backgroundcolor'',[1 1 1]);', ... 'set(ui_b13,''foregroundcolor'',[0 0 0]);', ... 'set(ui_b13,''style'',''edit'');',... 'set(ui_b13,''string'',num2str(gam));', ... 'set(ui_b13,''horizontalalignment'',''right'');',... 'set(ui_b13,''position'',b1size-11*rowheight);', ... 'set(ui_b13,''callback'',gamma_action);',... 'set(ui_b13,''visible'',''on'');', ... 'set(ui_b14,''visible'',''off'');', ... 'set(ui_b15,''visible'',''off'');'];uib8pos=uib7pos+[uib7pos(3)+uia8pos(3) 0 0 0];set(ui_b8, ... 'position',uib8pos, ... 'backgroundcolor',[1 1 1],... 'style','radio',... 'callback',prodprecond_action,... 'value',0, ... 'visible','on');% controls for multilevel (MLJac) preconditioninguia9pos=uia7pos+[0 -25 0 0];set(ui_a9, ... 'backgroundcolor',bgcolor,... 'foregroundcolor',[1 1 1], ... 'style','text',... 'horizontalalignment','right',... 'string','MLJac', ... 'position',uia9pos, ... 'visible','on');p0_action = ['p0 = str2num(get(ui_b13,''string''));'];Q_iter_action = ['Q_iter = str2num(get(ui_b14,''string''));'];nu_action = ['nu = str2num(get(ui_b15,''string''));'];MLJac_action = ['pcgflag = 2;', ... 'set(ui_b7,''value'',0);', ... 'set(ui_b8,''value'',0);', ... 'set(ui_b20,''value'',0);', ...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -