This is a static copy of a profile reportHome
connect_down_bond (6 calls, 1.266 sec)
Generated 15-Mar-2007 12:01:54 using real time.
M-function in file c:\mind07\connect_down_bond.m
[Copy to new window for comparing multiple runs]
Parents (calling functions)
Function Name | Function Type | Calls |
think1 | M-function | 1 |
legacy | M-function | 5 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
3 | load c:\mind_data06 G mod_tran... | 6 | 1.234 s | 97.5% |  |
64 | prob=Q_theme(to_gs(mu))*mu/(n+... | 213 | 0.016 s | 1.2% |  |
29 | old_gs= ismember(content(:,2),... | 3 | 0.016 s | 1.2% |  |
27 | to_gs=v; | 3 | 0.000 s | 0.0% |  |
22 | v=[]; | 3 | 0.000 s | 0.0% |  |
Other lines & overhead | | | 0 s | 0% |  |
Totals | | | 1.266 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
ismember | M-function | 3 | 0.016 s | 1.2% |  |
select | M-function | 5 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 1.250 s | 98.8% |  |
Totals | | | 1.266 s | 100% | |
M-Lint results
Line number | Message |
6 | The value assigned here to variable 'm' might never be used. |
7 | The value assigned here to variable 'm' might never be used. |
16 | IF may not be aligned with its matching END (line 59). |
17 | The value assigned here to variable 'found' might never be used. |
30 | IF may not be aligned with its matching END (line 57). |
33 | The value assigned here to variable 'to_g' might never be used. |
69 | The value assigned here to variable 'r' might never be used. |
Coverage results
[ Show coverage for parent directory ]
Total lines in file | 79 |
Non-code lines (comments, blank lines) | 22 |
Code lines (lines that can run) | 57 |
Code lines that did run | 49 |
Code lines that did not run | 8 |
Coverage (did run/can run) | 85.96 % |
Function listing
time calls line
1 function [content,connector,found]=connect_down_bond(content,connector, i,h,omega,Q_theme)
2 %finds generator to connect to open down bond (i,h,omega)
1.23 6 3 load c:\mind_data06 G mod_transfer gs_in_mod Q A T
6 4 g=content(i,2);n=length(content(:,1));
6 5 if ~isempty(connector)
5 6 m=length(connector(:,1));
< 0.01 1 7 else m=0;
< 0.01 1 8 end
9
10
11 %connect generator to what? Set of "to_gs" =v;
12
6 13 s=G(g);
< 0.01 6 14 mod=s.modality;
6 15 to_mods=mod_transfer{mod,omega};to_gs=gs_in_mod(to_mods);n_to_gs=length(to_gs);
6 16 if isempty(to_gs)
< 0.01 3 17 found=0;
< 0.01 3 18 else
19
20
21 %connect to g's?
< 0.01 3 22 v=[];
3 23 for nu=1:n_to_gs
27 24 v=[v,to_gs{nu}];
27 25 end
26
< 0.01 3 27 to_gs=v;
< 0.01 3 28 n_to_gs=length(to_gs);%??????????????????????????????
0.02 3 29 old_gs= ismember(content(:,2),to_gs);
3 30 if any(old_gs)
2 31 u=content(:,1);v=content(:,2);
2 32 to_h=u(logical(old_gs));
2 33 to_g=v(logical(old_gs));n_to_h=length(to_h);
34
35 %random selection
< 0.01 2 36 probs=[];
2 37 for nu=1:n_to_h
2 38 prob=Q(v(nu))*n/(n+1);prob= prob*A(g,v(nu))^(1/T);probs=[probs,prob];
2 39 end
2 40 probs=probs./sum(probs);
2 41 nu=select(probs);
42
43
< 0.01 2 44 to_h=to_h(nu);
< 0.01 2 45 t=isempty(connector);
2 46 if t==1
47 connector=[h,to_h,omega];
48 found=1;
49 return
50 end
2 51 already_connected=(connector(:,1)==h)&(connector(:,2)==to_h);%error?
2 52 if ~any(already_connected)
53 connector=[connector;[h,to_h,omega]];
54 found=1;
55 return
56 end
2 57 end
58 %else find new g to connect to
3 59 end
60 %sample from probs over set "to_gs"
6 61 if ~(n_to_gs==0)
< 0.01 3 62 probs=[];
3 63 for mu=1:n_to_gs
0.02 213 64 prob=Q_theme(to_gs(mu))*mu/(n+1);prob= prob*A(g,to_gs(mu))^(1/T);probs=[probs,prob];
213 65 end
3 66 probs=probs./sum(probs);
3 67 new_g=select(probs);new_g=to_gs(new_g);
68 %connect this "new_g" to old content, connector
3 69 content=[content;[max(content(:,1))+1,new_g]];r=1:3;
70
3 71 connector=[connector;[h,max(content(:,1)),omega]];%note that "content"already been incremented
72 %[h,max(content(:,1)),omega]
< 0.01 3 73 found=1;
< 0.01 3 74 else
< 0.01 3 75 found=0;
< 0.01 3 76 end
77
78
79