% [At,b,c,K] = nm(M)
% Creates dual standard form for the nearest psd matrix in 
% infinity norm.
function [At,b,c,K] = nm(M)
n = size(M,1) ;
At = [-ones(n^2,1), -eye(n^2) ; -ones(n^2,1), eye(n^2) ; zeros(n^2,1), eye(n^2) ] ; 
c = [zeros(2*n^2,1) ; vec(M)] ;
b = [-1 ; zeros(n^2,1) ] ;
K.l = 2*n^2 ;
K.s = n ;