I am not sure if what I have done so far is correct, and I need help with the iterative step as I don't understand what is going on in the algorithm. Here is my code. Help to finish this would be much appreciated. Thank you
function x_opt = out(A,b) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here b_vect = b'; m = size(A,1); n = size(1,A); set_B = 1:n; set_B_Comp = n+1:m; M = inv(A(set_B, :)); is_opt = 0; x_temp = M*b_vect(set_B); h = A*x_temp - b_vect; y_vect = zeros(m, 1); y_vect(set_B_Comp) = sign(h(set_B_Comp)); y_vect(set_B) = -inv(A(set_B, :))*(A(set_B_Comp, :))'*y_vect(set_B_Comp); abs_y_B = abs(y_vect(set_B)); if all(abs_y_B <= 1) x_opt = x_temp; ... else all_index_y_vect_more_than_1 = find(abs(y_vect) >= 1); set_B_index_y_vect_more_than_1 = intersect(set_B, all_index_y_vect_more_than_1); s = set_B_index_y_vect_more_than_1(1); y_s = y(s) t_vect = zeros(m, 1); temp = inv(A(set_B,:)); t_vect(set_B_Comp) = -(sign(y_s))*(y(set_B_Comp)).*(A(set_B_Comp, :)*temp(:, s)); cur_min = h(set_B_Comp(1))/t_vect(set_B_Comp(1)) + 1; cur_r = set_B_Comp(1); for j = set_B_Comp h_j = h(j); t_j = t_vect(j); temp1 = abs(h_j)/t_j; if (temp1 < cur_min) && (temp1 > 0) cur_min = temp1; cur_r = j; end end r = cur_r; set_B_new = union(setdiff(set_B, s), r); set_B_Comp_new = setdiff(1:m,set_B_new); x_new = inv(A(set_B_new, :))*b_vect(set_B_new); end x_opt = x_temp; end