calc_model_prior_test

PURPOSE ^

Verify model prior calcs

SYNOPSIS ^

function ok= calc_model_prior_test;

DESCRIPTION ^

 Verify model prior calcs
 $Id: calc_model_prior_test.m 3127 2012-06-08 16:19:25Z bgrychtol $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ok= calc_model_prior_test;
0002 % Verify model prior calcs
0003 % $Id: calc_model_prior_test.m 3127 2012-06-08 16:19:25Z bgrychtol $
0004 
0005 % TODO: also test the various inverse prior calls
0006 
0007 imdl= mk_common_model('c2c2',16);
0008 try; imdl= rmfield(imdl,'RtR_prior'); end
0009 try; imdl= rmfield(imdl,'R_prior');   end
0010 
0011 any_priors= {@prior_tikhonov, ...
0012              @prior_noser, ...
0013              @prior_gaussian_HPF, ...
0014              @prior_laplace};
0015 
0016 R_priors=   {any_priors{:}, ...
0017              @prior_TV};
0018 
0019 % Call R_priors as R_priors
0020 eidors_cache clear
0021 for i = 1:length(R_priors); p = R_priors{i};
0022    inv_mdl= imdl;
0023    inv_mdl.R_prior= p;
0024    R= calc_R_prior(inv_mdl);
0025    fprintf('R_prior: %20s  R_condest= %5.4g\n', func2str(p), condest(R'*R));
0026 end
0027    
0028 % Call R_priors as RtR_priors
0029 eidors_cache clear
0030 for i = 1:length(R_priors); p = R_priors{i};
0031    inv_mdl= imdl;
0032    inv_mdl.R_prior= p;
0033    RtR= calc_RtR_prior(inv_mdl);
0034    fprintf('R_prior: %20s  RtR_condest= %5.4g\n', func2str(p), condest(RtR));
0035 end
0036    
0037 % Call RtR_priors as RtR_priors
0038 eidors_cache clear
0039 for i = 1:length(R_priors); p = R_priors{i};
0040    inv_mdl= imdl;
0041    inv_mdl.RtR_prior= p;
0042    RtR= calc_RtR_prior(inv_mdl);
0043    if diff(size(RtR))~=0  % non-square
0044       fprintf('RtR_prior: %20s  RtR_condest= NON-SQUARE\n', func2str(p) );
0045    else
0046       fprintf('RtR_prior: %20s  RtR_condest= %5.4g\n', func2str(p), condest(RtR));
0047    end
0048 end
0049 
0050 % Call RtR_priors as R_priors
0051 eidors_cache clear
0052 for i = 1:length(R_priors); p = R_priors{i};
0053    inv_mdl= imdl;
0054    inv_mdl.RtR_prior= p;
0055    if strcmp(func2str(p), 'prior_TV')
0056       continue; % not fair to ask it to ichol a non-square matrix
0057    end
0058    R= calc_R_prior(inv_mdl);
0059    fprintf('RtR_prior: %20s  R_condest= %5.4g\n', func2str(p), condest(R'*R));
0060 end

Generated on Wed 21-Jun-2017 09:29:07 by m2html © 2005