This is a static copy of a profile report

Home

ffy_rouwenhorst (Calls: 1, Time: 0.014 s)
Generated 16-Jul-2020 17:08:32 using performance time.
function in file /Users/sidhantkhanna/Documents/GitHub/BKS modified/ProfFanCode/external/stats/ffy_rouwenhorst.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
hhsave_VFI_3OCfunction1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
83
mt_disc_ar1_trans = ffy_rouwen...
10.010 s75.2%
36
[fl_ar1_persistence, fl_shk_st...
10.001 s4.4%
65
if (it_std_bound==0)
10.000 s3.5%
77
ar_disc_ar1 = (fl_ar1_beg:fl_a...
10.000 s2.4%
30
if (~isempty(varargin))
10.000 s2.2%
All other lines  0.002 s12.4%
Totals  0.014 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
ffy_rouwenhorst_mkv_recursivefunction10.010 s70.8%
Self time (built-ins, overhead, etc.)  0.004 s29.2%
Totals  0.014 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function80
Non-code lines (comments, blank lines)24
Code lines (lines that can run)56
Code lines that did run25
Code lines that did not run31
Coverage (did run/can run)44.64 %
Function listing
time 
Calls 
 line
  28 
function [ar_disc_ar1, mt_disc_ar1_trans] = ffy_rouwenhorst(varargin)
  29 

< 0.001 
      1 
  30
if (~isempty(varargin)) 
  31 
    
< 0.001 
      1 
  32
    bl_verbose = false; 
< 0.001 
      1 
  33
    it_std_bound = 0; 
  34 
    
< 0.001 
      1 
  35
    if (length(varargin) == 3) 
< 0.001 
      1 
  36
        [fl_ar1_persistence, fl_shk_std, it_disc_points] = varargin{:};         
  37 
    elseif (length(varargin) == 4)
  38 
        [fl_ar1_persistence, fl_shk_std, it_disc_points, ...
  39 
            bl_verbose] = varargin{:};
  40 
    elseif (length(varargin) == 5)
  41 
        [fl_ar1_persistence, fl_shk_std, it_disc_points, ...
  42 
            bl_verbose, it_std_bound] = varargin{:};
  43 
    else
  44 
        error('Must specify three parameters.');
< 0.001 
      1 
  45
    end 
  46 

< 0.001 
      1 
  47
    if (it_disc_points<=1) 
  48 
        error('Must discretize to more than 1 point.');
< 0.001 
      1 
  49
    end         
  50 

  51 
else
  52 
    
  53 
    fl_ar1_persistence = 0.60;
  54 
    fl_shk_std = 0.20;
  55 
    it_disc_points = 5;
  56 
    it_std_bound = 0;
  57 
    bl_verbose = true;
  58 
    
< 0.001 
      1 
  59
end 
  60 

  61 
% standard deviation of the AR1 process
< 0.001 
      1 
  62
fl_sig_ar1 = sqrt(fl_shk_std^2/(1-fl_ar1_persistence^2)); 
  63 

  64 
% bounds
< 0.001 
      1 
  65
if (it_std_bound==0) 
< 0.001 
      1 
  66
    fl_ar1_end = sqrt(it_disc_points-1)*fl_sig_ar1; 
  67 
else
  68 
    fl_ar1_end = abs(it_std_bound)*fl_sig_ar1;
< 0.001 
      1 
  69
end 
  70 

  71 
% grid
< 0.001 
      1 
  72
fl_ar1_beg = -fl_ar1_end; 
< 0.001 
      1 
  73
fl_ar1_step = (fl_ar1_end-fl_ar1_beg)/(it_disc_points-1); % Could have used the command linspace 
< 0.001 
      1 
  74
if it_disc_points == 1 
  75 
    ar_disc_ar1 = 0;
< 0.001 
      1 
  76
else 
< 0.001 
      1 
  77
    ar_disc_ar1 = (fl_ar1_beg:fl_ar1_step:fl_ar1_end)'; 
< 0.001 
      1 
  78
end 
  79 

  80 
% get mass
< 0.001 
      1 
  81
fl_p0 = 0.5*(1+fl_ar1_persistence); 
< 0.001 
      1 
  82
fl_q0 = fl_p0; 
  0.010 
      1 
  83
mt_disc_ar1_trans = ffy_rouwenhorst_mkv_recursive(fl_p0,fl_q0,it_disc_points); 
  84 

  85 
% print
< 0.001 
      1 
  86
if (bl_verbose) 
  87 
    
  88 
    % gather all info
  89 
    mp_container_map = containers.Map('KeyType','char', 'ValueType','any');
  90 
    mp_container_map('fl_ar1_persistence') = fl_ar1_persistence;
  91 
    mp_container_map('fl_shk_std') = fl_shk_std;
  92 
    mp_container_map('it_std_bound') = it_std_bound;
  93 
    mp_container_map('fl_sig_ar1') = fl_sig_ar1;
  94 
    mp_container_map('fl_ar1_end') = fl_ar1_end;
  95 
    mp_container_map('fl_ar1_beg') = fl_ar1_beg;
  96 
    mp_container_map('fl_ar1_step') = fl_ar1_step;
  97 
    mp_container_map('ar_disc_ar1') = ar_disc_ar1;
  98 
    mp_container_map('fl_p0') = fl_p0;
  99 
    mp_container_map('fl_q0') = fl_q0;
 100 
    mp_container_map('mt_disc_ar1_trans') = mt_disc_ar1_trans;
 101 
    
 102 
    % print
 103 
    ff_container_map_display(mp_container_map, 50, 50);
 104 

< 0.001 
      1 
 105
end 
 106 

< 0.001 
      1 
 107
end