Code covered by the BSD License  

Highlights from
slatec

from slatec by Ben Barrowes
The slatec library converted into matlab functions.

[nm,n,low,igh,scalemlv,m,z]=balbak(nm,n,low,igh,scalemlv,m,z);
function [nm,n,low,igh,scalemlv,m,z]=balbak(nm,n,low,igh,scalemlv,m,z);
%***BEGIN PROLOGUE  BALBAK
%***PURPOSE  Form the eigenvectors of a real general matrix from the
%            eigenvectors of matrix output from BALANC.
%***LIBRARY   SLATEC (EISPACK)
%***CATEGORY  D4C4
%***TYPE      SINGLE PRECISION (BALBAK-S, CBABK2-C)
%***KEYWORDS  EIGENVECTORS, EISPACK
%***AUTHOR  Smith, B. T., et al.
%***DESCRIPTION
%
%     This subroutine is a translation of the ALGOL procedure 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 REAL GENERAL
%     matrix by back transforming those of the corresponding
%     balanced matrix determined by  BALANC.
%
%     On INPUT
%
%        NM must be set to the row dimension of the two-dimensional
%          array parameter, Z, as declared in the calling program
%          dimension statement.  NM is an INTEGER variable.
%
%        N is the number of components of the vectors in matrix Z.
%          N is an INTEGER variable.  N must be less than or equal
%          to NM.
%
%        LOW and IGH are INTEGER variables determined by  BALANC.
%
%        SCALE contains information determining the permutations and
%          scaling factors used by  BALANC.  SCALE is a one-dimensional
%          REAL array, dimensioned SCALE(N).
%
%        M is the number of columns of Z to be back transformed.
%          M is an INTEGER variable.
%
%        Z contains the real and imaginary parts of the eigen-
%          vectors to be back transformed in its first M columns.
%          Z is a two-dimensional REAL array, dimensioned Z(NM,M).
%
%     On OUTPUT
%
%        Z contains the real and imaginary parts of the
%          transformed eigenvectors in its 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  BALBAK
%
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,[]);
z_shape=size(z);z=reshape([z(:).',zeros(1,ceil(numel(z)./prod([nm])).*prod([nm])-numel(z))],nm,[]);
if isempty(s), s=0; end;
%
%***FIRST EXECUTABLE STATEMENT  BALBAK
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;
z(i,j) = z(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 = z(i,j);
z(i,j) = z(k,j);
z(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;
z_shape=zeros(z_shape);z_shape(:)=z(1:numel(z_shape));z=z_shape;
end
%DECK BANDR

Contact us at files@mathworks.com