%function [bw,az,beta,ec] = spwr_1(mat,nblk,blk,blkp,repp,fulp,bw)
%	Performs one iteration of the lower bound power iteration when
%	the block structure is all 1x1 blocks.  Special case of pounce.

function [bw,az,beta,ec] = spwr_1(mat,nblk,blk,blkp,repp,fulp,bw)
%  disp(['in spwr_1'])
%  bw
  b = bw(:,1);  w = bw(:,2);
  ec = 0;
  a = mat * b;
  beta1 = norm(a);
  if beta1 < 1e-8
    ec = 1;
    return
  end 
  a = (1.0/beta1) * a;
  den = abs(a);
  if min(den) > 10*eps
	z = abs(w) .* a./den;
      else
	aa = a + (den <= 10*eps);	% set phase of zero elements  
	z = abs(w) .* aa./abs(aa);	% to pha()=1
  end
  w = mat' * z;
  beta2 = norm(w);
  if beta2 < 1e-8
    ec = 2;
    return
  end
  w = (1.0/beta2) * w;
  den = abs(w);
  if min(den) > 10*eps
	b = abs(a) .* w ./ den;
    else
	ww = w + (den <= 10*eps);	% set den=1 for zero elements
	b = abs(a) .* w ./ abs(ww);	% and thus b=0 
  end
  bw = [b w];
  beta = [beta1 beta2];
  az = [a z];
% disp(['out spwr_1'])
%
% Copyright MUSYN INC 1991,  All Rights Reserved
