home *** CD-ROM | disk | FTP | other *** search
- %function [delfx,cost,sm] = fullbsg(m,x,blk,blkp,lb)
- function [delfx,cost,sm,flopcnt] = fullbsg(m,x,blk,blkp,lb)
- flopin = flops;
-
- % i think that length(x) = nblk-1 always, so there is a
- % bit of redundance. this looks like it is set up fine for
- % nonsquare full blocks. in fortran/c version, a lot can
- % be saved by computing only the singular vector needed, and
- % probably it is wise to do some "searching" for min(co(del))
-
- [nblk,dum] = size(blk);
- for i=1:length(x)
- x(i) = x(i) + lb;
- end
-
- delfx = zeros(length(x),1);
-
- sm = m;
- for i=1:nblk-1
- sm(blkp(i,2):blkp(i+1,2)-1,:) = exp(x(i))*sm(blkp(i,2):blkp(i+1,2)-1,:);
- sm(:,blkp(i,1):blkp(i+1,1)-1) = exp(-x(i))*sm(:,blkp(i,1):blkp(i+1,1)-1);
- end
- [u,s,v]=svd(sm);
- cost = s(1,1);
-
- for i=1:nblk-1
- w1 = abs( u(blkp(i,2):blkp(i+1,2)-1,1)'* u(blkp(i,2):blkp(i+1,2)-1,1) );
- w2 = abs( v(blkp(i,1):blkp(i+1,1)-1,1)'* v(blkp(i,1):blkp(i+1,1)-1,1) );
- delfx(i) = s(1,1) * (w1-w2);
- end
-
- flopout = flops;
- flopcnt = flopout - flopin;
- %
- % Copyright MUSYN INC 1991, All Rights Reserved
-