| [nm,n,a,b,w,matz,z,fv1,fv2,ierr]=rsgba(nm,n,a,b,w,matz,z,fv1,fv2,ierr); |
function [nm,n,a,b,w,matz,z,fv1,fv2,ierr]=rsgba(nm,n,a,b,w,matz,z,fv1,fv2,ierr);
%***BEGIN PROLOGUE RSGBA
%***PURPOSE Compute the eigenvalues and, optionally, the eigenvectors
% of a symmetric generalized eigenproblem.
%***LIBRARY SLATEC (EISPACK)
%***CATEGORY D4B1
%***TYPE SINGLE PRECISION (RSGBA-S)
%***KEYWORDS EIGENVALUES, EIGENVECTORS, EISPACK
%***AUTHOR Smith, B. T., et al.
%***DESCRIPTION
%
% This subroutine calls the recommended sequence of
% subroutines from the eigensystem subroutine package (EISPACK)
% to find the eigenvalues and eigenvectors (if desired)
% for the REAL SYMMETRIC generalized eigenproblem BAx = (LAMBDA)x.
%
% On Input
%
% NM must be set to the row dimension of the two-dimensional
% array parameters, A, B, and Z, as declared in the calling
% program dimension statement. NM is an INTEGER variable.
%
% N is the order of the matrices A and B. N is an INTEGER
% variable. N must be less than or equal to NM.
%
% A contains a real symmetric matrix. A is a two-dimensional
% REAL array, dimensioned A(NM,N).
%
% B contains a positive definite real symmetric matrix. B is a
% two-dimensional REAL array, dimensioned B(NM,N).
%
% MATZ is an INTEGER variable set equal to zero if only
% eigenvalues are desired. Otherwise, it is set to any
% non-zero integer for both eigenvalues and eigenvectors.
%
% On Output
%
% W contains the eigenvalues in ascending order. W is a
% one-dimensional REAL array, dimensioned W(N).
%
% Z contains the eigenvectors if MATZ is not zero. Z is a
% two-dimensional REAL array, dimensioned Z(NM,N).
%
% IERR is an INTEGER flag set to
% Zero for normal return,
% 10*N if N is greater than NM,
% 7*N+1 if B is not positive definite,
% J if the J-th eigenvalue has not been
% determined after 30 iterations.
% The eigenvalues should be correct for indices
% 1, 2, ..., IERR-1, but no eigenvectors are
% computed.
%
% FV1 and FV2 are one-dimensional REAL arrays used for temporary
% storage, dimensioned FV1(N) and FV2(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 REBAKB, REDUC2, TQL2, TQLRAT, TRED1, TRED2
%***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 RSGBA
%
a_shape=size(a);a=reshape([a(:).',zeros(1,ceil(numel(a)./prod([nm])).*prod([nm])-numel(a))],nm,[]);
b_shape=size(b);b=reshape([b(:).',zeros(1,ceil(numel(b)./prod([nm])).*prod([nm])-numel(b))],nm,[]);
w_shape=size(w);w=reshape(w,1,[]);
z_shape=size(z);z=reshape([z(:).',zeros(1,ceil(numel(z)./prod([nm])).*prod([nm])-numel(z))],nm,[]);
fv1_shape=size(fv1);fv1=reshape(fv1,1,[]);
fv2_shape=size(fv2);fv2=reshape(fv2,1,[]);
%
%***FIRST EXECUTABLE STATEMENT RSGBA
if( n<=nm )
%
[nm,n,a,b,fv2,ierr]=reduc2(nm,n,a,b,fv2,ierr);
if( ierr==0 )
if( matz~=0 )
% .......... FIND BOTH EIGENVALUES AND EIGENVECTORS ..........
[nm,n,a,w,fv1,z]=tred2(nm,n,a,w,fv1,z);
[nm,n,w,fv1,z,ierr]=tql2(nm,n,w,fv1,z,ierr);
if( ierr==0 )
n_orig=n; [nm,n,b,fv2,dumvar5,z]=rebakb(nm,n,b,fv2,n,z); n(dumvar5~=n_orig)=dumvar5(dumvar5~=n_orig);
end;
else;
% .......... FIND EIGENVALUES ONLY ..........
[nm,n,a,w,fv1,fv2]=tred1(nm,n,a,w,fv1,fv2);
[n,w,fv2,ierr]=tqlrat(n,w,fv2,ierr);
end;
end;
else;
ierr = fix(10.*n);
end;
a_shape=zeros(a_shape);a_shape(:)=a(1:numel(a_shape));a=a_shape;
b_shape=zeros(b_shape);b_shape(:)=b(1:numel(b_shape));b=b_shape;
w_shape=zeros(w_shape);w_shape(:)=w(1:numel(w_shape));w=w_shape;
z_shape=zeros(z_shape);z_shape(:)=z(1:numel(z_shape));z=z_shape;
fv1_shape=zeros(fv1_shape);fv1_shape(:)=fv1(1:numel(fv1_shape));fv1=fv1_shape;
fv2_shape=zeros(fv2_shape);fv2_shape(:)=fv2(1:numel(fv2_shape));fv2=fv2_shape;
end
%DECK RSG
|
|