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