source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/missing-data/approx_matrix.m @ 37

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

Added original make3d

File size: 817 bytes
Line 
1function [Mapprox,misscols] = approx_matrix(M,INC,NULLSPACE,r,numcols)
2Mapprox = [];
3misscols = [];
4
5%[A,S,U] = svd(NULLSPACE',0);
6[U,S,V] = svd(NULLSPACE);
7
8Unumcols = size(U,2);
9%SINGULARVALUES = diag(S)'
10if svd_suff_data(S,r)
11  RSPACE = U(:,Unumcols+1-r:Unumcols);
12% RSPACE has r columns, which span the r-D space that gives the best linear
13% surface to approximate M.
14  for i = 1:numcols
15    INCcol = INC(:,i);
16    Mcol = M(:,i).*INCcol;
17    INCmat = repeat(INCcol, r);
18    RSPACEcols = RSPACE.*INCmat;
19    % this is just RSPACE with all the rows missing that are also missing in Mcol.
20    if rank(RSPACEcols) == r
21      Mapprox = [Mapprox, RSPACE*(RSPACEcols\Mcol)];
22    else
23      misscols = [misscols, i];
24    end
25  end
26else
27  Mapprox = -2;
28end
29if isempty(Mapprox) Mapprox = -2; end
Note: See TracBrowser for help on using the repository browser.