function m = slant(n)
%  Returns the slant transform matrix of size n by n
%     m = slant(n)

  root2 = sqrt(2);
 

 
  S = [1 1; 1 -1]; 

  if n==2
    m = S / root2;
  end 
   
  f = 1 / sqrt(5);
  S = [1 1 1 1; 3*f f -f -3*f; 1 -1 -1 1; f -3*f 3*f -f] / 2;
  if n==4 
    m = S;
  end
  
  index = 4;

  while index < n

    index = index*2;
    idindex = (index / 2) - 2;
    id = eye(idindex);
    zrows = zeros(2,idindex);
    zcols = zeros(idindex,2);
    a = slanta(n);
    b = slantb(n);
    S1 = [[1 0; a b] zrows [1 0; -a b] zrows;
	 zcols id zcols id; 
	 [0 1; -b a] zrows [0 -1; b a] zrows;
	 zcols id zcols -id];
    z2 = zeros(index / 2, index / 2);
    S2 = [ S z2; z2 S];
    S = S1 * S2 / root2;
    
  end

  if n > 4 
    m = S;
  end
  



