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

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

Added original make3d

File size: 1016 bytes
Line 
1function [F_struc,K] = addbounds(F_struc,K,ub,lb)
2%ADDBOUNDS Internal function to add variable bounds to an F_struc
3
4% Author Johan Löfberg
5% $Id: addbounds.m,v 1.3 2005/02/10 16:43:32 johanl Exp $
6
7% Upper bounds
8finite_bounds = find(~isinf(ub));
9if ~isempty(finite_bounds)
10    p = length(finite_bounds);
11    n = length(ub);
12    if ~isempty(F_struc)
13        F_struc = [F_struc(1:1:K.f,:);[ub(finite_bounds) -sparse(1:p,finite_bounds,ones(p,1),p,n)];F_struc(K.f+1:end,:)];
14    else
15        F_struc = [ub(finite_bounds) -sparse(1:p,finite_bounds,ones(p,1),p,n)];
16    end
17    K.l = K.l+p;
18end
19
20% Lower bounds
21finite_bounds = find(~isinf(lb));
22if ~isempty(finite_bounds)   
23    p = length(finite_bounds);
24    n = length(ub);
25    if ~isempty(F_struc)
26        F_struc = [F_struc(1:1:K.f,:);[-lb(finite_bounds) sparse(1:p,finite_bounds,ones(p,1),p,n)];F_struc(K.f+1:end,:)];
27    else
28        F_struc = [[-lb(finite_bounds) sparse(1:p,finite_bounds,ones(p,1),p,n)];F_struc(K.f+1:end,:)];   
29    end
30    K.l = K.l+p;
31end
32
33
34
Note: See TracBrowser for help on using the repository browser.