time | Calls | line |
---|
| | 7 | function result_map = ff_ipwkz_vf_vec(varargin)
|
| | 8 | %% FF_IPWKZ_VF_VEC solve infinite horizon exo shock + endo asset problem
|
| | 9 | % This program solves the infinite horizon dynamic savings and risky
|
| | 10 | % capital asset problem with some shock. This is the two step solution
|
| | 11 | % with interpolation and with percentage asset grids version of
|
| | 12 | % <https://fanwangecon.github.io/CodeDynaAsset/m_akz/solve/html/ff_iwkz_vf_vec.html
|
| | 13 | % ff_iwkz_vf_vec>. See that file for more descriptions. This is the
|
| | 14 | % vectorized version of the program.
|
| | 15 | %
|
| | 16 | % @param param_map container parameter container
|
| | 17 | %
|
| | 18 | % @param support_map container support container
|
| | 19 | %
|
| | 20 | % @param armt_map container container with states, choices and shocks
|
| | 21 | % grids that are inputs for grid based solution algorithm
|
| | 22 | %
|
| | 23 | % @param func_map container container with function handles for
|
| | 24 | % consumption cash-on-hand etc.
|
| | 25 | %
|
| | 26 | % @return result_map container contains policy function matrix, value
|
| | 27 | % function matrix, iteration results, and policy function, value function
|
| | 28 | % and iteration results tables.
|
| | 29 | %
|
| | 30 | % keys included in result_map:
|
| | 31 | %
|
| | 32 | % * mt_val matrix states_n by shock_n matrix of converged value function grid
|
| | 33 | % * mt_pol_a matrix states_n by shock_n matrix of converged policy function grid
|
| | 34 | % * ar_val_diff_norm array if bl_post = true it_iter_last by 1 val function
|
| | 35 | % difference between iteration
|
| | 36 | % * ar_pol_diff_norm array if bl_post = true it_iter_last by 1 policy
|
| | 37 | % function difference between iterations
|
| | 38 | % * mt_pol_perc_change matrix if bl_post = true it_iter_last by shock_n the
|
| | 39 | % proportion of grid points at which policy function changed between
|
| | 40 | % current and last iteration for each element of shock
|
| | 41 | %
|
| | 42 | % @example
|
| | 43 | %
|
| | 44 | % @include
|
| | 45 | %
|
| | 46 | % * <https://github.com/FanWangEcon/CodeDynaAsset/blob/master/m_ipwkz/paramfunc/ff_ipwkz_evf.m ff_ipwkz_evf>
|
| | 47 | % * <https://github.com/FanWangEcon/CodeDynaAsset/blob/master/m_ipwkz/paramfunc/ffs_ipwkz_set_default_param.m ffs_ipwkz_set_default_param>
|
| | 48 | % * <https://github.com/FanWangEcon/CodeDynaAsset/blob/master/m_ipwkz/paramfunc/ffs_ipwkz_get_funcgrid.m ffs_ipwkz_get_funcgrid>
|
| | 49 | % * <https://github.com/FanWangEcon/CodeDynaAsset/blob/master/m_akz/solvepost/ff_akz_vf_post.m ff_akz_vf_post>
|
| | 50 | %
|
| | 51 |
|
| | 52 | %% Default
|
| | 53 | % * it_param_set = 1: quick test
|
| | 54 | % * it_param_set = 2: benchmark run
|
| | 55 | % * it_param_set = 3: benchmark profile
|
| | 56 | % * it_param_set = 4: press publish button
|
| | 57 |
|
| | 58 | it_param_set = 3;
|
| | 59 | bl_input_override = true;
|
| | 60 | [param_map, support_map] = ffs_ipwkz_set_default_param(it_param_set);
|
| | 61 |
|
| | 62 | % parameters can be set inside ffs_ipwkz_set_default_param or updated here
|
| | 63 | % param_map('it_w_perc_n') = 50;
|
| | 64 | % param_map('it_ak_perc_n') = param_map('it_w_perc_n');
|
| | 65 | % param_map('it_z_n') = 15;
|
| | 66 | % param_map('fl_coh_interp_grid_gap') = 0.025;
|
| | 67 | % param_map('it_c_interp_grid_gap') = 0.001;
|
| | 68 | % param_map('fl_w_interp_grid_gap') = 0.25;
|
| | 69 | % param_map('it_w_perc_n') = 100;
|
| | 70 | % param_map('it_ak_perc_n') = param_map('it_w_perc_n');
|
| | 71 | % param_map('it_z_n') = 11;
|
| | 72 | % param_map('fl_coh_interp_grid_gap') = 0.1;
|
| | 73 | % param_map('it_c_interp_grid_gap') = 10^-4;
|
| | 74 | % param_map('fl_w_interp_grid_gap') = 0.1;
|
| | 75 |
|
| | 76 | % get armt and func map
|
| | 77 | [armt_map, func_map] = ffs_ipwkz_get_funcgrid(param_map, support_map, bl_input_override); % 1 for override
|
| | 78 | default_params = {param_map support_map armt_map func_map};
|
| | 79 |
|
| | 80 | %% Parse Parameters 1
|
| | 81 |
|
| | 82 | % if varargin only has param_map and support_map,
|
| | 83 | params_len = length(varargin);
|
| | 84 | [default_params{1:params_len}] = varargin{:};
|
| | 85 | param_map = [param_map; default_params{1}];
|
| | 86 | support_map = [support_map; default_params{2}];
|
| | 87 | if params_len >= 1 && params_len <= 2
|
| | 88 | % If override param_map, re-generate armt and func if they are not
|
| | 89 | % provided
|
| | 90 | bl_input_override = true;
|
| | 91 | [armt_map, func_map] = ffs_ipwkz_get_funcgrid(param_map, support_map, bl_input_override);
|
| | 92 | else
|
| | 93 | % Override all
|
| | 94 | armt_map = [armt_map; default_params{3}];
|
| | 95 | func_map = [func_map; default_params{4}];
|
| | 96 | end
|
| | 97 |
|
| | 98 | % append function name
|
| | 99 | st_func_name = 'ff_ipwkz_vf_vec';
|
| | 100 | support_map('st_profile_name_main') = [st_func_name support_map('st_profile_name_main')];
|
| | 101 | support_map('st_mat_name_main') = [st_func_name support_map('st_mat_name_main')];
|
| | 102 | support_map('st_img_name_main') = [st_func_name support_map('st_img_name_main')];
|
| | 103 |
|
| | 104 | %% Parse Parameters 2
|
| | 105 |
|
| | 106 | % armt_map
|
| | 107 | params_group = values(armt_map, {'ar_w_level', 'ar_z'});
|
| | 108 | [ar_w_level, ar_z] = params_group{:};
|
| | 109 | params_group = values(armt_map, {'ar_interp_c_grid', 'ar_interp_coh_grid', ...
|
| | 110 | 'mt_interp_coh_grid_mesh_z', 'mt_z_mesh_coh_interp_grid',...
|
| | 111 | 'mt_w_by_interp_coh_interp_grid'});
|
| | 112 | [ar_interp_c_grid, ar_interp_coh_grid, ...
|
| | 113 | mt_interp_coh_grid_mesh_z, mt_z_mesh_coh_interp_grid, ...
|
| | 114 | mt_w_by_interp_coh_interp_grid] = params_group{:};
|
| | 115 | params_group = values(armt_map, {'mt_coh_wkb', 'mt_z_mesh_coh_wkb'});
|
| | 116 | [mt_coh_wkb, mt_z_mesh_coh_wkb] = params_group{:};
|
| | 117 |
|
| | 118 | % func_map
|
| | 119 | params_group = values(func_map, {'f_util_log', 'f_util_crra', 'f_cons'});
|
| | 120 | [f_util_log, f_util_crra, f_cons] = params_group{:};
|
| | 121 |
|
| | 122 | % param_map
|
| | 123 | params_group = values(param_map, {'it_z_n', 'fl_crra', 'fl_beta', 'fl_c_min'});
|
| | 124 | [it_z_n, fl_crra, fl_beta, fl_c_min] = params_group{:};
|
| | 125 | params_group = values(param_map, {'it_maxiter_val', 'fl_tol_val', 'fl_tol_pol', 'it_tol_pol_nochange'});
|
| | 126 | [it_maxiter_val, fl_tol_val, fl_tol_pol, it_tol_pol_nochange] = params_group{:};
|
| | 127 |
|
| | 128 | % support_map
|
| | 129 | params_group = values(support_map, {'bl_profile', 'st_profile_path', ...
|
| | 130 | 'st_profile_prefix', 'st_profile_name_main', 'st_profile_suffix',...
|
| | 131 | 'bl_time', 'bl_graph_evf', 'bl_display', 'it_display_every', 'bl_post'});
|
| | 132 | [bl_profile, st_profile_path, ...
|
| | 133 | st_profile_prefix, st_profile_name_main, st_profile_suffix, ...
|
| | 134 | bl_time, bl_graph_evf, bl_display, it_display_every, bl_post] = params_group{:};
|
| | 135 |
|
| | 136 | %% Initialize Output Matrixes
|
| | 137 |
|
| | 138 | mt_val_cur = zeros(length(ar_interp_coh_grid),length(ar_z));
|
| | 139 | mt_val = mt_val_cur - 1;
|
| | 140 | mt_pol_a = zeros(length(ar_interp_coh_grid),length(ar_z));
|
| | 141 | mt_pol_a_cur = mt_pol_a - 1;
|
| | 142 | mt_pol_k = zeros(length(ar_interp_coh_grid),length(ar_z));
|
| | 143 | mt_pol_k_cur = mt_pol_k - 1;
|
| | 144 | mt_pol_idx = zeros(length(ar_interp_coh_grid),length(ar_z));
|
| | 145 |
|
| | 146 | %% Initialize Convergence Conditions
|
| | 147 |
|
| | 148 | bl_vfi_continue = true;
|
| | 149 | it_iter = 0;
|
| | 150 | ar_val_diff_norm = zeros([it_maxiter_val, 1]);
|
| | 151 | ar_pol_diff_norm = zeros([it_maxiter_val, 1]);
|
| | 152 | mt_pol_perc_change = zeros([it_maxiter_val, it_z_n]);
|
| | 153 |
|
| | 154 | %% Pre-calculate u(c)
|
| | 155 | % Interpolation, see
|
| | 156 | % <https://fanwangecon.github.io/M4Econ/support/speed/partupdate/fs_u_c_partrepeat_main.html
|
| | 157 | % fs_u_c_partrepeat_main> for why interpolate over u(c)
|
| | 158 |
|
| | 159 | % Evaluate
|
| | 160 | if (fl_crra == 1)
|
| | 161 | ar_interp_u_of_c_grid = f_util_log(ar_interp_c_grid);
|
| | 162 | fl_u_neg_c = f_util_log(fl_c_min);
|
| | 163 | else
|
| | 164 | ar_interp_u_of_c_grid = f_util_crra(ar_interp_c_grid);
|
| | 165 | fl_u_neg_c = f_util_crra(fl_c_min);
|
| | 166 | end
|
| | 167 | ar_interp_u_of_c_grid(ar_interp_c_grid <= fl_c_min) = fl_u_neg_c;
|
| | 168 |
|
| | 169 | % Get Interpolant
|
| | 170 | f_grid_interpolant_spln = griddedInterpolant(ar_interp_c_grid, ar_interp_u_of_c_grid, 'spline', 'nearest');
|
| | 171 |
|
| | 172 | %% Iterate Value Function
|
| | 173 | % Loop solution with 4 nested loops
|
| | 174 | %
|
| | 175 | % # loop 1: over exogenous states
|
| | 176 | % # loop 2: over endogenous states
|
| | 177 | % # loop 3: over choices
|
| | 178 | % # loop 4: add future utility, integration--loop over future shocks
|
| | 179 | %
|
| | 180 |
|
| | 181 | % Start Profile
|
| | 182 | if (bl_profile)
|
| | 183 | close all;
|
| | 184 | profile off;
|
| | 185 | profile on;
|
< 0.001 | 1 | 186 | end
|
| | 187 |
|
| | 188 | % Start Timer
|
< 0.001 | 1 | 189 | if (bl_time)
|
< 0.001 | 1 | 190 | tic;
|
< 0.001 | 1 | 191 | end
|
| | 192 |
|
| | 193 | % Value Function Iteration
|
< 0.001 | 1 | 194 | while bl_vfi_continue
|
< 0.001 | 105 | 195 | it_iter = it_iter + 1;
|
| | 196 |
|
| | 197 |
|
| | 198 | %% Interpolate (1) reacahble v(coh(k(w,z),b(w,z),z),z) given v(coh, z)
|
| | 199 | % v(coh,z) solved on ar_interp_coh_grid, ar_z grids, see
|
| | 200 | % ffs_ipwkz_get_funcgrid.m. Generate interpolant based on that, Then
|
| | 201 | % interpolate for the coh reachable levels given the k(w,z) percentage
|
| | 202 | % choice grids in the second stage of the problem
|
| | 203 |
|
| | 204 | % Generate Interpolant for v(coh,z)
|
0.038 | 105 | 205 | f_grid_interpolant_value = griddedInterpolant(...
|
| 105 | 206 | mt_z_mesh_coh_interp_grid', mt_interp_coh_grid_mesh_z', mt_val_cur', 'linear', 'nearest');
|
| | 207 |
|
| | 208 | % Interpoalte for v(coh(k(w,z),b(w,z),z),z)
|
0.339 | 105 | 209 | mt_val_wkb_interpolated = f_grid_interpolant_value(mt_z_mesh_coh_wkb, mt_coh_wkb);
|
| | 210 |
|
| | 211 | %% Solve Second Stage Problem k*(w,z)
|
| | 212 | % This is the key difference between this function and
|
| | 213 | % <https://fanwangecon.github.io/CodeDynaAsset/m_akz/paramfunc/html/ffs_akz_set_functions.html
|
| | 214 | % ffs_akz_set_functions> which solves the two stages jointly
|
| | 215 | % Interpolation first, because solution coh grid is not the same as all
|
| | 216 | % points reachable by k and b choices given w.
|
| | 217 |
|
0.008 | 105 | 218 | support_map('bl_graph_evf') = false;
|
< 0.001 | 105 | 219 | if (it_iter == (it_maxiter_val + 1))
|
< 0.001 | 1 | 220 | support_map('bl_graph_evf') = bl_graph_evf;
|
< 0.001 | 1 | 221 | end
|
| | 222 |
|
< 0.001 | 105 | 223 | bl_input_override = true;
|
0.236 | 105 | 224 | [mt_ev_condi_z_max, ~, mt_ev_condi_z_max_kp, ~] = ...
|
| 105 | 225 | ff_ipwkz_evf(mt_val_wkb_interpolated, param_map, support_map, armt_map, bl_input_override);
|
| | 226 |
|
| | 227 | %% Solve First Stage Problem w*(z) given k*(w,z)
|
| | 228 |
|
| | 229 | % loop 1: over exogenous states
|
< 0.001 | 105 | 230 | for it_z_i = 1:length(ar_z)
|
| | 231 |
|
| | 232 | % State Array fixed
|
0.002 | 1575 | 233 | ar_coh_z = mt_interp_coh_grid_mesh_z(:,it_z_i);
|
| | 234 |
|
| | 235 | % Get 2nd Stage Arrays
|
0.002 | 1575 | 236 | ar_ev_condi_z_max_z = mt_ev_condi_z_max(:, it_z_i);
|
0.002 | 1575 | 237 | ar_w_level_kstar_z = mt_ev_condi_z_max_kp(:, it_z_i);
|
| | 238 |
|
| | 239 | % Interpolate (2) k*(ar_w_perc) from k*(ar_w_level,z)
|
| | 240 | % There are two w=k'+b' arrays. ar_w_level is the level even grid based
|
| | 241 | % on which we solve the 2nd stage problem in ff_ipwkz_evf.m. Here for
|
| | 242 | % each coh level, we have a different vector of w levels, but the same
|
| | 243 | % vector of percentage ws. So we need to interpolate to get the optimal
|
| | 244 | % k* and b* choices at each percentage level of w.
|
0.063 | 1575 | 245 | f_interpolante_w_level_kstar_z = griddedInterpolant(ar_w_level, ar_w_level_kstar_z', 'linear', 'nearest');
|
| | 246 |
|
| | 247 | % Interpolant for (3) EV(k*(ar_w_perc),Z)
|
0.031 | 1575 | 248 | f_interpolante_ev_condi_z_max_z = griddedInterpolant(ar_w_level, ar_ev_condi_z_max_z', 'linear', 'nearest');
|
| | 249 |
|
| | 250 | % Interpolat (2) and (3)
|
0.273 | 1575 | 251 | mt_w_kstar_interp_z = f_interpolante_w_level_kstar_z(mt_w_by_interp_coh_interp_grid);
|
0.021 | 1575 | 252 | mt_w_astar_interp_z = mt_w_by_interp_coh_interp_grid - mt_w_kstar_interp_z;
|
0.204 | 1575 | 253 | mt_ev_condi_z_max_interp_z = f_interpolante_ev_condi_z_max_z(mt_w_by_interp_coh_interp_grid);
|
| | 254 |
|
| | 255 | % Consumption
|
| | 256 | % Note that compared to
|
| | 257 | % <https://fanwangecon.github.io/CodeDynaAsset/m_akz/paramfunc/html/ffs_akz_set_functions.html
|
| | 258 | % ffs_akz_set_functions> the mt_c here is much smaller the same
|
| | 259 | % number of columns (states) as in the ffs_akz_set_functions file,
|
| | 260 | % but the number of rows equal to ar_w length.
|
0.240 | 1575 | 261 | mt_c = f_cons(ar_coh_z', mt_w_astar_interp_z, mt_w_kstar_interp_z);
|
| | 262 |
|
| | 263 | % Interpolate for (4) EVAL current utility: N by N, f_util defined earlier
|
0.387 | 1575 | 264 | mt_utility = f_grid_interpolant_spln(mt_c);
|
| | 265 |
|
| | 266 | % EVAL add on future utility, N by N + N by N
|
| | 267 | % previously mt_ev_condi_z_max_interp_z was N by 1, not N by N
|
0.026 | 1575 | 268 | mt_utility = mt_utility + fl_beta*mt_ev_condi_z_max_interp_z;
|
| | 269 |
|
| | 270 | % Optimization: remember matlab is column major, rows must be
|
| | 271 | % choices, columns must be states
|
| | 272 | % <https://en.wikipedia.org/wiki/Row-_and_column-major_order COLUMN-MAJOR>
|
0.073 | 1575 | 273 | [ar_opti_val1_z, ar_opti_idx_z] = max(mt_utility);
|
0.010 | 1575 | 274 | mt_val(:,it_z_i) = ar_opti_val1_z;
|
| | 275 |
|
| | 276 | % Generate Linear Opti Index
|
0.006 | 1575 | 277 | [it_choies_n, it_states_n] = size(mt_utility);
|
0.021 | 1575 | 278 | ar_add_grid = linspace(0, it_choies_n*(it_states_n-1), it_states_n);
|
0.002 | 1575 | 279 | ar_opti_linear_idx_z = ar_opti_idx_z + ar_add_grid;
|
| | 280 |
|
| | 281 | % Store Optimal
|
0.014 | 1575 | 282 | mt_pol_a(:,it_z_i) = mt_w_astar_interp_z(ar_opti_linear_idx_z);
|
0.011 | 1575 | 283 | mt_pol_k(:,it_z_i) = mt_w_kstar_interp_z(ar_opti_linear_idx_z);
|
< 0.001 | 1575 | 284 | if (it_iter == (it_maxiter_val + 1))
|
< 0.001 | 15 | 285 | mt_pol_idx(:,it_z_i) = ar_opti_linear_idx_z;
|
< 0.001 | 15 | 286 | end
|
| | 287 |
|
0.001 | 1575 | 288 | end
|
| | 289 |
|
| | 290 | %% Check Tolerance and Continuation
|
| | 291 |
|
| | 292 | % Difference across iterations
|
0.038 | 105 | 293 | ar_val_diff_norm(it_iter) = norm(mt_val - mt_val_cur);
|
0.062 | 105 | 294 | ar_pol_diff_norm(it_iter) = norm(mt_pol_a - mt_pol_a_cur) + norm(mt_pol_k - mt_pol_k_cur);
|
0.007 | 105 | 295 | ar_pol_a_perc_change = sum((mt_pol_a ~= mt_pol_a_cur))/(length(ar_interp_coh_grid));
|
0.005 | 105 | 296 | ar_pol_k_perc_change = sum((mt_pol_k ~= mt_pol_k_cur))/(length(ar_interp_coh_grid));
|
0.013 | 105 | 297 | mt_pol_perc_change(it_iter, :) = mean([ar_pol_a_perc_change;ar_pol_k_perc_change]);
|
| | 298 |
|
| | 299 | % Update
|
0.005 | 105 | 300 | mt_val_cur = mt_val;
|
0.003 | 105 | 301 | mt_pol_a_cur = mt_pol_a;
|
0.003 | 105 | 302 | mt_pol_k_cur = mt_pol_k;
|
| | 303 |
|
| | 304 | % Print Iteration Results
|
< 0.001 | 105 | 305 | if (bl_display && (rem(it_iter, it_display_every)==0))
|
| | 306 | fprintf('VAL it_iter:%d, fl_diff:%d, fl_diff_pol:%d\n', ...
|
| | 307 | it_iter, ar_val_diff_norm(it_iter), ar_pol_diff_norm(it_iter));
|
| | 308 | tb_valpol_iter = array2table([mean(mt_val_cur,1);...
|
| | 309 | mean(mt_pol_a_cur,1); ...
|
| | 310 | mean(mt_pol_k_cur,1); ...
|
| | 311 | mt_val_cur(length(ar_interp_coh_grid),:); ...
|
| | 312 | mt_pol_a_cur(length(ar_interp_coh_grid),:); ...
|
| | 313 | mt_pol_k_cur(length(ar_interp_coh_grid),:)]);
|
| | 314 | tb_valpol_iter.Properties.VariableNames = strcat('z', string((1:size(mt_val_cur,2))));
|
| | 315 | tb_valpol_iter.Properties.RowNames = {'mval', 'map', 'mak', 'Hval', 'Hap', 'Hak'};
|
| | 316 | disp('mval = mean(mt_val_cur,1), average value over a')
|
| | 317 | disp('map = mean(mt_pol_a_cur,1), average choice over a')
|
| | 318 | disp('mkp = mean(mt_pol_k_cur,1), average choice over k')
|
| | 319 | disp('Hval = mt_val_cur(it_ameshk_n,:), highest a state val')
|
| | 320 | disp('Hap = mt_pol_a_cur(it_ameshk_n,:), highest a state choice')
|
| | 321 | disp('mak = mt_pol_k_cur(it_ameshk_n,:), highest k state choice')
|
| | 322 | disp(tb_valpol_iter);
|
| | 323 | end
|
| | 324 |
|
| | 325 | % Continuation Conditions:
|
| | 326 | % 1. if value function convergence criteria reached
|
| | 327 | % 2. if policy function variation over iterations is less than
|
| | 328 | % threshold
|
< 0.001 | 105 | 329 | if (it_iter == (it_maxiter_val + 1))
|
< 0.001 | 1 | 330 | bl_vfi_continue = false;
|
0.001 | 104 | 331 | elseif ((it_iter == it_maxiter_val) || ...
|
| 104 | 332 | (ar_val_diff_norm(it_iter) < fl_tol_val) || ...
|
| 104 | 333 | (sum(ar_pol_diff_norm(max(1, it_iter-it_tol_pol_nochange):it_iter)) < fl_tol_pol))
|
| | 334 | % Fix to max, run again to save results if needed
|
< 0.001 | 1 | 335 | it_iter_last = it_iter;
|
< 0.001 | 1 | 336 | it_iter = it_maxiter_val;
|
< 0.001 | 1 | 337 | end
|
| | 338 |
|
< 0.001 | 105 | 339 | end
|
| | 340 |
|
| | 341 | % End Timer
|
< 0.001 | 1 | 342 | if (bl_time)
|
< 0.001 | 1 | 343 | toc;
|
< 0.001 | 1 | 344 | end
|
| | 345 |
|
| | 346 | % End Profile
|
< 0.001 | 1 | 347 | if (bl_profile)
|
0.004 | 1 | 348 | profile off
|
| | 349 | profile viewer
|
| | 350 | st_file_name = [st_profile_prefix st_profile_name_main st_profile_suffix];
|
| | 351 | profsave(profile('info'), strcat(st_profile_path, st_file_name));
|
| | 352 | end
|
| | 353 |
|
| | 354 | %% Process Optimal Choices
|
| | 355 |
|
| | 356 | result_map = containers.Map('KeyType','char', 'ValueType','any');
|
| | 357 | result_map('mt_val') = mt_val;
|
| | 358 | result_map('mt_pol_idx') = mt_pol_idx;
|
| | 359 |
|
| | 360 | result_map('cl_mt_pol_coh') = {mt_interp_coh_grid_mesh_z, zeros(1)};
|
| | 361 | result_map('cl_mt_pol_a') = {mt_pol_a, zeros(1)};
|
| | 362 | result_map('cl_mt_pol_k') = {mt_pol_k, zeros(1)};
|
| | 363 | result_map('cl_mt_pol_c') = {f_cons(mt_interp_coh_grid_mesh_z, mt_pol_a, mt_pol_k), zeros(1)};
|
| | 364 | result_map('ar_st_pol_names') = ["cl_mt_pol_coh", "cl_mt_pol_a", "cl_mt_pol_k", "cl_mt_pol_c"];
|
| | 365 |
|
| | 366 | if (bl_post)
|
| | 367 | bl_input_override = true;
|
| | 368 | result_map('ar_val_diff_norm') = ar_val_diff_norm(1:it_iter_last);
|
| | 369 | result_map('ar_pol_diff_norm') = ar_pol_diff_norm(1:it_iter_last);
|
| | 370 | result_map('mt_pol_perc_change') = mt_pol_perc_change(1:it_iter_last, :);
|
| | 371 |
|
| | 372 | % graphing based on coh_wkb, but that does not match optimal choice
|
| | 373 | % matrixes for graphs.
|
| | 374 | armt_map('mt_coh_wkb') = mt_interp_coh_grid_mesh_z;
|
| | 375 | armt_map('it_ameshk_n') = length(ar_interp_coh_grid);
|
| | 376 | armt_map('ar_a_meshk') = mt_interp_coh_grid_mesh_z(:,1);
|
| | 377 | armt_map('ar_k_mesha') = zeros(size(mt_interp_coh_grid_mesh_z(:,1)) + 0);
|
| | 378 |
|
| | 379 | result_map = ff_akz_vf_post(param_map, support_map, armt_map, func_map, result_map, bl_input_override);
|
| | 380 | end
|
| | 381 |
|
| | 382 | end
|
Other subfunctions in this file are not included in this listing.