Commit 0e58c547 authored by ARCHIT GUPTA's avatar ARCHIT GUPTA

Merge git.cse.iitb.ac.in:devansh/cs251_group04

parents 2dfb3cae cce7f2dc
global A=eye(9,9);
% initialising an identity matrix
for i=1:9
for j=i:9
if (j-i==1 | j-i==3 )
A([i],[j])=1;
A([j],[i])=1;
endif
endfor
endfor
A([4],[3])=A([3],[4])=A([7],[6])=A([6],[7])=0;
%We observed that all the elements with |i-j|=1 except 3,4,6,7 satisfied the neighbour criteria.
%function to make answer=(Ax+b)mod2
function answer=state(b,x)
global A;
final=(A*x)+b;
%according to the formula
for i=1:9
final([i])=mod(final([i]),2);
endfor
answer=zeros(3,3);
for i=1:3
answer([1],[i])=final([i]);
endfor
for j=4:6
answer([2],[j-3])=final([j]);
endfor
for k=7:9
answer([3],[k-6])=final([k]);
endfor
endfunction
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment