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

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

Added original make3d

File size: 833 bytes
Line 
1function [M,m,infbound] = derivebounds(f)
2% Code to compute  estimates of max and min
3% of the linear vector f
4basis = getbase(f);
5fvars = getvariables(f);
6lowerupper = yalmip('getbounds',fvars);
7
8if any(any(isinf(lowerupper)))
9    infbound = 1;
10else
11    infbound = 0;
12end
13
14b = basis(:,1);
15A = basis(:,2:end);
16M = repmat(-inf,size(b,1),1);
17m = -M;
18if all(all(isinf(lowerupper)))
19    M = repmat(inf,length(b),1);
20    m = repmat(-inf,length(b),1);
21else
22    lower = lowerupper(:,1);
23    upper = lowerupper(:,2);
24    for i = 1:length(b)
25        ind = A(i,:)>0;
26        i1 = find(ind);
27        i2 = find(~ind);
28        a = A(i,[i1 i2]);
29        M(i) = a*[upper(i1);lower(i2)];
30        m(i) = a*[lower(i1);upper(i2)];
31    end
32end
33M(isnan(M)) = inf;
34M(isinf(M)) = 1e4; M = M+b;%+0.01;
35m(isnan(m)) = -inf;
36m(isinf(m)) = -1e4;m = m+b;%-0.01;
Note: See TracBrowser for help on using the repository browser.