function [U,R,err_reg] = grouse(I,J,S,numr,numc,maxrank,step_size,maxCycles,Uinit)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% GROUSE (Grassman Rank-One Update Subspace Estimation) matrix completion code
% by Ben Recht and Laura Balzano, February 2010.
%
% Given a sampling of entries of a matrix X, try to construct matrices U
% and R such that U is unitary and UR' approximates X. This code
% implements a stochastic gradient descent on the set of subspaces.
%
% Inputs:
% (I,J,S) index the known entries across the entire data set X. So we
% know that for all k, the true value of X(I(k),J(k)) = S(k)
%
% numr = number of rows
% numc = number of columns
% NOTE: you should make sure that numr