function  llist=SMD (x, sumabsu, sumabsv, v, niter,varaigin)
%%%   x  n*p matrix with 
%%%  v  p*1 vector

  if nargin < 5
    niter=20;
  end
    if nargin < 4
       error( 'Not enough input arguments.');
    end
    
  nas=isnan(x);  
  vinit= v;
  xoo = x;
  if sum(sum(nas))>0
      xoo(nas)=mean(x(~nas));
  end
 oldv = randn(size(x,2),1);
  for i= 1:niter
    if sum(abs(oldv-v))>1e-7
      oldv = v;
 %%%% update u #
      argu = xoo*v;
      lamu = BinarySearch(argu,sumabsu);
      su = soft(argu,lamu);
      u =  su/norm(su,2);
 %%%# done updating u #
      %%%%# update v #
      argv =u'*xoo;
      lamv = BinarySearch(argv, sumabsv);
      sv = soft(argv,lamv);
      v = (sv/norm(sv,2))';
%%%% # done updating v #
    end
  end
  d =u'*xoo*v;
  %%%%%if(trace) cat(fill=TRUE)
  llist.d=d;
  llist.u=u;
  llist.v=v;
  llist.vinit=vinit;