% This is my Robust Super Resolution Method:
function [reconstPhoto] = robustSuperResolution2(ims,Fs,photoWidth,photoHeight,X0,sigma,tol,maxIter);
    photoSize = photoWidth*photoHeight;
    
    X = X0(:);
    sigmaSqr = sigma^2;
    
    for i=1:maxIter
        A = sparse(photoSize,photoSize);
        b = sparse(photoSize,1);
        
        for j = 1:size(ims,2)
            xj = ims{j};
            Fj = Fs{j};
            
            imageSize = size(Fj,1);
            
            Wj = sigmaSqr ./ (sigmaSqr + (Fj*X-xj(:)).^2).^2;
            
            pj = sparse(1:imageSize,1:imageSize,Wj) * Fj;
            A = A + Fj' * pj - repmat(xj(:)' * pj,photoSize,1);
            
            mj = (xj(:) .* Wj)';
            b = b + (mj * Fj - repmat(mj*xj(:),1,photoSize))';
        end
        
        X = cgs(A,b,1.e-3);
    end
    
    reconstPhoto = reshape(X,photoHeight,photoWidth);
