function [slitRep, vectRep, alpha] = slitSum(f)

s0 = f(5,1) + f(5,3) + f(5,7) + f(5,9);
s1 = f(7,1) + f(6,3) + f(4,7) + f(3,9);
s2 = f(1,9) + f(3,7) + f(7,3) + f(9,1);
s3 = f(9,3) + f(7,4) + f(3,6) + f(1,7);
s4 = f(1,5) + f(3,5) + f(7,5) + f(9,5);
s5 = f(1,3) + f(3,4) + f(7,6) + f(9,7);
s6 = f(1,1) + f(3,3) + f(7,7) + f(9,9);
s7 = f(3,1) + f(4,3) + f(6,7) + f(7,9);

s = [s0 s1 s2 s3 s4 s5 s6 s7];

[sp, p] = min(s);
p = p - 1;
[sq, q] = max(s);
q = q - 1;

ssum = (3/8)*sum(s);

if ((4*f(5,5) + sp + sq) > ssum)
   d = q;
else
   d = p;
end

slitRep = d;
alpha = slitRep*180/8;
vectRep = [cos(2*alpha*pi/180) sin(2*alpha*pi/180)];