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

  1.       subroutine rsm(nm,n,a,w,m,z,fwork,iwork,ierr)
  2.       integer n,nm,m,iwork(n),ierr
  3.       integer k1,k2,k3,k4,k5,k6,k7
  4.       double precision a(nm,n),w(n),z(nm,m),fwork(1)
  5. c
  6. c     this subroutine calls the recommended sequence of
  7. c     subroutines from the eigensystem subroutine package (eispack)
  8. c     to find all of the eigenvalues and some of the eigenvectors
  9. c     of a real symmetric matrix.
  10. c
  11. c     on input
  12. c
  13. c        nm  must be set to the row dimension of the two-dimensional
  14. c        array parameters as declared in the calling program
  15. c        dimension statement.
  16. c
  17. c        n  is the order of the matrix  a.
  18. c
  19. c        a  contains the real symmetric matrix.
  20. c
  21. c        m  the eigenvectors corresponding to the first m eigenvalues
  22. c           are to be computed.
  23. c           if m = 0 then no eigenvectors are computed.
  24. c           if m = n then all of the eigenvectors are computed.
  25. c
  26. c     on output
  27. c
  28. c        w  contains all n eigenvalues in ascending order.
  29. c
  30. c        z  contains the orthonormal eigenvectors associated with
  31. c           the first m eigenvalues.
  32. c
  33. c        ierr  is an integer output variable set equal to an error
  34. c           completion code described in the documentation for tqlrat,
  35. c           imtqlv and tinvit.  the normal completion code is zero.
  36. c
  37. c        fwork  is a temporary storage array of dimension 8*n.
  38. c
  39. c        iwork  is an integer temporary storage array of dimension n.
  40. c
  41. c     questions and comments should be directed to burton s. garbow,
  42. c     mathematics and computer science div, argonne national laboratory
  43. c
  44. c     this version dated august 1983.
  45. c
  46. c     ------------------------------------------------------------------
  47. c
  48.       ierr = 10 * n
  49.       if (n .gt. nm .or. m .gt. nm) go to 50
  50.       k1 = 1
  51.       k2 = k1 + n
  52.       k3 = k2 + n
  53.       k4 = k3 + n
  54.       k5 = k4 + n
  55.       k6 = k5 + n
  56.       k7 = k6 + n
  57.       k8 = k7 + n
  58.       if (m .gt. 0) go to 10
  59. c     .......... find eigenvalues only ..........
  60.       call  tred1(nm,n,a,w,fwork(k1),fwork(k2))
  61.       call  tqlrat(n,w,fwork(k2),ierr)
  62.       go to 50
  63. c     .......... find all eigenvalues and m eigenvectors ..........
  64.    10 call  tred1(nm,n,a,fwork(k1),fwork(k2),fwork(k3))
  65.       call  imtqlv(n,fwork(k1),fwork(k2),fwork(k3),w,iwork,
  66.      x             ierr,fwork(k4))
  67.       call  tinvit(nm,n,fwork(k1),fwork(k2),fwork(k3),m,w,iwork,z,ierr,
  68.      x             fwork(k4),fwork(k5),fwork(k6),fwork(k7),fwork(k8))
  69.       call  trbak1(nm,n,a,fwork(k2),m,z)
  70.    50 return
  71.       end
  72.