home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / eispack-1.0-src.tgz / tar.out / contrib / eispack / ortran.f < prev    next >
Text File  |  1996-09-28  |  3KB  |  87 lines

  1.       subroutine ortran(nm,n,low,igh,a,ort,z)
  2. c
  3.       integer i,j,n,kl,mm,mp,nm,igh,low,mp1
  4.       double precision a(nm,igh),ort(igh),z(nm,n)
  5.       double precision g
  6. c
  7. c     this subroutine is a translation of the algol procedure ortrans,
  8. c     num. math. 16, 181-204(1970) by peters and wilkinson.
  9. c     handbook for auto. comp., vol.ii-linear algebra, 372-395(1971).
  10. c
  11. c     this subroutine accumulates the orthogonal similarity
  12. c     transformations used in the reduction of a real general
  13. c     matrix to upper hessenberg form by  orthes.
  14. c
  15. c     on input
  16. c
  17. c        nm must be set to the row dimension of two-dimensional
  18. c          array parameters as declared in the calling program
  19. c          dimension statement.
  20. c
  21. c        n is the order of the matrix.
  22. c
  23. c        low and igh are integers determined by the balancing
  24. c          subroutine  balanc.  if  balanc  has not been used,
  25. c          set low=1, igh=n.
  26. c
  27. c        a contains information about the orthogonal trans-
  28. c          formations used in the reduction by  orthes
  29. c          in its strict lower triangle.
  30. c
  31. c        ort contains further information about the trans-
  32. c          formations used in the reduction by  orthes.
  33. c          only elements low through igh are used.
  34. c
  35. c     on output
  36. c
  37. c        z contains the transformation matrix produced in the
  38. c          reduction by  orthes.
  39. c
  40. c        ort has been altered.
  41. c
  42. c     questions and comments should be directed to burton s. garbow,
  43. c     mathematics and computer science div, argonne national laboratory
  44. c
  45. c     this version dated august 1983.
  46. c
  47. c     ------------------------------------------------------------------
  48. c
  49. c     .......... initialize z to identity matrix ..........
  50.       do 80 j = 1, n
  51. c
  52.          do 60 i = 1, n
  53.    60    z(i,j) = 0.0d0
  54. c
  55.          z(j,j) = 1.0d0
  56.    80 continue
  57. c
  58.       kl = igh - low - 1
  59.       if (kl .lt. 1) go to 200
  60. c     .......... for mp=igh-1 step -1 until low+1 do -- ..........
  61.       do 140 mm = 1, kl
  62.          mp = igh - mm
  63.          if (a(mp,mp-1) .eq. 0.0d0) go to 140
  64.          mp1 = mp + 1
  65. c
  66.          do 100 i = mp1, igh
  67.   100    ort(i) = a(i,mp-1)
  68. c
  69.          do 130 j = mp, igh
  70.             g = 0.0d0
  71. c
  72.             do 110 i = mp, igh
  73.   110       g = g + ort(i) * z(i,j)
  74. c     .......... divisor below is negative of h formed in orthes.
  75. c                double division avoids possible underflow ..........
  76.             g = (g / ort(mp)) / a(mp,mp-1)
  77. c
  78.             do 120 i = mp, igh
  79.   120       z(i,j) = z(i,j) + g * ort(i)
  80. c
  81.   130    continue
  82. c
  83.   140 continue
  84. c
  85.   200 return
  86.       end
  87.