source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/@sdpvar/generateAB.m @ 37

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

Added original make3d

File size: 909 bytes
Line 
1function [A,b,lmi_variables] = generateAB(varargin)
2%GENERATEAB Internal function to generates linear equation system
3
4% Author Johan Löfberg
5% $Id: generateAB.m,v 1.4 2006/07/26 20:17:58 joloef Exp $
6
7if mod(nargin,2)~=0
8    error('Internal error in generateAB. Please report.');
9end
10
11lmi_variables = [];
12n_eq = 0;
13for r = 1:nargin/2
14    [n,m] = size(varargin{1+2*(r-1)});
15    n_eq = n_eq + n*m;
16    lmi_variables = [lmi_variables varargin{1+2*(r-1)}.lmi_variables(:)'];
17end
18lmi_variables = uniquestripped(lmi_variables);
19
20A = spalloc(n_eq,length(lmi_variables),n_eq);
21b = spalloc(n_eq,1,n_eq);
22
23btop = 1;
24atop = 1;
25for r = 1:nargin/2
26    X  = varargin{2*r-1};
27    [n,m] = size(X);
28    used_variables = find(ismembc(lmi_variables,X.lmi_variables));
29    A(atop:atop+n*m-1,used_variables) = X.basis(:,2:end);
30    b(btop:btop+n*m-1) =varargin{2*r}(:)-X.basis(:,1);
31    atop = atop+n*m;
32    btop = btop+n*m;
33end
Note: See TracBrowser for help on using the repository browser.