function [X, errList] = SiLRTC(T, Omega, alpha, gamma, maxIter, epsilon, X)
if nargin < 7
    X = T;
    X(logical(1-Omega)) = mean(T(Omega));
end

errList = zeros(maxIter, 1);
normT = norm(T(:));

dim = size(T);
M = cell(ndims(T), 1);
gammasum = sum(gamma);
tau = alpha./ gamma;

for k = 1:maxIter
    if mod(k, 50) == 0 %print to make sure we do some progress
        fprintf('SiLRTC: iterations = %d   difference=%f\n', k, errList(k-1));
    end
    Xsum = 0; % initialisation
    for i = 1:ndims(T)
        M{i} = Fold(Pro2TraceNorm(Unfold(X, dim, i), tau(i)), dim, i);
        Xsum = Xsum + gamma(i) * M{i};
    end
    Xlast = X; 
    X = Xsum / gammasum; %update X (eq. 17 part 1)
    X(Omega) = T(Omega); %update X (eq. 17 part 2)
    errList(k) = norm(X(:)-Xlast(:)) / normT; %update the list of error
    if (errList(k) < epsilon) %Stop when the criteria is reached
        errList = errList(1:k); 
        break;
    end
    
end
fprintf('SiLRTC ends: total iterations = %d   difference=%f\n\n', k, errList(k));
