vspline 1.1.0
Generic C++11 Code for Uniform B-Splines
|
Go to the source code of this file.
Functions | |
int | main (int argc, char *argv[]) |
gradient.cc More... | |
int main | ( | int | argc, |
char * | argv[] | ||
) |
If we create a b-spline over an array containing, at each grid point, the sum of the grid point's coordinates, each 1D row, column, etc will hold a linear gradient with first derivative == 1. If we use NATURAL BCs, evaluating the spline with real coordinates anywhere inside the defined range should produce precisely the sum of the coordinates. This is a good test for both the precision of the evaluation and it's correct functioning, particularly with higher-D arrays.
In this variant of the program, we use a vspline::domain functor. This functor provides a handy way to access a b-spline with normalized coordinates: instead of evaluating coordinates in the range of [ 0 , core_shape - 1 ] (natural spline coordinates), we pass coordinates in the range of [ 0 , 1 ] to the domain object, which is chained to the evaluator and passes natural spline coordinates to it.
compile: clang++ -O3 -DUSE_VC -march=native -std=c++11 -pthread \ -o gradient2 gradient2.cc -lVc (with Vc; use -DUSE_HWY and -lhwy for highway, or -std=c++17 and -DUSE_STDSIMD for the std::simd backend) or clang++ -O3 -march=native -std=c++11 -pthread -o gradient2 gradient2.cc
Definition at line 60 of file gradient2.cc.