csscal.f 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. *DECK CSSCAL
  2. SUBROUTINE CSSCAL (N, SA, CX, INCX)
  3. C***BEGIN PROLOGUE CSSCAL
  4. C***PURPOSE Scale a complex vector.
  5. C***LIBRARY SLATEC (BLAS)
  6. C***CATEGORY D1A6
  7. C***TYPE COMPLEX (CSSCAL-C)
  8. C***KEYWORDS BLAS, LINEAR ALGEBRA, SCALE, VECTOR
  9. C***AUTHOR Lawson, C. L., (JPL)
  10. C Hanson, R. J., (SNLA)
  11. C Kincaid, D. R., (U. of Texas)
  12. C Krogh, F. T., (JPL)
  13. C***DESCRIPTION
  14. C
  15. C B L A S Subprogram
  16. C Description of Parameters
  17. C
  18. C --Input--
  19. C N number of elements in input vector(s)
  20. C SA single precision scale factor
  21. C CX complex vector with N elements
  22. C INCX storage spacing between elements of CX
  23. C
  24. C --Output--
  25. C CX scaled result (unchanged if N .LE. 0)
  26. C
  27. C Replace complex CX by (single precision SA) * (complex CX)
  28. C For I = 0 to N-1, replace CX(IX+I*INCX) with SA * CX(IX+I*INCX),
  29. C where IX = 1 if INCX .GE. 0, else IX = 1+(1-N)*INCX.
  30. C
  31. C***REFERENCES C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
  32. C Krogh, Basic linear algebra subprograms for Fortran
  33. C usage, Algorithm No. 539, Transactions on Mathematical
  34. C Software 5, 3 (September 1979), pp. 308-323.
  35. C***ROUTINES CALLED (NONE)
  36. C***REVISION HISTORY (YYMMDD)
  37. C 791001 DATE WRITTEN
  38. C 890831 Modified array declarations. (WRB)
  39. C 890831 REVISION DATE from Version 3.2
  40. C 891214 Prologue converted to Version 4.0 format. (BAB)
  41. C 900821 Modified to correct problem with a negative increment.
  42. C (WRB)
  43. C 920501 Reformatted the REFERENCES section. (WRB)
  44. C***END PROLOGUE CSSCAL
  45. COMPLEX CX(*)
  46. REAL SA
  47. INTEGER I, INCX, IX, N
  48. C***FIRST EXECUTABLE STATEMENT CSSCAL
  49. IF (N .LE. 0) RETURN
  50. C
  51. IF (INCX .EQ. 1) GOTO 20
  52. C
  53. C Code for increment not equal to 1.
  54. C
  55. IX = 1
  56. IF (INCX .LT. 0) IX = (-N+1)*INCX + 1
  57. DO 10 I = 1,N
  58. CX(IX) = SA*CX(IX)
  59. IX = IX + INCX
  60. 10 CONTINUE
  61. RETURN
  62. C
  63. C Code for increment equal to 1.
  64. C
  65. 20 DO 30 I = 1,N
  66. CX(I) = SA*CX(I)
  67. 30 CONTINUE
  68. RETURN
  69. END