cpevl.f 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. *DECK CPEVL
  2. SUBROUTINE CPEVL (N, M, A, Z, C, B, KBD)
  3. C***BEGIN PROLOGUE CPEVL
  4. C***SUBSIDIARY
  5. C***PURPOSE Subsidiary to CPZERO
  6. C***LIBRARY SLATEC
  7. C***TYPE SINGLE PRECISION (CPEVL-S)
  8. C***AUTHOR (UNKNOWN)
  9. C***DESCRIPTION
  10. C
  11. C Evaluate a complex polynomial and its derivatives.
  12. C Optionally compute error bounds for these values.
  13. C
  14. C INPUT...
  15. C N = Degree of the polynomial
  16. C M = Number of derivatives to be calculated,
  17. C M=0 evaluates only the function
  18. C M=1 evaluates the function and first derivative, etc.
  19. C if M .GT. N+1 function and all N derivatives will be
  20. C calculated.
  21. C A = Complex vector containing the N+1 coefficients of polynomial
  22. C A(I)= coefficient of Z**(N+1-I)
  23. C Z = Complex point at which the evaluation is to take place.
  24. C C = Array of 2(M+1) words into which values are placed.
  25. C B = Array of 2(M+1) words only needed if bounds are to be
  26. C calculated. It is not used otherwise.
  27. C KBD = A logical variable, e.g. .TRUE. or .FALSE. which is
  28. C to be set .TRUE. if bounds are to be computed.
  29. C
  30. C OUTPUT...
  31. C C = C(I+1) contains the complex value of the I-th
  32. C derivative at Z, I=0,...,M
  33. C B = B(I) contains the bounds on the real and imaginary parts
  34. C of C(I) if they were requested.
  35. C
  36. C***SEE ALSO CPZERO
  37. C***ROUTINES CALLED I1MACH
  38. C***REVISION HISTORY (YYMMDD)
  39. C 810223 DATE WRITTEN
  40. C 890531 Changed all specific intrinsics to generic. (WRB)
  41. C 890831 Modified array declarations. (WRB)
  42. C 891214 Prologue converted to Version 4.0 format. (BAB)
  43. C 900402 Added TYPE section. (WRB)
  44. C***END PROLOGUE CPEVL
  45. C
  46. COMPLEX A(*),C(*),Z,CI,CIM1,B(*),BI,BIM1,T,ZA,Q
  47. LOGICAL KBD
  48. SAVE D1
  49. DATA D1 /0.0/
  50. ZA(Q)=CMPLX(ABS(REAL(Q)),ABS(AIMAG(Q)))
  51. C***FIRST EXECUTABLE STATEMENT CPEVL
  52. IF (D1 .EQ. 0.0) D1 = REAL(I1MACH(10))**(1-I1MACH(11))
  53. NP1=N+1
  54. DO 1 J=1,NP1
  55. CI=0.0
  56. CIM1=A(J)
  57. BI=0.0
  58. BIM1=0.0
  59. MINI=MIN(M+1,N+2-J)
  60. DO 1 I=1,MINI
  61. IF(J .NE. 1) CI=C(I)
  62. IF(I .NE. 1) CIM1=C(I-1)
  63. C(I)=CIM1+Z*CI
  64. IF(.NOT. KBD) GO TO 1
  65. IF(J .NE. 1) BI=B(I)
  66. IF(I .NE. 1) BIM1=B(I-1)
  67. T=BI+(3.*D1+4.*D1*D1)*ZA(CI)
  68. R=REAL(ZA(Z)*CMPLX(REAL(T),-AIMAG(T)))
  69. S=AIMAG(ZA(Z)*T)
  70. B(I)=(1.+8.*D1)*(BIM1+D1*ZA(CIM1)+CMPLX(R,S))
  71. IF(J .EQ. 1) B(I)=0.0
  72. 1 CONTINUE
  73. RETURN
  74. END