This is a static copy of a profile report

Home

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

Home

get_admm_matrix (Calls: 1, Time: 108.380 s)
Generated 20-Jul-2018 02:24:59 using performance time.
function in file C:\Users\yz\Dropbox\Workspace\Researches\PhD Research\My Papers\2018_symmtry_reduction\18groupsymmetrySDPSlaterHaoRenata.d\codesgroupsymmetrySDPSlaterHaoRenata.d\admm\get_admm_matrix.m
Copy to new window for comparing multiple runs

This function changed during profiling or before generation of this report. Results may be incomplete or inaccurate.

Parents (calling functions)

Function NameFunction TypeCalls
qap_admm_blkdiagfunction1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
45
temp = Bhat{j}(idx,idx);
64983690.831 s83.8%
46
Bhat_blk{i}(:,j) = temp(:);
64983611.000 s10.1%
22
idx = find(B{i}(:));
32824.158 s3.8%
40
Bhat_blk{i} = zeros(block_size...
1980.900 s0.8%
48
end
1980.415 s0.4%
All other lines  1.076 s1.0%
Totals  108.380 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function65
Non-code lines (comments, blank lines)27
Code lines (lines that can run)38
Code lines that did run38
Code lines that did not run0
Coverage (did run/can run)100.00 %
Function listing
time 
Calls 
 line
   1 
function [Bmat, Bmat_mean, Bhat_blk, V] = get_admm_matrix(B, Bhat, Wbar, block_sizes)
   2 

   3 

   4 
% load the data
   5 
% block_sizes = output.block_sizes;
   6 
% block_pattern = output.block_pattern;
   7 

   8 

   9 

  0.006 
      1 
  10
orbit_size = length(B);            % number of orbits 
  0.002 
      1 
  11
nr_blocks = length(block_sizes);   % number of blocks 
  0.007 
      1 
  12
bt = cumsum(block_sizes);          % the end index of each blocks 
  0.020 
      1 
  13
bs = [1; bt(1:end-1)+1];           % the begin index of each blocks 
  14 

< 0.001 
      1 
  15
m = length(Wbar) - 1; 
  16 

  17 
% stack B_{i} as columns of the sparse matrix B_mat
< 0.001 
      1 
  18
k = 0; 
  0.009 
      1 
  19
I = zeros((m+1)^2,1); 
  0.002 
      1 
  20
J = zeros((m+1)^2,1); 
  0.002 
      1 
  21
for i = 1:orbit_size 
  4.158 
   3282 
  22
   idx = find(B{i}(:)); 
  0.004 
   3282 
  23
   idx_size = length(idx); 
  0.027 
   3282 
  24
   I(k+1:k+idx_size) = idx; 
  0.085 
   3282 
  25
   J(k+1:k+idx_size) = i*ones(idx_size,1); 
  0.002 
   3282 
  26
   k = k+idx_size; 
  0.010 
   3282 
  27
end 
  0.006 
      1 
  28
I = I(1:k); 
  0.006 
      1 
  29
J = J(1:k); 
  0.038 
      1 
  30
Bmat = sparse(I,J,ones(k,1),(m+1)^2,orbit_size); 
  31 
    
  32 
% stack B{i} as rows and divide by #1s
  0.007 
      1 
  33
vr=sum(Bmat); 
  0.167 
      1 
  34
Bmat_mean = (Bmat/diag(vr))'; 
  35 

  36 
% the k-th cell contains the matrix Bhat_blk{k} such that
  37 
% Bhat_blk{k}x is the k-th block of B_hat(x)
  0.012 
      1 
  38
Bhat_blk = cell(nr_blocks,1); 
< 0.001 
      1 
  39
for i = 1:nr_blocks 
  0.900 
    198 
  40
    Bhat_blk{i} = zeros(block_sizes(i)^2,orbit_size); 
  41 
    
  42 
    % stack the columns of the i-th block of Bhat
  0.013 
    198 
  43
    for j = 1:orbit_size 
  0.343 
 649836 
  44
        idx = bs(i):bt(i);             % idx for the i-th block of Y 
 90.831 
 649836 
  45
        temp = Bhat{j}(idx,idx); 
 11.000 
 649836 
  46
        Bhat_blk{i}(:,j) = temp(:); 
  0.071 
 649836 
  47
    end 
  0.415 
    198 
  48
end 
  49 

  50 
% obtain the orthogonal complement of the exposing vector Wbar
  0.009 
      1 
  51
V = cell(nr_blocks,1); 
  0.003 
      1 
  52
V_dim = zeros(nr_blocks,1);          % the dim. of each block in symmetry reduced program 
  0.006 
      1 
  53
for ii = 1:nr_blocks 
  0.020 
    198 
  54
    idx = bs(ii):bt(ii);             % idx for the i-th block 
  0.136 
    198 
  55
    [v,d] = eig(Wbar(idx,idx)); 
  0.019 
    198 
  56
    V{ii} = v(:,diag(d)<1e-5); 
  0.013 
    198 
  57
    V_dim(ii) = size(V{ii},2); 
  0.006 
    198 
  58
end 
  59 

  60 
% 
  61 
% % save the output
  62 
% output.V_dim = V_dim;
  63 

  64 

  0.013 
      1 
  65
end 

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