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

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

Added original make3d

File size: 967 bytes
Line 
1function [lb,ub,cand_rows] = find_variable_bounds(A,b,Aeq,beq)
2
3n = size(A,2);
4lb = -inf*ones(n,1);
5ub = inf*ones(n,1);
6cand_rows = [];
7if size(A,1)>0
8    cand_rows = find(sum(A~=0,2)==1);
9    for i = 1:length(cand_rows)
10        j = find(A(cand_rows(i),:));
11        if A(cand_rows(i),j)>0
12            ub(j)=min(ub(j),b(cand_rows(i))/A(cand_rows(i),j));
13        else
14            lb(j)=max(lb(j),b(cand_rows(i))/A(cand_rows(i),j));
15        end
16    end
17end
18
19if nargin>2
20    if size(Aeq,2)>0
21        candidates = find(sum(Aeq | Aeq,2)==1);
22        if length(candidates)>0
23            for i = candidates(:)'
24                j = find(Aeq(i,:));
25                new_bound = beq(i)/Aeq(i,j);
26                if any(ub(j) < new_bound) | any(lb(j)> new_bound)
27                    infeasible = 1;
28                    return
29                else
30                    ub(j)=new_bound;
31                    lb(j)=new_bound;
32                end
33            end
34        end
35    end
36end
Note: See TracBrowser for help on using the repository browser.