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

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

Added original make3d

File size: 955 bytes
Line 
1function feasible = checkfeasiblefast(p,x,tol)
2
3feasible = 0;
4if ~(all(x < p.ub+tol) & all(x > p.lb-tol));
5     return
6end
7
8if ~isempty(p.F_struc)
9    vecres = p.F_struc*[1;x];
10
11    if p.K.f>0
12        if any( -abs(vecres(1:p.K.f)) < - tol)       
13            return
14        end
15    end
16   
17    if p.K.l>0
18        if any(vecres(p.K.f+1:p.K.f+p.K.l) <-tol)
19            return
20        end
21    end
22   
23    if p.K.q(1)>0
24        top = 1+p.K.f+p.K.l;
25        for i = 1:length(p.K.q)
26            n = p.K.q(i);
27            X = vecres(top:top+n-1);top = top+n;
28            if any(X(1)-norm(full(X(2:end))) < -tol)
29                return
30            end
31        end
32    end
33
34    if p.K.s(1)>0
35        top = 1+p.K.f+p.K.l+p.K.q;
36        for i = 1:length(p.K.s)
37            n = p.K.s(i);
38            X = reshape(vecres(top:top+n^2-1),n,n);top = top+n^2;
39            if min(eig(X)) < -tol
40                return
41            end
42        end
43    end
44end
45feasible = 1;
Note: See TracBrowser for help on using the repository browser.