vspline 1.1.0
Generic C++11 Code for Uniform B-Splines
|
tries to fathom vspline's scope More...
#include <vigra/multi_array.hxx>
#include <vigra/accumulator.hxx>
#include <vigra/multi_math.hxx>
#include <iostream>
#include <typeinfo>
#include <random>
#include <vspline/vspline.h>
Go to the source code of this file.
Macros | |
#define | ast(x) std::integral_constant<int,x> |
#define | CF_DIM_MAX 2 |
#define | TRG_DIM_MAX 2 |
#define | CHN_MAX 2 |
Typedefs | |
template<class T > | |
using | is_singular = typename std::conditional< std::is_fundamental< T > ::value, std::true_type, std::false_type > ::type |
Functions | |
template<typename T > | |
double | condense (const T &t, std::true_type) |
template<typename T > | |
double | condense (const T &t, std::false_type) |
template<typename T > | |
double | condense (const std::complex< T > &t, std::false_type) |
template<typename T > | |
double | condense (const T &t) |
template<unsigned int dim, typename T > | |
double | check_diff (vigra::MultiArrayView< dim, T > &reference, vigra::MultiArrayView< dim, T > &candidate, double value_extent) |
template<unsigned int cf_dim, unsigned int trg_dim, int chn, int vsz, typename rc_type , typename ele_type , typename math_ele_type > | |
void | test (int spline_degree=3, vspline::bc_code bc=vspline::MIRROR) |
template<typename vsz_t , typename chn_t , typename trg_dim_t , typename cf_dim_t , typename ... other_types> | |
void | doit () |
template<typename ... other_types> | |
void | set_vsz (int vsz) |
template<typename ... other_types> | |
void | set_chn (int chn, int vsz) |
template<typename ... other_types> | |
void | set_trg_dim (int trg_dim, int chn, int vsz) |
template<typename ... other_types> | |
void | set_cf_dim (int cf_dim, int trg_dim, int chn, int vsz) |
int | main (int argc, char *argv[]) |
Variables | |
bool | verbose = true |
tries to fathom vspline's scope
vspline is very flexible when it comes to types and other compile-time issues. It's not really feasible to instantiate every single possible combination of compile-time parameters, but this program is an attempt to test a few relevant ones, specifically for vspline's 'higher' API, namely classes bspline and evaluator, and the functions in transform.h.
We test data in 1, 2 and 3 dimensions. For individual values, we use plain fundamentals and TinyVectors of two and three fundamentals, with the fundamental types float, double and long double. Wherever possible, we perform the tests with several vectorization widths, to make sure that the wielding code performs as expected.
For every such combination, we perform this test sequence:
On my system, this is just about what the compiler can handle, and the compilation takes a long time. The test can be limited to smaller parameter sets, a good place to narrow the scope is by picking less rc_type/ele_type combinations in doit().
This test passes if
... vsz +5 chn +2 trg_dim +3 cf_dim +3 float crd, float value d Mean: +0.000000763713326440d Max: +0.000007158763497749 d Mean: +0.000000757349428671d Max: +0.000007168434323489 double crd, double value d Mean: +0.000000000000009688d Max: +0.000000000000899253 d Mean: +0.000000000000009681d Max: +0.000000000000899253 long double crd, long double value d Mean: +0.000000000000000001d Max: +0.000000000000000006 d Mean: +0.000000000000000001d Max: +0.000000000000000006 ...
This test does not focus on different spline degrees or boundary conditions, it's purpose is to test compile-time parametrization. But it can easily be modified to use different spline degrees and boundary conditions by passing the relevant parameters to test(); I have limited the choice to a few 'typical' combinations. Another aspect which is not tested is variation of the extents of the arrays of data involved. Other tests, like 'restore_test.cc' and 'roundtrip.cc' focus more on these run-time parameters.
Testing varying vectorization widths is for completeness' sake, normally using the defaults should give good performance.
Definition in file scope_test.cc.
#define ast | ( | x | ) | std::integral_constant<int,x> |
Definition at line 184 of file scope_test.cc.
#define CF_DIM_MAX 2 |
Definition at line 608 of file scope_test.cc.
#define CHN_MAX 2 |
Definition at line 610 of file scope_test.cc.
#define TRG_DIM_MAX 2 |
Definition at line 609 of file scope_test.cc.
using is_singular = typename std::conditional < std::is_fundamental < T > :: value , std::true_type , std::false_type > :: type |
Definition at line 131 of file scope_test.cc.
double check_diff | ( | vigra::MultiArrayView< dim, T > & | reference, |
vigra::MultiArrayView< dim, T > & | candidate, | ||
double | value_extent | ||
) |
Definition at line 151 of file scope_test.cc.
double condense | ( | const std::complex< T > & | t, |
std::false_type | |||
) |
Definition at line 125 of file scope_test.cc.
double condense | ( | const T & | t | ) |
Definition at line 139 of file scope_test.cc.
double condense | ( | const T & | t, |
std::false_type | |||
) |
Definition at line 119 of file scope_test.cc.
double condense | ( | const T & | t, |
std::true_type | |||
) |
Definition at line 113 of file scope_test.cc.
void doit | ( | ) |
Definition at line 458 of file scope_test.cc.
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 612 of file scope_test.cc.
void set_cf_dim | ( | int | cf_dim, |
int | trg_dim, | ||
int | chn, | ||
int | vsz | ||
) |
Definition at line 593 of file scope_test.cc.
void set_chn | ( | int | chn, |
int | vsz | ||
) |
Definition at line 558 of file scope_test.cc.
void set_trg_dim | ( | int | trg_dim, |
int | chn, | ||
int | vsz | ||
) |
Definition at line 577 of file scope_test.cc.
void set_vsz | ( | int | vsz | ) |
Definition at line 533 of file scope_test.cc.
void test | ( | int | spline_degree = 3 , |
vspline::bc_code | bc = vspline::MIRROR |
||
) |
Definition at line 196 of file scope_test.cc.
bool verbose = true |
Definition at line 108 of file scope_test.cc.