vspline 1.1.0
Generic C++11 Code for Uniform B-Splines
|
verify bspline interpolation against polynomial More...
#include <iostream>
#include <typeinfo>
#include <random>
#include <vigra/multi_array.hxx>
#include <vigra/accumulator.hxx>
#include <vigra/multi_math.hxx>
#include <vspline/vspline.h>
Go to the source code of this file.
Classes | |
struct | random_polynomial< dtype > |
Functions | |
template<class dtype > | |
void | polynominal_test (int degree, const char *type_name) |
int | main (int argc, char *argv[]) |
verify bspline interpolation against polynomial
A b-spline is a piecewise polynomial function. Therefore, it should model a polynomial of the same degree precisely. This program tests this assumption.
While the test should hold throughout, we have to limit it to 'reasonable' degrees, because we have to create the spline over a range sufficiently large to make margin errors disappear, so even if we want to, say, only look at the spline's values between 0 and 1, we have to have a few ten or even 100 values to the left and right of this interval, because the polynomial does not exhibit convenient features like periodicity or mirroring on the bounds. But since a polynomial, outside [-1,1], grows with the power of it's degree, the values around the test interval become very large very quickly with high degrees. We can't reasonable expect to calculate a meaningful spline over such data. The test shows how the measured fidelity degrades with higher degrees due to this effect.
still , with 'reasonable' degrees, we see that the spline fits the signal very well indeed, demonstrating that the spline can faithfully represent a polynomial of equal degree.
Definition in file verify.cc.