% create generalized complex Grover rotation matrix G = Us*Uw
% for (w,sp) coordinate system, where s = ones(N,1)/sqrt(N), w = 0 except for one w(i) = 1,
%  sp = (sqrt(N)*s-w)/sqrt(N-1), and w'*sp = 0
%
% standard real form is: Grotate(pi,pi,N) = [-(2-N), 2*sqrt(N-1); -2*sqrt(N-1), (N-2)]/N
%
function G = Grotate( phi0, phi1, N)
 e0 = exp(i*phi0); e1 = exp(i*phi1); d = sqrt(N-1);
 G = [e1*(1-e0-N), (1-e0)*d; e1*(1-e0)*d, -e0*(N-1)-1 ]/N;
end
