home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / fractal / kaos.lha / eigenlib / eltran.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-18  |  2.2 KB  |  79 lines

  1. eltran(nm,n,low,igh,a,intch,z)
  2.  
  3. int nm,*igh,*low,*intch;
  4. double **a,**z;
  5.  
  6. {
  7. int i,j,mm,mp,mp1,kl;
  8.  
  9. /*    this subroutine is a translation of the algol procedure elmtrans,
  10.       num. math. 16, 181-204(1970) by peters and wilkinson.
  11.       handbook for auto. comp., vol.ii-linear algebra, 372-395(1971).
  12.  
  13.       this subroutine accumulates the stabilized elementary
  14.       similarity transformations used in the reduction of a
  15.       real general matrix to upper hessenberg form by  elmhes.
  16.  
  17.       on input
  18.  
  19.          nm must be set to the row dimension of two-dimensional
  20.            array parameters as declared in the calling program
  21.            dimension statement.
  22.  
  23.          n is the order of the matrix.
  24.  
  25.          low and igh are integers determined by the balancing
  26.            subroutine  balanc.  if  balanc  has not been used,
  27.            set low=1, igh=n.
  28.  
  29.          a contains the multipliers which were used in the
  30.            reduction by  elmhes  in its lower triangle
  31.            below the subdiagonal.
  32.  
  33.          intch contains information on the rows and columns
  34.            interchanged in the reduction by  elmhes.
  35.            only elements low through igh are used.
  36.  
  37.       on output
  38.  
  39.          z contains the transformation matrix produced in the
  40.            reduction by  elmhes.
  41.  
  42.  
  43.       this routine is a C-translation of the FORTRAN 77 source code
  44.       written by the mathematics and computer science division,
  45.       argonne national laboratory
  46.       last change :   september 1989.
  47.  
  48.       mark myers
  49.       Center for Applied Mathematics 
  50.       Cornell University    (607) 255-4195
  51.  
  52.       ------------------------------------------------------------------  */
  53.  
  54.  for (j=1;j<=n;j++)              /* initialize z to the identity matrix */
  55.    for (i=1;i<=n;i++)
  56.      if (i==j)
  57.        z[j][j] = 1.e0;
  58.      else
  59.        z[i][j] = 0.e0;
  60.  
  61.  kl = *igh - *low - 1;
  62.  if (kl >= 1) 
  63.  for (mm=1;mm<=kl;mm++)         /* for mp=igh-1 step -1 until low+1 do */           
  64.    {mp = *igh - mm;
  65.     mp1 = mp + 1;
  66.  
  67.     for (i=mp1;i<=*igh;i++) 
  68.       z[i][mp] = a[i][mp-1];
  69.  
  70.     i = intch[mp];
  71.     if (i != mp) 
  72.       {for (j=mp;j<=*igh;j++) 
  73.         {z[mp][j] = z[i][j];
  74.          z[i][j] = 0.e0;}
  75.    
  76.        z[i][mp] = 1.0e0; }
  77.    }
  78.