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

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

Added original make3d

File size: 1.2 KB
Line 
1function y = rdivide(X,Y)
2%RDIVIDE (overloaded)
3
4% Author Johan Löfberg
5% $Id: rdivide.m,v 1.7 2006/01/26 13:44:13 joloef Exp $   
6
7% Check dimensions
8[nx,mx] = size(X);
9[ny,my] = size(Y);
10if ~((prod(size(X))==1) | (prod(size(Y))==1))
11    if ~((nx==ny & (mx ==my)))
12        error('Matrix dimensions must agree.')
13    end
14end
15
16% Quick exit for simple case X/scalar
17if isa(Y,'double') & prod(size(Y))==1
18    y = X;
19    y.basis = y.basis/Y;
20    % Reset info about conic terms
21    y.conicinfo = [0 0];
22    return
23end
24
25% FIX : SLOOOOW BUT SOMEWHAT ROBUST
26[nx,mx] = size(X);
27[ny,my] = size(Y);
28if prod(size(X)) == 1 & prod(size(Y))~=1
29    X = repmat(X,ny,my);
30end;
31if prod(size(Y)) == 1 & prod(size(X))~=1
32    Y = repmat(Y,nx,mx);
33end;
34[nx,mx] = size(X);
35y = [];
36for i = 1:nx   
37    if mx==1
38        dummy = struct('type','()','subs',{{i,1}});
39        y=[y;subsref(X,dummy)*subsref(Y,dummy)^-1];
40    else
41        ytemp = [];
42        for j = 1:mx
43            dummy = struct('type','()','subs',{{i,j}});
44            ytemp = [ytemp subsref(X,dummy)*subsref(Y,dummy)^-1];
45        end
46        y = [y;ytemp];
47    end
48end
49% Reset info about conic terms
50if isa(y,'sdpvar')
51    y.conicinfo = [0 0];
52end
Note: See TracBrowser for help on using the repository browser.