function [x,Hx] = Cadzow(q,rk,bx,m,n,i,j,maxiter)

x = bx; % initialization
tq = 1-q;

iter = 0;
Hx = Hkx(x,m,n,i,j);

while iter < maxiter
  
  xold = x;

  [U,S,V] = svd(Hx,'econ'); % project onto low rank
  s = diag(S);
  S = diag([s(1:rk,1);zeros(size(s,1)-rk,1)]);
  Hx = U*S*V';
  
  x = bx+tq.*Hkxadavg(Hx,m,n,i,j); % project onto Hankel and fixed entries
  Hx = Hkx(x,m,n,i,j);
  iter = iter+1;
  
  if norm(x-xold,'fro')/max(norm(xold,'fro'),1) < 1e-4
    break
  end
  
  if mod(iter,100) == 0
    fprintf(' iter = %d\n', iter)
  end
  
end

svd(Hx)
