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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
# GS_B1POL -- Procedure to evaluate all the non-zero polynomial functions
# for a single point and given order.
procedure dgs_b1pol (x, order, k1, k2, basis)
double x # data point
int order # order of polynomial, order = 1, constant
double k1, k2 # nomalizing constants, dummy in this case
double basis[ARB] # basis functions
int i
begin
basis[1] = 1.
if (order == 1)
return
basis[2] = x
if (order == 2)
return
do i = 3, order
basis[i] = x * basis[i-1]
end
# GS_B1LEG -- Procedure to evaluate all the non-zero Legendre functions for
# a single point and given order.
procedure dgs_b1leg (x, order, k1, k2, basis)
double x # data point
int order # order of polynomial, order = 1, constant
double k1, k2 # normalizing constants
double basis[ARB] # basis functions
int i
double ri, xnorm
begin
basis[1] = 1.
if (order == 1)
return
xnorm = (x + k1) * k2
basis[2] = xnorm
if (order == 2)
return
do i = 3, order {
ri = i
basis[i] = ((2. * ri - 3.) * xnorm * basis[i-1] -
(ri - 2.) * basis[i-2]) / (ri - 1.)
}
end
# GS_B1CHEB -- Procedure to evaluate all the non zero Chebyshev function
# for a given x and order.
procedure dgs_b1cheb (x, order, k1, k2, basis)
double x # number of data points
int order # order of polynomial, 1 is a constant
double k1, k2 # normalizing constants
double basis[ARB] # array of basis functions
int i
double xnorm
begin
basis[1] = 1.
if (order == 1)
return
xnorm = (x + k1) * k2
basis[2] = xnorm
if (order == 2)
return
do i = 3, order
basis[i] = 2. * xnorm * basis[i-1] - basis[i-2]
end
|