This is a static copy of a profile report

Home

Function details for OC2This is a static copy of a profile report

Home

OC2 (Calls: 1, Time: 1.111 s)
Generated 01-May-2020 08:41:16 using performance time.
function in file /Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Households/OC2.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
hhsave_util_2OCfunction1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
77
it_zgridno, it_agridno);
10.723 s65.1%
29
addpath(genpath('/Users/sidhan...
10.377 s33.9%
114
profile off;
10.004 s0.4%
69
[a_m,z_m] = meshgrid(ar_a,ar_z...
10.003 s0.2%
80
mt_profit       = z_m.*(mt_k_s...
10.001 s0.1%
All other lines  0.003 s0.3%
Totals  1.111 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
optiklfunction10.722 s65.0%
genpathfunction10.275 s24.8%
addpathfunction10.101 s9.1%
meshgridfunction10.002 s0.1%
Self time (built-ins, overhead, etc.)  0.011 s1.0%
Totals  1.111 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function101
Non-code lines (comments, blank lines)27
Code lines (lines that can run)74
Code lines that did run27
Code lines that did not run47
Coverage (did run/can run)36.49 %
Function listing
time 
Calls 
 line
  19 
function [mt_o, mt_coh]= OC2(varargin)
  20 

  21 
close all;
  22 
bl_profile = true;      % Switch off profile if running a tester/calling from another function
  23 
bl_saveimg = true;
  24 
if(bl_profile)
  25 
profile off;
  26 
profile on;
< 0.001 
      1 
  27
end 
  28 

  0.377 
      1 
  29
addpath(genpath('/Users/sidhantkhanna/Documents/GitHub/BKS modified/')); 
  30 

  31 
%% Assigning Parameters
  32 

< 0.001 
      1 
  33
if ~isempty(varargin) 
  34 
    
  0.002 
      1 
  35
    [ar_a,ar_z, ... 
      1 
  36
        fl_alpha,fl_theta,fl_delta,fl_kappa,fl_r,fl_w,fl_phi,fl_ahi,fl_zhi, ... 
      1 
  37
         it_zgridno, it_agridno, ... 
      1 
  38
        ] = varargin{:}; 
  39 
    
< 0.001 
      1 
  40
    bl_print  = false; 
< 0.001 
      1 
  41
    bl_plot   = false; 
  42 

  43 
    
  44 
else
  45 
    close all;
  46 
    
  47 
    fl_ahi         = 5;
  48 
    fl_zhi         = 2.5;
  49 
    it_agridno     = 5;
  50 
    it_zgridno     = 6;
  51 
    ar_a = linspace(0,fl_ahi,it_agridno);
  52 
    ar_z = linspace(1.2,fl_zhi,it_zgridno);
  53 
    fl_phi         = 0.5;
  54 
    
  55 
    fl_alpha = 0.4;
  56 
    fl_theta = 0.79-fl_alpha;
  57 
    fl_delta = 0.05;
  58 
    fl_kappa = 0;
  59 
        
  60 
    [fl_r,fl_w,fl_ahi] = ...
  61 
        deal(0.05,1.5,100);
  62 
    bl_print       = true;
  63 
    bl_plot        = true;
  64 
    
< 0.001 
      1 
  65
end 
  66 

< 0.001 
      1 
  67
fl_R = fl_r + fl_delta; 
  68 

  0.003 
      1 
  69
[a_m,z_m] = meshgrid(ar_a,ar_z); 
< 0.001 
      1 
  70
a_m       = a_m'; 
< 0.001 
      1 
  71
z_m       = z_m'; 
  72 

  73 
%% Making Occupational choice
  74 

  0.723 
      1 
  75
[mt_k_star, mt_l_star] = optikl(ar_a,ar_z, ... 
      1 
  76
        fl_alpha,fl_theta,fl_delta,fl_kappa,fl_r,fl_w,fl_phi,fl_ahi,fl_zhi, ... 
      1 
  77
         it_zgridno, it_agridno); 
  78 

< 0.001 
      1 
  79
 mt_wage         = fl_w.*ones(it_agridno, it_zgridno); 
< 0.001 
      1 
  80
 mt_profit       = z_m.*(mt_k_star.^fl_alpha).*(mt_l_star.^fl_theta) - fl_R.*mt_k_star - fl_w.*mt_l_star - ((1+fl_r)*(fl_kappa)).*ones(it_agridno, it_zgridno); 
< 0.001 
      1 
  81
 mt_o            = zeros(it_agridno, it_zgridno); 
< 0.001 
      1 
  82
 mt_o(mt_wage<mt_profit) = 1;                        % Matrix for Occupational Choice 
< 0.001 
      1 
  83
 mt_income       = max(mt_wage,mt_profit);           % Matrix for Income 
< 0.001 
      1 
  84
 mt_coh          = mt_income + a_m.*(1+fl_r);        % Matrix for COH 
  85 
 
  86 
 %% Printing Outputs
  87 
 
< 0.001 
      1 
  88
 if(bl_print) 
  89 
    disp('Below is mt_wage');
  90 
    disp((mt_wage));
  91 
    disp('Below is mt_profit ');
  92 
    disp(mt_profit );
  93 
    disp('Below is mt_o ');
  94 
    disp(mt_o);
  95 
    disp('Below is mt_income');
  96 
    disp(mt_income);
  97 
    disp('Below is mt_coh');
  98 
    disp(mt_coh);
  99 
 end
 100 
    
 101 
 
< 0.001 
      1 
 102
 if(bl_plot)     
 103 
figure(1)
 104 
imagesc(ar_a,ar_z,mt_o');
 105 
set(gca,'YDir','normal')
 106 
xlabel('assets','FontSize', 20); 
 107 
ylabel('Entrepreneurial productivity','FontSize', 20);
 108 
if(bl_saveimg)
 109 
saveas(gcf, '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Households/figures/OC2/OC2.png');
 110 
end
 111 
end
 112 

< 0.001 
      1 
 113
if(bl_profile) 
  0.004 
      1 
 114
profile off; 
 115 
profile viewer;
 116 
st_file_name = '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Profile/Households/OC2';
 117 
profsave(profile('info'), st_file_name);
 118 

 119 
end

Other subfunctions in this file are not included in this listing.