8 #include "CardinalBSpline.h" 18 : floatPolynomials_(),
27 int size = degree_ + 1;
29 floatPolynomials_.allocate(size);
33 exactPolynomials[0] = unity;
37 std::cout << std::endl;
38 std::cout <<
"Degree = 0 ";
39 std::cout <<
" [" << n
40 <<
" , " << n + 1 <<
"] : ";
41 std::cout << exactPolynomials[n];
50 for (n = 0; n < size; ++n) {
56 for (m = 0; m < degree_; ++m) {
59 for (n = 0; n <= m; ++n) {
60 work[n] = exactPolynomials[n].integrate();
64 for (n = 0; n < size; ++n) {
65 exactPolynomials[n].setToZero();
69 for (n = 0; n <= m + 1; ++n) {
71 exactPolynomials[n] += work[n];
72 exactPolynomials[n] -= work[n](
Rational(n));
75 exactPolynomials[n] += work[n-1](
Rational(n));
76 exactPolynomials[n] -= work[n-1].shift(
Rational(-1));
82 std::cout << std::endl;
83 for (n = 0; n <= m + 1; ++n) {
84 std::cout << std::endl;
85 std::cout <<
"Degree = " << m + 1;
86 std::cout <<
" [" << n
87 <<
" , " << n + 1 <<
"] : ";
88 std::cout << exactPolynomials[n] <<
" ";
89 std::cout << exactPolynomials[n](
Rational(n)) <<
" ";
90 std::cout << exactPolynomials[n](
Rational(n+1)) <<
" ";
97 for (n = 0; n <= degree_; ++n) {
98 work[n] = exactPolynomials[n];
102 for (m = 0; m < degree_; ++m) {
103 for (n = 1; n <= degree_; ++n) {
108 for (n = 0; n <= degree_; ++n) {
109 work[n] = work[n].differentiate();
114 for (n = 0; n <= degree_; ++n) {
115 floatPolynomials_[n] = exactPolynomials[n];
~CardinalBSpline()
Destructor.
File containing preprocessor macros for error handling.
CardinalBSpline(int degree, bool verbose=false)
Construct a spline basis of specified degree.
Utility classes for scientific computation.
Dynamically allocatable contiguous array template.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
void allocate(int capacity)
Allocate the underlying C array.
A Rational number (a ratio of integers).