Code covered by the BSD License  

Highlights from
slatec

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

[nm,n,nv,a,m,z]=trbak3(nm,n,nv,a,m,z);
function [nm,n,nv,a,m,z]=trbak3(nm,n,nv,a,m,z);
%***BEGIN PROLOGUE  TRBAK3
%***PURPOSE  Form the eigenvectors of a real symmetric matrix from the
%            eigenvectors of a symmetric tridiagonal matrix formed
%            by TRED3.
%***LIBRARY   SLATEC (EISPACK)
%***CATEGORY  D4C4
%***TYPE      SINGLE PRECISION (TRBAK3-S)
%***KEYWORDS  EIGENVECTORS OF A REAL SYMMETRIC MATRIX, EISPACK
%***AUTHOR  Smith, B. T., et al.
%***DESCRIPTION
%
%     This subroutine is a translation of the ALGOL procedure TRBAK3,
%     NUM. MATH. 11, 181-195(1968) by Martin, Reinsch, and Wilkinson.
%     HANDBOOK FOR AUTO. COMP., VOL.II-LINEAR ALGEBRA, 212-226(1971).
%
%     This subroutine forms the eigenvectors of a REAL SYMMETRIC
%     matrix by back transforming those of the corresponding
%     symmetric tridiagonal matrix determined by  TRED3.
%
%     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 order of the matrix.  N is an INTEGER variable.
%          N must be less than or equal to NM.
%
%        NV is an INTEGER variable set equal to the dimension of the
%          array A as specified in the calling program.  NV must not
%          be less than  N*(N+1)/2.
%
%        A contains information about the orthogonal transformations
%          used in the reduction by  TRED3  in its first N*(N+1)/2
%          positions.  A is a one-dimensional REAL array, dimensioned
%          A(NV).
%
%        M is the number of columns of Z to be back transformed.
%          M is an INTEGER variable.
%
%        Z contains the eigenvectors 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 transformed eigenvectors in its first M columns.
%
%     Note that TRBAK3 preserves vector Euclidean norms.
%
%     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  TRBAK3
%
persistent h i ik iz j k l s ; 

if isempty(i), i=0; end;
if isempty(j), j=0; end;
if isempty(k), k=0; end;
if isempty(l), l=0; end;
if isempty(ik), ik=0; end;
if isempty(iz), iz=0; end;
a_shape=size(a);a=reshape(a,1,[]);
z_shape=size(z);z=reshape([z(:).',zeros(1,ceil(numel(z)./prod([nm])).*prod([nm])-numel(z))],nm,[]);
if isempty(h), h=0; end;
if isempty(s), s=0; end;
%
%***FIRST EXECUTABLE STATEMENT  TRBAK3
if( m~=0 )
if( n~=1 )
%
for i = 2 : n;
l = fix(i - 1);
iz =fix(fix((i.*l)./2));
ik = fix(iz + i);
h = a(ik);
if( h~=0.0e0 )
%
for j = 1 : m;
s = 0.0e0;
ik = fix(iz);
%
for k = 1 : l;
ik = fix(ik + 1);
s = s + a(ik).*z(k,j);
end; k = fix(l+1);
%     .......... DOUBLE DIVISION AVOIDS POSSIBLE UNDERFLOW ..........
s =(s./h)./h;
ik = fix(iz);
%
for k = 1 : l;
ik = fix(ik + 1);
z(k,j) = z(k,j) - s.*a(ik);
end; k = fix(l+1);
%
end; j = fix(m+1);
end;
%
end; i = fix(n+1);
end;
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;
end
%DECK TRED1

Contact us at files@mathworks.com