function [c, ceq] = myconKK_r(x0)

%These are the non-linear constraints
[N,~]=size(x0);
small=1e-7;


n=(-1+sqrt(1+4*(N-1)))/2;
%This one needs coefficeint matrix on X to have ral eigenvalues
Coeff=x0(n+2:end); %coefficeints on factors
Coeff=reshape(Coeff,[n,n]);
kd = eig(Coeff);

%Imaginary parts then Negative eigen values
out = sum(real(kd)<small)+sum(real(kd)>1-small);

c = [];
ceq = out;
