-
Notifications
You must be signed in to change notification settings - Fork 2
/
dominatedColumnIdentifier.m
37 lines (36 loc) · 1.47 KB
/
dominatedColumnIdentifier.m
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
function dominatingColumnIndex = dominatedColumnIdentifier( firstColumn, secondColumn )
% if the firstColumn is diminated by the secondColumn => dominatingColumnIndex = 1;
% if the secondColumn is diminated by the firstColumn => dominatingColumnIndex = 2;
% if non of the columns are dominated by each other => dominatingColumnIndex = 0;
%----------------------------------------------------------------------
if ( (sum(firstColumn) == sum(secondColumn)) )
if (~isequal(firstColumn, secondColumn))
dominatingColumnIndex = 0;
return;
else
dominatingColumnIndex = 1;
return;
end
end
%----------------------------------------------------------------------
if (sum(firstColumn) > sum(secondColumn))
if ( isequal( (firstColumn >= secondColumn), ones(size(firstColumn, 1), 1) ) )
dominatingColumnIndex = 2;
return;
else
dominatingColumnIndex = 0;
return;
end
end
%----------------------------------------------------------------------
if (sum(firstColumn) < sum(secondColumn))
if ( isequal( (firstColumn <= secondColumn), ones(size(firstColumn, 1), 1) ) )
dominatingColumnIndex = 1;
return;
else
dominatingColumnIndex = 0;
return;
end
end
%----------------------------------------------------------------------
end