gtsam
3rdparty
cephes
cephes
chbevl.c
Go to the documentation of this file.
1
/* chbevl.c
2
*
3
* Evaluate Chebyshev series
4
*
5
*
6
*
7
* SYNOPSIS:
8
*
9
* int N;
10
* double x, y, coef[N], chebevl();
11
*
12
* y = chbevl( x, coef, N );
13
*
14
*
15
*
16
* DESCRIPTION:
17
*
18
* Evaluates the series
19
*
20
* N-1
21
* - '
22
* y = > coef[i] T (x/2)
23
* - i
24
* i=0
25
*
26
* of Chebyshev polynomials Ti at argument x/2.
27
*
28
* Coefficients are stored in reverse order, i.e. the zero
29
* order term is last in the array. Note N is the number of
30
* coefficients, not the order.
31
*
32
* If coefficients are for the interval a to b, x must
33
* have been transformed to x -> 2(2x - b - a)/(b-a) before
34
* entering the routine. This maps x from (a, b) to (-1, 1),
35
* over which the Chebyshev polynomials are defined.
36
*
37
* If the coefficients are for the inverted interval, in
38
* which (a, b) is mapped to (1/b, 1/a), the transformation
39
* required is x -> 2(2ab/x - b - a)/(b-a). If b is infinity,
40
* this becomes x -> 4a/x - 1.
41
*
42
*
43
*
44
* SPEED:
45
*
46
* Taking advantage of the recurrence properties of the
47
* Chebyshev polynomials, the routine requires one more
48
* addition per loop than evaluating a nested polynomial of
49
* the same degree.
50
*
51
*/
52
/* chbevl.c */
53
54
/*
55
* Cephes Math Library Release 2.0: April, 1987
56
* Copyright 1985, 1987 by Stephen L. Moshier
57
* Direct inquiries to 30 Frost Street, Cambridge, MA 02140
58
*/
59
60
#include "
mconf.h
"
61
#include <stdio.h>
62
63
double
chbevl
(
double
x
,
double
array
[],
int
n
)
64
{
65
double
b0,
b1
,
b2
, *
p
;
66
int
i
;
67
68
p
=
array
;
69
b0 = *
p
++;
70
b1
= 0.0;
71
i
=
n
- 1;
72
73
do
{
74
b2
=
b1
;
75
b1
= b0;
76
b0 =
x
*
b1
-
b2
+ *
p
++;
77
}
78
while
(--
i
);
79
80
return
(0.5 * (b0 -
b2
));
81
}
simple_graph::b1
Vector2 b1(2, -1)
array
int array[24]
Definition:
Map_general_stride.cpp:1
simple_graph::b2
Vector2 b2(4, -5)
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition:
gnuplot_common_settings.hh:12
chbevl
double chbevl(double x, double array[], int n)
Definition:
chbevl.c:63
n
int n
Definition:
BiCGSTAB_simple.cpp:1
array
Definition:
numpy.h:821
mconf.h
p
float * p
Definition:
Tutorial_Map_using.cpp:9
i
int i
Definition:
BiCGSTAB_step_by_step.cpp:9
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:32:05