-
Notifications
You must be signed in to change notification settings - Fork 0
/
MatrixConstruction.m
52 lines (49 loc) · 1.44 KB
/
MatrixConstruction.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function [H] = MatrixConstruction(W,TF)
treshTF = 3; % constante para TF
treshNTF = 1; % constante para uma ligação not TF
eta = 10; % constante para ambos not TF
indexCounter = 0;
lengthW = length(W);
H = zeros(lengthW);
nEleUpW = Nofue(W);
row = 1;
col = 1 + row;
treshSum = 0;
[rho,indexRho] = getRho(W,TF);
notTF = getNotTF(W,TF);
for i = 1:nEleUpW
if(isTF(row,TF))
treshSum = treshSum + treshTF;
else
if(~isTF(col,TF))
treshSum = treshSum + eta;
end
end
if(isTF(col,TF))
treshSum = treshSum + treshTF;
else
if(~isTF(row,TF))
else
treshSum = treshSum + treshNTF;
end
end
if(W(row,col) > treshSum)
numberToCheck = W(row,col) - treshSum;
if(numberToCheck < 0)
numberToCheck = 0;
end
[connection, rho, indexCounter] = checkRho(numberToCheck, rho, indexRho, row, col, notTF,TF,indexCounter);
if(connection == 1)
H(row,col) = W(row,col);
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
treshSum = 0;
col = col + 1;
if (rem(col - 1,lengthW) == 0)
row = row + 1;
col = 1 + row;
end
end
H = H + H';
end