source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/lmirank/createrandomdata.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 1.4 KB
Line 
1
2function [At,c,K,yfeas] = createrandomdata(nF,nG,r,m)
3% [At,c,K,yfeas] = createrandomdata(nF,nG,r,m);
4%
5% CREATERANDOMDATA randomly generates feasible rank constrained LMI problems
6% that can be used to test LMIRANK.
7%
8% Inputs:
9%       nF  : the Fi matrices are size nF x nF       
10%       nG  : the Gi matrices are size nG x nG
11%       r   : rank bound
12%       m   : number of varibales
13%
14% Outputs:
15%       At      = -[vec(F1),...,vec(Fm);
16%                   vec(G1),...,vec(Gm)]
17%       c       = [vec(F0);
18%                  vec(G0)]
19%       K       : problem parameters (K.s and K.rank)
20%       yfeas   : known feasible solution
21%
22% See also LMIRANK, LMIRANKTEST.
23
24% Author Robert Orsi
25% Feb 2005
26
27
28%%%% Create y
29y=randn(m,1);
30yfeas=y; % used for testing only
31
32%%%% Create At
33At=zeros(nF^2+nG^2,m);
34c=zeros(nF^2+nG^2,1);
35for i=1:m,
36    Fi=randn(nF);
37    Fi=sqrt(0.5)*(Fi+Fi');
38    Gi=randn(nG);
39    Gi=sqrt(0.5)*(Gi+Gi');
40    At(:,i)=-[Fi(:); Gi(:)];
41end
42
43%% Create X=X'>=0
44  X=randn(nF);
45  X=X+X';
46  [V,D]=eig(X);
47  d=randn(nF,1);
48  d=max(d,0);
49  X=V*diag(d)*V';
50  X=(X+X')/2;
51%% Create Y=Y'>=0, rank(Y)=r
52  Y=randn(nG);
53  Y=Y+Y';
54  [V,D]=eig(Y);
55  d=[rand(r,1);zeros(nG-r,1)];
56  Y=V*diag(d)*V';
57  Y=(Y+Y')/2; 
58 
59%%%% Create c 
60c=At*y+[X(:);Y(:)];
61
62%%%% Create K
63K.s=[nF nG];
64K.rank=[nF r];
65 
66 
Note: See TracBrowser for help on using the repository browser.