This is a static copy of a profile reportHome
add_generator_up_Q (18 calls, 9.172 sec)
Generated 15-Mar-2007 12:01:51 using real time.
M-function in file c:\mind07\add_generator_up_Q.m
[Copy to new window for comparing multiple runs]
Parents (calling functions)
Function Name | Function Type | Calls |
legacy | M-function | 18 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
3 | load('C:\mind_data06'); | 18 | 9.125 s | 99.5% |  |
4 | gs=set_gs_in_mods(theme,gs_in_... | 18 | 0.031 s | 0.3% |  |
19 | end | 11 | 0.016 s | 0.2% |  |
15 | to_g_ups=[]; | 12 | 0.000 s | 0.0% |  |
8 | content=[1,g]; | 6 | 0.000 s | 0.0% |  |
Other lines & overhead | | | 0 s | 0% |  |
Totals | | | 9.172 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
set_gs_in_mods | M-function | 18 | 0.031 s | 0.3% |  |
timercb | M-function | 2 | 0.016 s | 0.2% |  |
select | M-function | 26 | 0 s | 0% |  |
ismember | M-function | 3 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 9.125 s | 99.5% |  |
Totals | | | 9.172 s | 100% | |
M-Lint results
Line number | Message |
4 | Variable 'gs_in_mod' is used, but apparently is never set. |
11 | Use of brackets [] is unnecessary. Use parentheses to group, if needed. |
11 | The value assigned here to variable 'h' might never be used. |
13 | Variable 'mod_transfer_inv' is used, but apparently is never set. |
47 | Use && instead of & as the AND operator in (scalar) conditional statements. |
47 | Variable 'mod_transfer' is used, but apparently is never set. |
Coverage results
[ Show coverage for parent directory ]
Total lines in file | 53 |
Non-code lines (comments, blank lines) | 6 |
Code lines (lines that can run) | 47 |
Code lines that did run | 46 |
Code lines that did not run | 1 |
Coverage (did run/can run) | 97.87 % |
Function listing
time calls line
1 function [content,connector]=add_generator_up_Q(content,connector,theme)
2 %executes theme driven thinking upwards ideas
9.13 18 3 load('C:\mind_data06');
0.03 18 4 gs=set_gs_in_mods(theme,gs_in_mod);
18 5 Q(gs)=100000;
18 6 if isempty(content)
6 7 Q=Q./sum(Q);g=select(Q);
< 0.01 6 8 content=[1,g];
12 9 else
10 %select one of the gens in "content"
12 11 n=length(content(:,1));i=select([1:n]./n);h=content(i,1);g=content(i,2);...
< 0.01 12 12 mod=g_mod(g);
12 13 mod_ups=mod_transfer_inv{mod};
< 0.01 12 14 n_mod_ups=length(mod_ups);
< 0.01 12 15 to_g_ups=[];
16 %find generators up from which connection may be created
12 17 for m=1:n_mod_ups
11 18 to_g_ups=[to_g_ups,gs_in_mod{mod_ups(m)}];
0.02 11 19 end
20 %now try to connect up to each of these gens
< 0.01 12 21 n_to_g_ups=length(to_g_ups);
< 0.01 12 22 probs=[];
12 23 if isempty(to_g_ups)
4 24 return
8 25 else
8 26 end
27
8 28 for nu=1:n_to_g_ups
26 29 prob=Q(to_g_ups(nu))*mu/(n+1);prob= prob*A(g,to_g_ups(nu))^(1/T);probs=[probs,prob];
26 30 end
8 31 probs=[probs,1];
8 32 probs=probs./sum(probs);
8 33 nu=select(probs);
8 34 if nu==n_to_g_ups+1
4 35 return
36 end
4 37 new_h=max(content(:,1))+1;
< 0.01 4 38 g_to=to_g_ups(nu);
< 0.01 4 39 mod1=g_mod(g_to);
4 40 for j=1:3
< 0.01 12 41 h=content(i,1);
12 42 if isempty(connector)
2 43 connector=[connector;[new_h,h,j]];
10 44 else
10 45 is_old=any((connector(:,1)==new_h)&(connector(:,2)==h));
10 46 is_old=is_old|any((connector(:,1)==new_h)&(connector(:,3)==j));
10 47 if (~is_old)&ismember(mod,mod_transfer{mod1,j});
2 48 connector=[connector;[new_h,h,j]];
2 49 end
10 50 end
12 51 end
4 52 content=[content;[new_h,g_to]];
4 53 end