This is a static copy of a profile report

Home

BGC_DO_simsvdIC (1 call, 14.681 sec)
Generated 04-Aug-2014 13:05:18 using cpu time.
function in file /gdata/projects/atl/FV_Matlab_Framework_JingPJH/trunk/Cases/Bottom_Gravity_Current/BGC_DO_simsvdIC.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
Bottom_Gravity_Current_Setup6DOscript1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
42
[Umat, Svals, Vmat] = svd (var...
112.172 s82.9%
24
load (fullfile(app.DOicDir,num...
1201.203 s8.2%
25
var_mat(:,n+1) = [u./app.sigma...
1200.446 s3.0%
36
var_mat = var_mat - repmat ( v...
10.375 s2.6%
18
var_mat = repmat ( [u./app.sig...
10.207 s1.4%
All other lines  0.278 s1.9%
Totals  14.681 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
meanfunction10.071 s0.5%
num2strfunction1200.071 s0.5%
fullfilefunction1210.032 s0.2%
normrndfunction400.019 s0.1%
Self time (built-ins, overhead, etc.)  14.487 s98.7%
Totals  14.681 s100% 
Code Analyzer results
Line numberMessage
2Extra semicolon is unnecessary.
38Assignment to 'var_mat' might be unnecessary.
42The value assigned to variable 'Vmat' might be unused.
Coverage results
Show coverage for parent directory
Total lines in function71
Non-code lines (comments, blank lines)43
Code lines (lines that can run)28
Code lines that did run28
Code lines that did not run0
Coverage (did run/can run)100.00 %
Function listing
time 
calls 
 line
   2 
function [umean,vmean,rhomean,ui,vi,rhoi,Yi] = BGC_DO_simsvdIC (app);
   3 

   4 
%-------------------------------------------------------------------------------
   5 
% Load realizations.
   6 
%-------------------------------------------------------------------------------
   7 

   8 
% Load ICs.
   9 

  0.01 
      1 
  10 
load (fullfile(app.DOicDir,'000')); 
  11 

  12 
% Set sizes & working storage.
  13 

      1 
  14 
Nu = length(u); 
      1 
  15 
Nv = length(v); 
      1 
  16 
Nrho = length(rho); 
  17 

  0.21 
      1 
  18 
var_mat = repmat ( [u./app.sigma_nd(1); v./app.sigma_nd(2); rho./app.sigma_nd(3)] , ... 
  19 
                   [1 (app.DOnumIC+1)] );
  20 

  21 
% Load remaining realizations.
  22 

      1 
  23 
for n = 1:app.DOnumIC 
  1.20 
    120 
  24 
    load (fullfile(app.DOicDir,num2str(n,'%3.3d'))); 
  0.45 
    120 
  25 
    var_mat(:,n+1) = [u./app.sigma_nd(1); v./app.sigma_nd(2); rho./app.sigma_nd(3)]; 
< 0.01 
    120 
  26 
end; 
  27 

  28 
%-------------------------------------------------------------------------------
  29 
% Create modes from SVD.
  30 
%-------------------------------------------------------------------------------
  31 

  32 
% Remove mean.
  33 

  0.08 
      1 
  34 
var_mean = mean(var_mat,2); 
  35 

  0.38 
      1 
  36 
var_mat = var_mat - repmat ( var_mean , [1 (app.DOnumIC+1)] ); 
  37 

      1 
  38 
var_mat = var_mat; 
  39 

  40 
% Take SVD.
  41 

 12.17 
      1 
  42 
[Umat, Svals, Vmat] = svd (var_mat, 0); 
  43 

      1 
  44 
clear var_mat; 
  45 

  46 
% Extract redimensionalized modes.
  47 

      1 
  48 
umean = var_mean((1:Nu)).*app.sigma_nd(1); 
      1 
  49 
vmean = var_mean((Nu+(1:Nv))).*app.sigma_nd(2); 
< 0.01 
      1 
  50 
rhomean = var_mean((Nu+Nv+(1:Nrho))).*app.sigma_nd(3); 
  51 

      1 
  52 
clear var_mean 
  53 

      1 
  54 
mode_ind = 1:app.S(1); 
  55 

  0.05 
      1 
  56 
ui = Umat((1:Nu),mode_ind).*app.sigma_nd(1); 
  0.04 
      1 
  57 
vi = Umat((Nu+(1:Nv)),mode_ind).*app.sigma_nd(2); 
  0.05 
      1 
  58 
rhoi = Umat((Nu+Nv+(1:Nrho)),mode_ind).*app.sigma_nd(3); 
  59 

< 0.01 
      1 
  60 
clear Umat Vmat; 
  61 

  62 
%-------------------------------------------------------------------------------
  63 
% Create coefficients from SVD.
  64 
%-------------------------------------------------------------------------------
  65 

      1 
  66 
Yi = zeros (app.MC,app.S(1)); 
  67 

      1 
  68 
for n=1:app.S(1) 
  0.03 
     40 
  69 
    Yi(:,n) = sqrt(Svals(n,n)).*normrnd(0,1,app.MC,1); 
     40 
  70 
end 
  71 

      1 
  72 
Yi = Yi.*(sqrt(app.varscale)/ (prod(app.sigma_nd)^(1/length(app.sigma_nd))) ); % if M is realiz matrix, then P=M*M^T/n_r. 

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