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

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

Added original make3d

File size: 460 bytes
Line 
1function B = block_repeat(A,p)
2% make a sparse, block diagonal matrix by repeating A p times as the blocks.
3
4Adim = size(A);
5rows = Adim(1);
6cols = Adim(2);
7
8%for i = 1:p
9%  block_row = [zeros(cols*(i-1),rows); A'; zeros(cols*(p-i),rows)]';
10%  B = [B;block_row];
11%end
12
13newrows = rows*p;
14newcols = cols*p;
15
16B = sparse([],[],[],newrows,newcols,rows*cols*p);
17for i = 0:p-1
18  for j = 1:rows
19    for k = 1:cols
20      B(i*rows+j,i*cols+k) = A(j,k);
21    end
22  end
23end
Note: See TracBrowser for help on using the repository browser.