home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / lib / mathlib / libconv / TRY / stuff.f < prev   
Encoding:
Text File  |  1994-08-02  |  1.1 KB  |  72 lines

  1.      subroutine inirand()
  2.     call srand(13)
  3.     return
  4.     end
  5.  
  6. #ifdef SINGLE
  7.     subroutine sinit(nx, x)
  8. #define THIS_REAL
  9. #endif
  10. #ifdef DOUBLE
  11.     subroutine dinit(nx, x)
  12.     implicit double precision (a-h, o-z)
  13. #define THIS_REAL
  14. #endif
  15. #ifdef COMPLEX
  16.     subroutine cinit(nx, x)
  17.     implicit complex (a-h, o-z)
  18. #define THIS_COMPLEX
  19. #endif
  20. #ifdef ZOMPLEX
  21.     subroutine zinit(nx, x)
  22.     implicit double complex (a-h, o-z)
  23. #define THIS_COMPLEX
  24. #endif
  25.     dimension x(*)
  26.     double precision rand
  27.     do i = 1, nx
  28. #ifdef THIS_REAL
  29.         x(i) = 2 * rand() - 1.0
  30. #endif
  31. #ifdef THIS_COMPLEX
  32.         x(i) = cmplx(2 * rand() - 1.0, 2 * rand() - 1.0)
  33. #endif
  34.     end do
  35.     return
  36.     end
  37.  
  38. #ifdef SINGLE
  39.     subroutine sone(nx, x)
  40. #endif
  41. #ifdef DOUBLE
  42.     subroutine done(nx, x)
  43.     implicit double precision (a-h, o-z)
  44. #endif
  45. #ifdef COMPLEX
  46.     subroutine cone(nx, x)
  47.     implicit complex (a-h, o-z)
  48. #define THIS_COMPLEX
  49. #endif
  50. #ifdef ZOMPLEX
  51.     subroutine zone(nx, x)
  52.     implicit double complex (a-h, o-z)
  53. #define THIS_COMPLEX
  54. #endif
  55.     dimension x(*)
  56.  
  57. #ifdef THIS_REAL
  58.     one = 1.0
  59.     zero = 0.0
  60. #endif
  61. #ifdef THIS_COMPLEX
  62.     one = cmplx(1.0,0.0)
  63.     zero = cmplx(0.0,0.0)
  64. #endif
  65.     x(1) = one
  66.     do i = 2, nx
  67.         x(i) = zero
  68.     end do
  69.     return
  70.     end
  71.  
  72.