% Subroutine of IPM_AK.
%
% Jan 12, 2012

function [A,c,index] = selectw (M)

m = size(M,2);
nn = size(M,1);

normM = zeros(m,1);
for i=1:m
  normM(i,1) = norm(M(:,i),'fro');
end

[v,I] = sort(normM);

index = I(end);

A = zeros(nn,m-1);
c = M(:,index);
for i=1:m-1
  if i<index
    A(:,i) = M(:,i)-c;
  else
    A(:,i) = M(:,i+1)-c;
  end
end