-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloop_summary.m
More file actions
48 lines (41 loc) · 1.64 KB
/
loop_summary.m
File metadata and controls
48 lines (41 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function[tab]=loop_summary(fbl_loop_tab,col_val)
% LOOP_SUMMARY Compute the counts of a feedback loop list
%
% The loop list could be output e.g. from find_loops() and should be a
% table with columns named 'length' and 'sign' that are used to determine
% the counts.
%
% TAB = LOOP_SUMMARY(LOOP_LIST) returns a table TAB with the counts of the loops
% in LOOP_LIST subdivided in three rows capturing
% the sign of the loops (all, positive, negative) and their
% lengths (1 to maximal length) in the columns
%
% TAB = LOOP_SUMMARY(LOOP_LIST,COL_VAL) allows for choosing the
% value that is spread over the columns. For COL_VAL being 'length', the
% same output as above is obtained, for COL_VAL being 'sign', the table is
% transposed.
%
% See also: find_loops(), find_loops_noscc(), find_loops_vset()
if nargin<2
col_val='length';
end
%maximal loop length
max_loop_length=max(fbl_loop_tab.length);
tab=zeros(3,max_loop_length);
%for each loop length
for i=1:max_loop_length
tab(2,i)=sum(fbl_loop_tab.sign(fbl_loop_tab.length==i)==-1); %negative loops of length i
tab(3,i)=sum(fbl_loop_tab.sign(fbl_loop_tab.length==i)==1);%positive loops of length i
tab(1,i)=sum(fbl_loop_tab.length==i); %total loops of length i
end
%generate length description
for k = 1:max_loop_length
col_name_tab{k} = sprintf('%s_%d','length',k);
end
if strcmp(col_val,'length') %variables will be length
tab=array2table(int64(tab),'VariableNames',col_name_tab,'RowNames',{'total' 'negative' 'positive'});
end
if strcmp(col_val,'sign') %variable will be sign
tab=array2table(int64(tab'),'VariableNames',{'total' 'negative' 'positive'},'RowNames',col_name_tab);
end
end