~ubuntu-branches/ubuntu/wily/julia/wily

« back to all changes in this revision

Viewing changes to deps/openlibm/slatec/csevl.f

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot
  • Date: 2013-01-16 12:29:42 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130116122942-x86e42akjq31repw
Tags: 0.0.0+20130107.gitd9656f41-1
* New upstream snashot
* No longer try to rebuild helpdb.jl.
   + debian/rules: remove helpdb.jl from build-arch rule
   + debian/control: move back python-sphinx to Build-Depends-Indep
* debian/copyright: reflect upstream changes
* Add Build-Conflicts on libatlas3-base (makes linalg tests fail)
* debian/rules: replace obsolete USE_DEBIAN makeflag by a list of
  USE_SYSTEM_* flags
* debian/rules: on non-x86 systems, use libm instead of openlibm
* dpkg-buildflags.patch: remove patch, applied upstream
* Refreshed other patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
*DECK CSEVL
 
2
      FUNCTION CSEVL (X, CS, N)
 
3
C***BEGIN PROLOGUE  CSEVL
 
4
C***PURPOSE  Evaluate a Chebyshev series.
 
5
C***LIBRARY   SLATEC (FNLIB)
 
6
C***CATEGORY  C3A2
 
7
C***TYPE      SINGLE PRECISION (CSEVL-S, DCSEVL-D)
 
8
C***KEYWORDS  CHEBYSHEV SERIES, FNLIB, SPECIAL FUNCTIONS
 
9
C***AUTHOR  Fullerton, W., (LANL)
 
10
C***DESCRIPTION
 
11
C
 
12
C  Evaluate the N-term Chebyshev series CS at X.  Adapted from
 
13
C  a method presented in the paper by Broucke referenced below.
 
14
C
 
15
C       Input Arguments --
 
16
C  X    value at which the series is to be evaluated.
 
17
C  CS   array of N terms of a Chebyshev series.  In evaluating
 
18
C       CS, only half the first coefficient is summed.
 
19
C  N    number of terms in array CS.
 
20
C
 
21
C***REFERENCES  R. Broucke, Ten subroutines for the manipulation of
 
22
C                 Chebyshev series, Algorithm 446, Communications of
 
23
C                 the A.C.M. 16, (1973) pp. 254-256.
 
24
C               L. Fox and I. B. Parker, Chebyshev Polynomials in
 
25
C                 Numerical Analysis, Oxford University Press, 1968,
 
26
C                 page 56.
 
27
C***ROUTINES CALLED  R1MACH, XERMSG
 
28
C***REVISION HISTORY  (YYMMDD)
 
29
C   770401  DATE WRITTEN
 
30
C   890831  Modified array declarations.  (WRB)
 
31
C   890831  REVISION DATE from Version 3.2
 
32
C   891214  Prologue converted to Version 4.0 format.  (BAB)
 
33
C   900315  CALLs to XERROR changed to CALLs to XERMSG.  (THJ)
 
34
C   900329  Prologued revised extensively and code rewritten to allow
 
35
C           X to be slightly outside interval (-1,+1).  (WRB)
 
36
C   920501  Reformatted the REFERENCES section.  (WRB)
 
37
C***END PROLOGUE  CSEVL
 
38
      REAL B0, B1, B2, CS(*), ONEPL, TWOX, X
 
39
      LOGICAL FIRST
 
40
      SAVE FIRST, ONEPL
 
41
      DATA FIRST /.TRUE./
 
42
C***FIRST EXECUTABLE STATEMENT  CSEVL
 
43
      IF (FIRST) ONEPL = 1.0E0 + R1MACH(4)
 
44
      FIRST = .FALSE.
 
45
      IF (N .LT. 1) CALL XERMSG ('SLATEC', 'CSEVL',
 
46
     +   'NUMBER OF TERMS .LE. 0', 2, 2)
 
47
      IF (N .GT. 1000) CALL XERMSG ('SLATEC', 'CSEVL',
 
48
     +   'NUMBER OF TERMS .GT. 1000', 3, 2)
 
49
      IF (ABS(X) .GT. ONEPL) CALL XERMSG ('SLATEC', 'CSEVL',
 
50
     +   'X OUTSIDE THE INTERVAL (-1,+1)', 1, 1)
 
51
C
 
52
      B1 = 0.0E0
 
53
      B0 = 0.0E0
 
54
      TWOX = 2.0*X
 
55
      DO 10 I = 1,N
 
56
         B2 = B1
 
57
         B1 = B0
 
58
         NI = N + 1 - I
 
59
         B0 = TWOX*B1 - B2 + CS(NI)
 
60
   10 CONTINUE
 
61
C
 
62
      CSEVL = 0.5E0*(B0-B2)
 
63
C
 
64
      RETURN
 
65
      END