This is a static copy of a profile reportHome
delete_generator_connections_2 (24 calls, 12.203 sec)
Generated 15-Mar-2007 12:01:52 using real time.
M-function in file c:\mind07\delete_generator_connections_2.m
[Copy to new window for comparing multiple runs]
Parents (calling functions)
Function Name | Function Type | Calls |
legacy | M-function | 24 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
3 | load('c:\mind_data06'); | 24 | 12.141 s | 99.5% |  |
52 | connector=connector(setdiff([1... | 1 | 0.031 s | 0.3% |  |
49 | answer=(select([1-prob_del,pro... | 8 | 0.016 s | 0.1% |  |
4 | r=size(Q);r=r(2);Q=ones(1,r); | 24 | 0.016 s | 0.1% |  |
12 | g=content(i_del,2); | 21 | 0.000 s | 0.0% |  |
Other lines & overhead | | | 0 s | 0% |  |
Totals | | | 12.203 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
setdiff | M-function | 1 | 0.031 s | 0.3% |  |
select | M-function | 21 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 12.172 s | 99.7% |  |
Totals | | | 12.203 s | 100% | |
M-Lint results
Line number | Message |
4 | The variable 'Q' can apparently be used before it is defined. |
16 | Operator '-' is seldom used in a logical context. |
17 | Use of brackets [] is unnecessary. Use parentheses to group, if needed. |
31 | Logical indexing is usually faster than FIND. |
31 | Logical indexing is usually faster than FIND. |
41 | Logical indexing is usually faster than FIND. |
41 | Logical indexing is usually faster than FIND. |
51 | Use of brackets [] is unnecessary. Use parentheses to group, if needed. |
52 | Use of brackets [] is unnecessary. Use parentheses to group, if needed. |
Coverage results
[ Show coverage for parent directory ]
Total lines in file | 58 |
Non-code lines (comments, blank lines) | 13 |
Code lines (lines that can run) | 45 |
Code lines that did run | 39 |
Code lines that did not run | 6 |
Coverage (did run/can run) | 86.67 % |
Function listing
time calls line
1 function [content,connector]=delete_generator_connections_2(content,connector)
2 %this program deletes generator and associated connections
12.14 24 3 load('c:\mind_data06');
0.02 24 4 r=size(Q);r=r(2);Q=ones(1,r);
24 5 if isempty(content)
3 6 return
21 7 else
21 8 n=length(content(:,1));
9 %select generator
10
< 0.01 21 11 i_del=1;%in i-coordiantes
< 0.01 21 12 g=content(i_del,2);
21 13 if isempty(connector)
< 0.01 13 14 prob_del=(n/mu)/Q(g); %check this!
< 0.01 13 15 prob_del=prob_del/(1+prob_del);
13 16 if (select([1-prob_del,prob_del])-1)
2 17 content=content([2:n],:);
2 18 return
19 end
8 20 else
8 21 m=length(connector(:,1));
22
23 %bonds down to this generator from others above
< 0.01 8 24 h=content(i_del,1);
8 25 j_above=find(connector(:,2)==h);%in j-coordinates
< 0.01 8 26 l_above=length(j_above);
< 0.01 8 27 product=(n/mu)/Q(g);
8 28 for j=1:l_above
< 0.01 4 29 j=j_above(j);h1=connector(j,1);
4 30 i1=find(content(:,1)==h1);i2=find(content(:,1)==h);
4 31 g1=content(i1,2);g2=content(i2,2);
4 32 product=product*(A(g1,g2))^(-1/T);
4 33 end
34
35 %bonds up to this generator from others below
8 36 j_down=find(connector(:,1)==h);%in j-doordinates
< 0.01 8 37 l_down=length(j_down);
8 38 for j=1:l_down
39 j=j_down(j);h2=connector(j,2);
40 i1=find(content(:,1)==h);i2=find(content(:,1)==h2);
41 g1=content(i1,2);g2=content(i2,2);
42 product=product*(A(g1,g2))^(-1/T);
43 end
44
8 45 prob_del=product;
46
47 %check this!
8 48 prob_del=prob_del/(1+prob_del);
0.02 8 49 answer=(select([1-prob_del,prob_del])-1);
8 50 if answer==1
1 51 content=content([2:n],:);
0.03 1 52 connector=connector(setdiff([1:m],[j_above',j_down']),:);
53
7 54 else
7 55 end
8 56 end
19 57 end
58