| [nm,n,low,igh,a,intmlv,z]=eltran(nm,n,low,igh,a,intmlv,z); |
function [nm,n,low,igh,a,intmlv,z]=eltran(nm,n,low,igh,a,intmlv,z);
%***BEGIN PROLOGUE ELTRAN
%***PURPOSE Accumulates the stabilized elementary similarity
% transformations used in the reduction of a real general
% matrix to upper Hessenberg form by ELMHES.
%***LIBRARY SLATEC (EISPACK)
%***CATEGORY D4C4
%***TYPE SINGLE PRECISION (ELTRAN-S)
%***KEYWORDS EIGENVALUES, EIGENVECTORS, EISPACK
%***AUTHOR Smith, B. T., et al.
%***DESCRIPTION
%
% This subroutine is a translation of the ALGOL procedure ELMTRANS,
% NUM. MATH. 16, 181-204(1970) by Peters and Wilkinson.
% HANDBOOK FOR AUTO. COMP., VOL.II-LINEAR ALGEBRA, 372-395(1971).
%
% This subroutine accumulates the stabilized elementary
% similarity transformations used in the reduction of a
% REAL GENERAL matrix to upper Hessenberg form by ELMHES.
%
% On INPUT
%
% NM must be set to the row dimension of the two-dimensional
% array parameters, A and Z, as declared in the calling
% program dimension statement. NM is an INTEGER variable.
%
% N is the order of the matrix A. N is an INTEGER variable.
% N must be less than or equal to NM.
%
% LOW and IGH are two INTEGER variables determined by the
% balancing subroutine BALANC. If BALANC has not been
% used, set LOW=1 and IGH equal to the order of the matrix, N.
%
% A contains the multipliers which were used in the reduction
% by ELMHES in its lower triangle below the subdiagonal.
% A is a two-dimensional REAL array, dimensioned A(NM,IGH).
%
% INT contains information on the rows and columns interchanged
% in the reduction by ELMHES. Only elements LOW through IGH
% are used. INT is a one-dimensional INTEGER array,
% dimensioned INT(IGH).
%
% On OUTPUT
%
% Z contains the transformation matrix produced in the reduction
% by ELMHES. Z is a two-dimensional REAL array, dimensioned
% Z(NM,N).
%
% 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 ELTRAN
%
persistent i j kl mm mp mp1 ;
if isempty(i), i=0; end;
if isempty(j), j=0; end;
if isempty(kl), kl=0; end;
if isempty(mm), mm=0; end;
if isempty(mp), mp=0; end;
if isempty(mp1), mp1=0; end;
a_shape=size(a);a=reshape([a(:).',zeros(1,ceil(numel(a)./prod([nm])).*prod([nm])-numel(a))],nm,[]);
z_shape=size(z);z=reshape([z(:).',zeros(1,ceil(numel(z)./prod([nm])).*prod([nm])-numel(z))],nm,[]);
int_shape=size(intmlv);intmlv=reshape(intmlv,1,[]);
%
%***FIRST EXECUTABLE STATEMENT ELTRAN
for i = 1 : n;
%
for j = 1 : n;
z(i,j) = 0.0e0;
end; j = fix(n+1);
%
z(i,i) = 1.0e0;
end; i = fix(n+1);
%
kl = fix(igh - low - 1);
if( kl>=1 )
% .......... FOR MP=IGH-1 STEP -1 UNTIL LOW+1 DO -- ..........
for mm = 1 : kl;
mp = fix(igh - mm);
mp1 = fix(mp + 1);
%
for i = mp1 : igh;
z(i,mp) = a(i,mp-1);
end; i = fix(igh+1);
%
i = fix(intmlv(mp));
if( i~=mp )
%
for j = mp : igh;
z(mp,j) = z(i,j);
z(i,j) = 0.0e0;
end; j = fix(igh+1);
%
z(i,mp) = 1.0e0;
end;
end; mm = fix(kl+1);
end;
%
a_shape=zeros(a_shape);a_shape(:)=a(1:numel(a_shape));a=a_shape;
z_shape=zeros(z_shape);z_shape(:)=z(1:numel(z_shape));z=z_shape;
int_shape=zeros(int_shape);int_shape(:)=intmlv(1:numel(int_shape));intmlv=int_shape;
end
%DECK ENORM
|
|