Dear Johan,
I'm trying to build an (n+m)-by-(n+m) matrix A using the following logic. Consider n-by-1 vector x, and m-by-1 vector s.
A( i , j )= 1 if | x_i - x_j | <= c1 i,j = 1 ,...,n
A( i , j )= 0 if | x_i - x_j | > c1 i,j = 1 ,...,n
also
A( i, j+n )= 1 if | x_i - s_j | <= c2 i= 1 ,...,n j=1, ... , m
A( i , j+n )=0 if | x_i - s_j | > c2 i= 1 ,...,n j=1, ... , m
and
A(i,j)=0 for i=n+1,..., n+m & j=1, ..., n+m
That is, the matrix A will be as follows
A=[ A_11 , A_12;
0 , 0 ];
Let D=diag(sum(A,2)), and define L=D-A, which is the Laplacian of the graph associated with the adjacency matrix A.
What I'm trying to do is, find c1 and c2 such that the eigenvalues of L_11 (the same dimension as A_11) are all positive.
I wasn't sure how to write the code. I don't think A11 and A12 should be sdpvars, but I couldn't think of anything else. Is this even possible?
clc
clear
close all
c=sdpvar;
cl=sdpvar;
model=[0<=c<=1,0<=cl<=1];
n=3;
m=2;
N=n+m;
f=sort(unifrnd(0,1,n,1));
s=sort(unifrnd(0,0.7,m,1));
A21=zeros(m,n);
A22=zeros(m,m);
df=binvar(2);
ds=binvar(2);
ep=0.0000001;
A11=sdpvar(n,n);
for i=1:n
for j=1:n
model=[model,
sum(df)==1,
implies(df(1),[c>=abs(f(i)-f(j)), A11(i,j)==1])
implies(df(2),[abs(f(i)-f(j))>=c+ep,A11(i,j)==0])];
end
end
A12=sdpvar(n,m,'full');
for i=1:n
for j=1:m
model=[model,
sum(ds)==1,
implies(ds(1),[cl>=abs(f(i)-s(j)), A12(i,j)==1])
implies(ds(2),[abs(f(i)-s(j))>=cl+ep,A12(i,j)==0])];
end
end
A=[A11,A12;A21,A22];
D=diag(sum(A,2));
L=D-A;
L11=L(1:n,1:n);
model=[model,eig(L11)>0]
optimize(model)
Lv=value(L)
L11v=value(L)
Av=value(A)
eig(L11v)