annotate DL/RLS-DLA/private/countcover.m @ 60:ad36f80e2ccf

(none)
author idamnjanovic
date Tue, 15 Mar 2011 12:20:59 +0000
parents
children
rev   line source
idamnjanovic@60 1 function cnt = countcover(sz,blocksize,stepsize)
idamnjanovic@60 2 %COUNTCOVER Covering of signal samples by blocks
idamnjanovic@60 3 % CNT = COUNTCOVER(SZ,BLOCKSIZE,STEPSIZE) assumes a p-dimensional signal
idamnjanovic@60 4 % of size SZ=[N1 N2 ... Np] covered by (possibly overlapping) blocks of
idamnjanovic@60 5 % size BLOCKSIZE=[M1 M2 ... Mp]. The blocks start at position (1,1,..,1)
idamnjanovic@60 6 % and are shifted between them by steps of size STEPSIZE=[S1 S2 ... Sp].
idamnjanovic@60 7 % COUNTCOVER returns a matrix the same size as the signal, containing in
idamnjanovic@60 8 % each entry the number of blocks covering that sample.
idamnjanovic@60 9 %
idamnjanovic@60 10 % See also IM2COLSTEP, COL2IMSTEP, IM2COL.
idamnjanovic@60 11
idamnjanovic@60 12
idamnjanovic@60 13 % Ron Rubinstein
idamnjanovic@60 14 % Computer Science Department
idamnjanovic@60 15 % Technion, Haifa 32000 Israel
idamnjanovic@60 16 % ronrubin@cs
idamnjanovic@60 17 %
idamnjanovic@60 18 % August 2008
idamnjanovic@60 19
idamnjanovic@60 20
idamnjanovic@60 21 cnt = ones(sz);
idamnjanovic@60 22 for k = 1:length(sz)
idamnjanovic@60 23
idamnjanovic@60 24 % this code is modified from function NDGRID, so it computes one
idamnjanovic@60 25 % output argument of NDGRID at a time (to conserve memory)
idamnjanovic@60 26 ids = (1:sz(k))';
idamnjanovic@60 27 s = sz; s(k) = [];
idamnjanovic@60 28 ids = reshape(ids(:,ones(1,prod(s))),[length(ids) s]);
idamnjanovic@60 29 ids = permute(ids,[2:k 1 k+1:length(sz)]);
idamnjanovic@60 30
idamnjanovic@60 31 cnt = cnt .* max( min(floor((ids-1)/stepsize(k)),floor((sz(k)-blocksize(k))/stepsize(k))) - ...
idamnjanovic@60 32 max(ceil((ids-blocksize(k))/stepsize(k)),0) + 1 , 0 );
idamnjanovic@60 33 end