Blame view

fvn_fnlib/dcsevl.f 980 Bytes
38581db0c   daniau   git-svn-id: https...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
        double precision function dcsevl (x, a, n)
  c
  c evaluate the n-term chebyshev series a at x.  adapted from
  c r. broucke, algorithm 446, c.a.c.m., 16, 254 (1973).
  c
  c             input arguments --
  c x      dble prec value at which the series is to be evaluated.
  c a      dble prec array of n terms of a chebyshev series.  in eval-
  c        uating a, only half the first coef is summed.
  c n      number of terms in array a.
  c
        double precision a(n), x, twox, b0, b1, b2
  c
        if (n.lt.1) call seteru (28hdcsevl  number of terms le 0, 28, 2,2)
        if (n.gt.1000) call seteru (31hdcsevl  number of terms gt 1000,
       1  31, 3, 2)
        if (x.lt.(-1.1d0) .or. x.gt.1.1d0) call seteru (
       1  25hdcsevl  x outside (-1,+1), 25, 1, 1)
  c
        twox = 2.0d0*x
        b1 = 0.d0
        b0 = 0.d0
        do 10 i=1,n
          b2 = b1
          b1 = b0
          ni = n - i + 1
          b0 = twox*b1 - b2 + a(ni)
   10   continue
  c
        dcsevl = 0.5d0 * (b0-b2)
  c
        return
        end