/
verifyP1P2K.m
26 lines (26 loc) · 982 Bytes
/
verifyP1P2K.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
%% Verify that there are 128 unique m's for every p, p' with p!=p'
% variable discrepancy keep track of any .txt file generated by
% P1P2K_SIMPLIFY.cpp that do not have 128 different possible m's.
discrepency = [];
foldername = "./p1p2_SIMPLIFY/";
for i = 0:254
for j = i+1:255
filename = string(i)+"_"+j+".txt";
S = readlines(foldername+filename);
S(S=="") = [];
%% Unique values in array with unique()
U = unique(S);
% count the number of unique values in U
length = size(U,1);
% check if length==127, if so, add false(0) to variable discrepancy,
% else, append true(1).
if (length == 127)
discrepency = [discrepency;false];
else
discrepency = [discrepency;true];
end
end
end
%% Sum all elements in discrepancy array,
% if zero, then there are 128 unique m's for every p,p' with p!=p'
CNT_discrepency = sum(discrepency,'all')