function F = UpdateF(F, S, Z, beta, alpha, P, J)
 
ITER = 100;
conv = zeros(1,ITER);
lr = 0.01;
I =  eye(size(S,1));
CI = ( S - I)*(S - I )';
for it=1:ITER
    
    grad = beta*F*CI + alpha*(J.*(F - P*Z));
    Fold = F;
    F = F-lr*grad;
    
    conv(it) = norm(F-Fold,'fro');

    if it>10
        if abs(conv(it)-conv(it-1))<0.0001*conv(it)
            break
        end
    end
    
end
end
