vspline 1.1.0
Generic C++11 Code for Uniform B-Splines
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type > Struct Template Reference

'inner_evaluator' implements evaluation of a uniform b-spline, or some other spline-like construct relying on basis functions which can provide sets of weights for given deltas. While class evaluator (below, after namespace detail ends) provides objects derived from vspline::unary_functor which are meant to be used by user code, here we have a 'workhorse' object to which 'evaluator' delegates. This code 'rolls out' the per-axis weights the basis functor produces to the set of coefficients relevant to the current evaluation locus (the support window). We rely on a few constraints: More...

#include <eval.h>

Public Types

enum  { dimension = _dimension }
 
enum  { level = dimension - 1 }
 
enum  { channels = _channels }
 
enum  { specialize = _specialize }
 
typedef _ic_ele_type ic_ele_type
 
typedef _rc_ele_type rc_ele_type
 
typedef _ofs_ele_type ofs_ele_type
 
typedef _cf_ele_type cf_ele_type
 
typedef _math_ele_type math_ele_type
 
typedef _trg_ele_type trg_ele_type
 
typedef vigra::TinyVector< ic_ele_type, dimensionic_type
 
typedef vigra::TinyVector< rc_ele_type, dimensionrc_type
 
typedef ofs_ele_type ofs_type
 
typedef vigra::TinyVector< cf_ele_type, channelscf_type
 
typedef vigra::TinyVector< math_ele_type, channelsmath_type
 
typedef vigra::TinyVector< trg_ele_type, channelstrg_type
 
typedef vigra::TinyVector< std::ptrdiff_t, dimensionshape_type
 
typedef vigra::TinyVector< int, dimensionderivative_spec_type
 
typedef _mbf_type mbf_type
 

Public Member Functions

template<class IT , class RT >
void split (const RT &input, IT &select, RT &tune) const
 split function. This function is used to split incoming real coordinates into an integral and a remainder part, which are used at the core of the evaluation. selection of even or odd splitting is done via the const bool flag 'even_spline_degree'. My initial implementation had this flag as a template argument, but this way it's more flexible and there seems to be no runtime penalty. This method delegates to the free function templates even_split and odd_split, respectively, which are defined in basis.h. More...
 
const int & get_order () const
 
const int & get_degree () const
 
const shape_typeget_estride () const
 
 inner_evaluator (const cf_ele_type *const _cf_ebase, const shape_type &_cf_estride, int _spline_degree, const mbf_type &_wgt)
 inner_evaluator only has a single constructor, which takes these arguments: More...
 
template<typename nd_rc_type , typename weight_type >
void obtain_weights (vigra::MultiArrayView< 2, weight_type > &weight, const nd_rc_type &c) const
 obtain_weights calculates the weights to be applied to a section of the coefficients from the fractional parts of the split coordinates. What is calculated here is the evaluation of the spline's basis function at dx, dx+/-1 ... but doing it naively is computationally expensive, as the evaluation of the spline's basis function at arbitrary values has to look at the value, find out the right interval, and then calculate the value with the appropriate function. But we always have to calculate the basis function for all intervals anyway, and the method used here performs this tasks efficiently using a vector/matrix multiplication. If the spline is more than 1-dimensional, we need a set of weights for every dimension. The weights are accessed through a 2D MultiArrayView. For every dimension, there are spline_order weights. Note that this code will process unvectorized and vectorized data alike - hence the template arguments. note that wgt[axis] contains a 'basis_functor' object (see basis.h) which encodes the generation of the set of weights. More...
 
template<typename weight_type >
void obtain_weights (vigra::MultiArrayView< 2, weight_type > &weight) const
 
template<typename rc_type , typename weight_type >
void obtain_weights (weight_type *p_weight, const int &axis, const rc_type &c) const
 obtain weight for a single axis More...
 
template<typename weight_type >
void obtain_weights (weight_type *p_weight, const int &axis) const
 
template<class result_type , class math1_type , class offset_type >
void eval (const offset_type &select, const vigra::MultiArrayView< 2, math1_type > &weight, result_type &result) const
 the 'innermost' eval routine is called with offset(s) and weights. This routine is public because it is used from outside (namely by grid_eval). In this final delegate we call the workhorse code in class _eval More...
 
template<template< typename, int > class bunch, template< typename, size_t > class vector, size_t vsize>
void eval (const bunch< vector< rc_ele_type, vsize >, dimension > &coordinate, bunch< vector< trg_ele_type, vsize >, channels > &result, std::false_type) const
 while class evaluator accepts the argument signature of a vspline::unary_functor, class inner_evaluator uses 'synthetic' types, which are always TinyVectors - possibly of just one element. This simplifies the code, since the 'singular' arguments don't have to be treated separately. The data are just the same in memory and class evaluator simply reinterpret_casts the arguments it receives to the 'synthetic' types. Another effect of moving to the 'synthetic' types is to 'erase' their type: any 'meaning' they may have, like std::complex etc., is removed - they are treated as 'bunches' of a fundamental type or a vector. The synthetic types are built using a combination of two template template arguments: 'bunch' and 'vector': More...
 
template<template< typename, int > class bunch, template< typename, size_t > class vector, size_t vsize>
void ieval (const bunch< vector< ic_ele_type, vsize >, dimension > &select, bunch< vector< trg_ele_type, vsize >, channels > &result, std::false_type) const
 first ieval overload taking discrete coordinates, implying a 'delta' of zero. this overload is for 'uspecialized' evaluation. Here we use the call to obtain_weights without a delta, which simply takes only the first line of the weight matrix, which is precisely what obtain_weights would produce with a delta of zero. More...
 
template<template< typename, int > class bunch, template< typename, size_t > class vector, size_t vsize>
void ieval (const bunch< vector< ic_ele_type, vsize >, dimension > &select, bunch< vector< trg_ele_type, vsize >, channels > &result, std::true_type) const
 second ieval overload taking discrete coordinates, implying a 'delta' of zero. this overload is for evaluators specialized to 0 or 1, where we can simply load the coefficients and don't need weights: the support is so narrow that we needn't consider neighbouring coefficients More...
 
template<template< typename, int > class bunch, template< typename, size_t > class vector, size_t vsize>
void eval (const bunch< vector< ic_ele_type, vsize >, dimension > &select, bunch< vector< trg_ele_type, vsize >, channels > &result, std::true_type) const
 this overload is taken for discrete coordinates, and dispatches again, depending on the evaluator's 'specialize' template argument, to one of two variants of 'ieval', above More...
 
template<template< typename, int > class bunch, template< typename, size_t > class vector, size_t vsize>
void eval (const bunch< vector< rc_ele_type, vsize >, dimension > &select, bunch< vector< trg_ele_type, vsize >, channels > &result) const
 initial dispatch on whether incoming coordinates are discrete or real More...
 

Public Attributes

const mbf_type wgt
 
const int spline_degree
 
const int spline_order
 
const int window_size
 size of the window of coefficients contributing to a single evaluation. This equals 'spline_order' to the power of 'dimension'. More...
 

Detailed Description

template<typename _ic_ele_type, typename _rc_ele_type, typename _ofs_ele_type, typename _cf_ele_type, typename _math_ele_type, typename _trg_ele_type, unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
struct vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >

'inner_evaluator' implements evaluation of a uniform b-spline, or some other spline-like construct relying on basis functions which can provide sets of weights for given deltas. While class evaluator (below, after namespace detail ends) provides objects derived from vspline::unary_functor which are meant to be used by user code, here we have a 'workhorse' object to which 'evaluator' delegates. This code 'rolls out' the per-axis weights the basis functor produces to the set of coefficients relevant to the current evaluation locus (the support window). We rely on a few constraints:

TODO: investigate generalization to variable degree basis functors and nD kernels which aren't separable, like RBFs

The template arguments are, first, the elementary types (e.t.) of the types involved, then several non-type template arguments fixing aggregate sizes. inner_evaluator only uses 'synthetic' types devoid of any specific meaning, so while class evaluator might accept types like 'std::complex<float>' or 'double' class inner_evaluator would instead accept the synthetic types vigra::TinyVector<float,2> and vigra::TinyVector<double,1>.

Note the name system used for the types. first prefixes:

User code will not usually create and handle objects of class inner_evaluator, but to understand the code, it's necessary to know the meaning of the template arguments for class inner_evaluator:

Definition at line 499 of file eval.h.

Member Typedef Documentation

◆ cf_ele_type

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
typedef _cf_ele_type vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::cf_ele_type

Definition at line 513 of file eval.h.

◆ cf_type

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
typedef vigra::TinyVector< cf_ele_type , channels > vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::cf_type

Definition at line 532 of file eval.h.

◆ derivative_spec_type

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
typedef vigra::TinyVector< int , dimension > vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::derivative_spec_type

Definition at line 537 of file eval.h.

◆ ic_ele_type

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
typedef _ic_ele_type vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::ic_ele_type

Definition at line 509 of file eval.h.

◆ ic_type

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
typedef vigra::TinyVector< ic_ele_type , dimension > vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::ic_type

Definition at line 528 of file eval.h.

◆ math_ele_type

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
typedef _math_ele_type vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::math_ele_type

Definition at line 514 of file eval.h.

◆ math_type

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
typedef vigra::TinyVector< math_ele_type , channels > vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::math_type

Definition at line 533 of file eval.h.

◆ mbf_type

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
typedef _mbf_type vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::mbf_type

Definition at line 538 of file eval.h.

◆ ofs_ele_type

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
typedef _ofs_ele_type vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::ofs_ele_type

Definition at line 511 of file eval.h.

◆ ofs_type

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
typedef ofs_ele_type vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::ofs_type

Definition at line 530 of file eval.h.

◆ rc_ele_type

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
typedef _rc_ele_type vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::rc_ele_type

Definition at line 510 of file eval.h.

◆ rc_type

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
typedef vigra::TinyVector< rc_ele_type , dimension > vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::rc_type

Definition at line 529 of file eval.h.

◆ shape_type

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
typedef vigra::TinyVector< std::ptrdiff_t , dimension > vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::shape_type

Definition at line 536 of file eval.h.

◆ trg_ele_type

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
typedef _trg_ele_type vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::trg_ele_type

Definition at line 515 of file eval.h.

◆ trg_type

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
typedef vigra::TinyVector< trg_ele_type , channels > vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::trg_type

Definition at line 534 of file eval.h.

Member Enumeration Documentation

◆ anonymous enum

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
anonymous enum
Enumerator
dimension 

Definition at line 517 of file eval.h.

◆ anonymous enum

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
anonymous enum
Enumerator
level 

Definition at line 518 of file eval.h.

◆ anonymous enum

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
anonymous enum
Enumerator
channels 

Definition at line 519 of file eval.h.

◆ anonymous enum

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
anonymous enum
Enumerator
specialize 

Definition at line 520 of file eval.h.

Constructor & Destructor Documentation

◆ inner_evaluator()

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::inner_evaluator ( const cf_ele_type *const  _cf_ebase,
const shape_type _cf_estride,
int  _spline_degree,
const mbf_type _wgt 
)
inline

inner_evaluator only has a single constructor, which takes these arguments:

  • _cf_ebase: pointer to the origin of the coefficient array, expressed as a pointer to the coefficients' elementary type. 'origin' here means the memory location coinciding with the origin of the knot point data, which coincides with a bspline object's 'core', not the origin of a bspline object's 'container'. Nevertheless, the data have to be suitably 'braced' - evaluation may well fail (spectacularly) if the brace is absent, please refer to class bspline's documentation.
  • _cf_estride: the stride(s) of the coefficient array, expressed in units of the coefficients' elementary type.
  • _spline_degree: the degree of the b-spline. this can be up to 45 currently. See the remarks on 'shifting' in the documentation of class evaluator below.

Definition at line 633 of file eval.h.

Member Function Documentation

◆ eval() [1/4]

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
template<template< typename, int > class bunch, template< typename, size_t > class vector, size_t vsize>
void vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::eval ( const bunch< vector< ic_ele_type, vsize >, dimension > &  select,
bunch< vector< trg_ele_type, vsize >, channels > &  result,
std::true_type   
) const
inline

this overload is taken for discrete coordinates, and dispatches again, depending on the evaluator's 'specialize' template argument, to one of two variants of 'ieval', above

Definition at line 1412 of file eval.h.

◆ eval() [2/4]

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
template<template< typename, int > class bunch, template< typename, size_t > class vector, size_t vsize>
void vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::eval ( const bunch< vector< rc_ele_type, vsize >, dimension > &  coordinate,
bunch< vector< trg_ele_type, vsize >, channels > &  result,
std::false_type   
) const
inline

while class evaluator accepts the argument signature of a vspline::unary_functor, class inner_evaluator uses 'synthetic' types, which are always TinyVectors - possibly of just one element. This simplifies the code, since the 'singular' arguments don't have to be treated separately. The data are just the same in memory and class evaluator simply reinterpret_casts the arguments it receives to the 'synthetic' types. Another effect of moving to the 'synthetic' types is to 'erase' their type: any 'meaning' they may have, like std::complex etc., is removed - they are treated as 'bunches' of a fundamental type or a vector. The synthetic types are built using a combination of two template template arguments: 'bunch' and 'vector':

  • 'bunch', which forms an aggregate of several of a given type, like a vigra::TinyVector, which is currently the only template used for the purpose.
  • 'vector', which represents an aggregate of several fundamentals of equal type which will be processed with SIMD logic. Currently, the templates used for the purpose are vspline::simd_type (simulating SIMD operations with ordinary scalar code), Vc::SimdArray, which is a 'proper' SIMD type, and vspline::scalar, which is used for unvectorized data. Note how 'vsize' is a template argument to this function, and not a template argument to class inner_evaluator. This is more flexible, the calling code can process any vsize with the same inner_evaluator. the last template argument is used to differentiate between 'normal' operation with real coordinates and access with discrete coordinates. Weight generation for discrete coordinates is easier, because when they are split into an integral part and a remainder, the remainder is always zero. From degree 2 up we still need to calculate weights for the evaluation, but we can use a simplified method for obtaining the weights. For degree 0 and 1, we need no weights at all, and so we can directly load and return the spline coefficients, which is just like the code for the nearest-neighbour evaluation variants, minus the coordinate splitting. First in line is the overload taking real coordinates:

Definition at line 1296 of file eval.h.

◆ eval() [3/4]

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
template<template< typename, int > class bunch, template< typename, size_t > class vector, size_t vsize>
void vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::eval ( const bunch< vector< rc_ele_type, vsize >, dimension > &  select,
bunch< vector< trg_ele_type, vsize >, channels > &  result 
) const
inline

initial dispatch on whether incoming coordinates are discrete or real

Definition at line 1431 of file eval.h.

◆ eval() [4/4]

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
template<class result_type , class math1_type , class offset_type >
void vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::eval ( const offset_type &  select,
const vigra::MultiArrayView< 2, math1_type > &  weight,
result_type &  result 
) const
inline

the 'innermost' eval routine is called with offset(s) and weights. This routine is public because it is used from outside (namely by grid_eval). In this final delegate we call the workhorse code in class _eval

Definition at line 1127 of file eval.h.

◆ get_degree()

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
const int & vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::get_degree ( ) const
inline

Definition at line 605 of file eval.h.

◆ get_estride()

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
const shape_type & vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::get_estride ( ) const
inline

Definition at line 610 of file eval.h.

◆ get_order()

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
const int & vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::get_order ( ) const
inline

Definition at line 600 of file eval.h.

◆ ieval() [1/2]

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
template<template< typename, int > class bunch, template< typename, size_t > class vector, size_t vsize>
void vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::ieval ( const bunch< vector< ic_ele_type, vsize >, dimension > &  select,
bunch< vector< trg_ele_type, vsize >, channels > &  result,
std::false_type   
) const
inline

first ieval overload taking discrete coordinates, implying a 'delta' of zero. this overload is for 'uspecialized' evaluation. Here we use the call to obtain_weights without a delta, which simply takes only the first line of the weight matrix, which is precisely what obtain_weights would produce with a delta of zero.

Definition at line 1347 of file eval.h.

◆ ieval() [2/2]

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
template<template< typename, int > class bunch, template< typename, size_t > class vector, size_t vsize>
void vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::ieval ( const bunch< vector< ic_ele_type, vsize >, dimension > &  select,
bunch< vector< trg_ele_type, vsize >, channels > &  result,
std::true_type   
) const
inline

second ieval overload taking discrete coordinates, implying a 'delta' of zero. this overload is for evaluators specialized to 0 or 1, where we can simply load the coefficients and don't need weights: the support is so narrow that we needn't consider neighbouring coefficients

Definition at line 1384 of file eval.h.

◆ obtain_weights() [1/4]

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
template<typename weight_type >
void vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::obtain_weights ( vigra::MultiArrayView< 2, weight_type > &  weight) const
inline

Definition at line 762 of file eval.h.

◆ obtain_weights() [2/4]

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
template<typename nd_rc_type , typename weight_type >
void vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::obtain_weights ( vigra::MultiArrayView< 2, weight_type > &  weight,
const nd_rc_type &  c 
) const
inline

obtain_weights calculates the weights to be applied to a section of the coefficients from the fractional parts of the split coordinates. What is calculated here is the evaluation of the spline's basis function at dx, dx+/-1 ... but doing it naively is computationally expensive, as the evaluation of the spline's basis function at arbitrary values has to look at the value, find out the right interval, and then calculate the value with the appropriate function. But we always have to calculate the basis function for all intervals anyway, and the method used here performs this tasks efficiently using a vector/matrix multiplication. If the spline is more than 1-dimensional, we need a set of weights for every dimension. The weights are accessed through a 2D MultiArrayView. For every dimension, there are spline_order weights. Note that this code will process unvectorized and vectorized data alike - hence the template arguments. note that wgt[axis] contains a 'basis_functor' object (see basis.h) which encodes the generation of the set of weights.

Definition at line 753 of file eval.h.

◆ obtain_weights() [3/4]

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
template<typename weight_type >
void vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::obtain_weights ( weight_type *  p_weight,
const int &  axis 
) const
inline

Definition at line 779 of file eval.h.

◆ obtain_weights() [4/4]

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
template<typename rc_type , typename weight_type >
void vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::obtain_weights ( weight_type *  p_weight,
const int &  axis,
const rc_type c 
) const
inline

obtain weight for a single axis

Definition at line 771 of file eval.h.

◆ split()

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
template<class IT , class RT >
void vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::split ( const RT &  input,
IT &  select,
RT &  tune 
) const
inline

split function. This function is used to split incoming real coordinates into an integral and a remainder part, which are used at the core of the evaluation. selection of even or odd splitting is done via the const bool flag 'even_spline_degree'. My initial implementation had this flag as a template argument, but this way it's more flexible and there seems to be no runtime penalty. This method delegates to the free function templates even_split and odd_split, respectively, which are defined in basis.h.

Definition at line 592 of file eval.h.

Member Data Documentation

◆ spline_degree

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
const int vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::spline_degree

Definition at line 575 of file eval.h.

◆ spline_order

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
const int vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::spline_order

Definition at line 576 of file eval.h.

◆ wgt

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
const mbf_type vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::wgt

Definition at line 573 of file eval.h.

◆ window_size

template<typename _ic_ele_type , typename _rc_ele_type , typename _ofs_ele_type , typename _cf_ele_type , typename _math_ele_type , typename _trg_ele_type , unsigned int _dimension, unsigned int _channels, int _specialize, typename _mbf_type = multi_bf_type < basis_functor < _math_ele_type > , _dimension >>
const int vspline::detail::inner_evaluator< _ic_ele_type, _rc_ele_type, _ofs_ele_type, _cf_ele_type, _math_ele_type, _trg_ele_type, _dimension, _channels, _specialize, _mbf_type >::window_size

size of the window of coefficients contributing to a single evaluation. This equals 'spline_order' to the power of 'dimension'.

Definition at line 581 of file eval.h.


The documentation for this struct was generated from the following file: