source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/extras/loadsdpafile.m @ 37

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

Added original make3d

File size: 1.5 KB
Line 
1function [F,h] = loadsdpafile(varargin)
2%LOADSDPAFILE Loads a problem definition in the SDPA format
3%
4%    [F,h] = loadsdpafile('filename')  Loads the problem min(h(x)), F(x)>0 from file 'filename'
5%    [F,h] = loadsdpafile         A "Open" - box will be opened
6
7% Author Johan Löfberg
8% $Id: loadsdpafile.m,v 1.3 2005/06/17 13:02:01 joloef Exp $
9
10filename = varargin{1};
11
12% Does the file exist
13if ~exist(filename)
14    filename = [filename '.dat-s'];
15    if ~exist(filename)
16        error(['No such file.']);
17    end
18end
19   
20% Load using SeDuMi
21try
22    [At,b,c,K,perm] = fromsdpa(filename);
23catch
24    error('LOADSDPAFILE currently requires SeDuMi to be installed');
25end
26
27nvars = length(b);
28x = sdpvar(nvars,1);
29
30F = set([]);
31top = 1;
32if isfield(K,'l')
33    if K.l(1)>0
34        X = c(top:top+K.l-1)-At(top:top+K.l-1,:)*x;
35        F = F + set(X(:));
36        top = top + K.l;
37    end
38end
39
40if isfield(K,'s')
41    if K.s(1)>0
42        for i = 1:length(K.s)
43            [ix,iy,iv] = find([c(top:top+K.s(i)^2-1) At(top:top+K.s(i)^2-1,:)]);
44            off = (ix-1)/(K.s(i)+1);
45            if all(off == round(off))           
46                X = c(top:top+K.s(i)^2-1)-At(top:top+K.s(i)^2-1,:)*x;
47                F = F + set(diag(reshape(X,K.s(i),K.s(i))) > 0);
48                top = top + K.s(i)^2;
49            else
50                X = c(top:top+K.s(i)^2-1)-At(top:top+K.s(i)^2-1,:)*x;
51                F = F + set(reshape(X,K.s(i),K.s(i)) > 0);
52                top = top + K.s(i)^2;
53            end
54        end
55    end
56end
57
58h = -b'*x;
59
Note: See TracBrowser for help on using the repository browser.