Hello everyone, I am looking forward to the advice about this problem. In the initial state, I have:
G = 1
Z = [0, 0, 0, 0]
Then, with the increasing value of G, Z will also be updated as follows:
G = 2 G = 6 G = 10 G = 14
Z = [0, 0, 0, 1] Z = [0, 0, 1, 1] Z = [1, 0, 1, 0] Z = [1, 1, 0, 1]
G = 3 G = 7 G = 11 G = 15
Z = [0, 0, 1, 0] Z = [0, 1, 0, 1] Z = [1, 1, 0, 0] Z = [1, 1, 1, 0]
G = 4 G = 8 G = 12 G = 16
Z = [0, 1, 0, 0] Z = [0, 1, 1, 0] Z = [0, 1, 1, 1] Z = [1, 1, 1, 1]
G = 5 G = 9 G = 13
Z = [1, 0, 0, 0] Z = [1, 0, 0, 1] Z = [1, 0, 1, 1]
The code that I have written so far is:
n = 4
a = [1, 0, 1, 0]
b = [1, 2]
g = 1
while g <= 2^n
z = [0, 0, 0, 0]
c = zeros(n)
g += 1
for i in 1 : n
c[i] = xor(a[i], z[i]
end
sum_c = sum(Base.Fix1(getindex, a), b) #(credit to @Dan in my previous question)
if sum_c == 0
res = c
else
# I think this is the position for updating the value of z
end
end
I am looking forward to any advice.