| [nm,n,low,igh,scalemlv,m,zr,zi]=cbabk2(nm,n,low,igh,scalemlv,m,zr,zi); |
function [nm,n,low,igh,scalemlv,m,zr,zi]=cbabk2(nm,n,low,igh,scalemlv,m,zr,zi);
%***BEGIN PROLOGUE CBABK2
%***PURPOSE Form the eigenvectors of a complex general matrix from the
% eigenvectors of matrix output from CBAL.
%***LIBRARY SLATEC (EISPACK)
%***CATEGORY D4C4
%***TYPE COMPLEX (BALBAK-S, CBABK2-C)
%***KEYWORDS EIGENVECTORS, EISPACK
%***AUTHOR Smith, B. T., et al.
%***DESCRIPTION
%
% This subroutine is a translation of the ALGOL procedure
% CBABK2, which is a complex version of BALBAK,
% NUM. MATH. 13, 293-304(1969) by Parlett and Reinsch.
% HANDBOOK FOR AUTO. COMP., VOL.II-LINEAR ALGEBRA, 315-326(1971).
%
% This subroutine forms the eigenvectors of a COMPLEX GENERAL
% matrix by back transforming those of the corresponding
% balanced matrix determined by CBAL.
%
% On INPUT
%
% NM must be set to the row dimension of the two-dimensional
% array parameters, ZR and ZI, as declared in the calling
% program dimension statement. NM is an INTEGER variable.
%
% N is the order of the matrix Z=(ZR,ZI). N is an INTEGER
% variable. N must be less than or equal to NM.
%
% LOW and IGH are INTEGER variables determined by CBAL.
%
% SCALE contains information determining the permutations and
% scaling factors used by CBAL. SCALE is a one-dimensional
% REAL array, dimensioned SCALE(N).
%
% M is the number of eigenvectors to be back transformed.
% M is an INTEGER variable.
%
% ZR and ZI contain the real and imaginary parts, respectively,
% of the eigenvectors to be back transformed in their first
% M columns. ZR and ZI are two-dimensional REAL arrays,
% dimensioned ZR(NM,M) and ZI(NM,M).
%
% On OUTPUT
%
% ZR and ZI contain the real and imaginary parts,
% respectively, of the transformed eigenvectors
% in their first M columns.
%
% Questions and comments should be directed to B. S. Garbow,
% APPLIED MATHEMATICS DIVISION, ARGONNE NATIONAL LABORATORY
% ------------------------------------------------------------------
%
%***REFERENCES B. T. Smith, J. M. Boyle, J. J. Dongarra, B. S. Garbow,
% Y. Ikebe, V. C. Klema and C. B. Moler, Matrix Eigen-
% system Routines - EISPACK Guide, Springer-Verlag,
% 1976.
%***ROUTINES CALLED (NONE)
%***REVISION HISTORY (YYMMDD)
% 760101 DATE WRITTEN
% 890831 Modified array declarations. (WRB)
% 890831 REVISION DATE from Version 3.2
% 891214 Prologue converted to Version 4.0 format. (BAB)
% 920501 Reformatted the REFERENCES section. (WRB)
%***end PROLOGUE CBABK2
%
persistent i ii j k s ;
if isempty(i), i=0; end;
if isempty(j), j=0; end;
if isempty(k), k=0; end;
if isempty(ii), ii=0; end;
scale_shape=size(scalemlv);scalemlv=reshape(scalemlv,1,[]);
zr_shape=size(zr);zr=reshape([zr(:).',zeros(1,ceil(numel(zr)./prod([nm])).*prod([nm])-numel(zr))],nm,[]);
zi_shape=size(zi);zi=reshape([zi(:).',zeros(1,ceil(numel(zi)./prod([nm])).*prod([nm])-numel(zi))],nm,[]);
if isempty(s), s=0; end;
%
%***FIRST EXECUTABLE STATEMENT CBABK2
if( m~=0 )
if( igh~=low )
%
for i = low : igh;
s = scalemlv(i);
% .......... LEFT HAND EIGENVECTORS ARE BACK TRANSFORMED
% IF THE FOREGOING STATEMENT IS REPLACED BY
% S=1.0E0/SCALE(I). ..........
for j = 1 : m;
zr(i,j) = zr(i,j).*s;
zi(i,j) = zi(i,j).*s;
end; j = fix(m+1);
%
end; i = fix(igh+1);
end;
% .......... FOR I=LOW-1 STEP -1 UNTIL 1,
% IGH+1 STEP 1 UNTIL N DO -- ..........
for ii = 1 : n;
i = fix(ii);
if( i<low || i>igh )
if( i<low )
i = fix(low - ii);
end;
k = fix(scalemlv(i));
if( k~=i )
%
for j = 1 : m;
s = zr(i,j);
zr(i,j) = zr(k,j);
zr(k,j) = s;
s = zi(i,j);
zi(i,j) = zi(k,j);
zi(k,j) = s;
end; j = fix(m+1);
end;
end;
%
end; ii = fix(n+1);
end;
%
scale_shape=zeros(scale_shape);scale_shape(:)=scalemlv(1:numel(scale_shape));scalemlv=scale_shape;
zr_shape=zeros(zr_shape);zr_shape(:)=zr(1:numel(zr_shape));zr=zr_shape;
zi_shape=zeros(zi_shape);zi_shape(:)=zi(1:numel(zi_shape));zi=zi_shape;
end
%DECK CBAL
|
|