vspline 1.1.0
Generic C++11 Code for Uniform B-Splines
Public Types | Public Member Functions | List of all members
vspline::broadcast< derived_type, IN, OUT, _vsize > Struct Template Reference

struct broadcast is a mixin providing an 'eval' method to a functor which can process vectorized arguments. This mixin is inherited by the functor missing that capability, using CRTP. Because here, in the providing class, nothing is known (or, even, knowable) about the functor, we need to pass additional template arguments to establish the usual vspline unary functor frame of reference, namely in_type, out_type, vsize etc. The resulting 'vectorized' eval may not be efficient: it has to build individual 'in_type' values from the vectorized input, process them with the derived functor's eval routine, then insert the resulting out_type in the vectorized output. But it's a quick way of getting vectorized evaluation capability without writing the vector code. This is particularly useful when the functor's unvectorized eval() is complex (like, calling into legacy code or even into opaque binary) and 'proper' vectorization is hard to do. And with a bit of luck, the optimizer 'recognizes' what's going on and produces SIMD code anyway. Note that the derived class needs a using declaration for the vectorized eval overload inherited from this base class - see broadcast_type (below) for an example of using this mixin. More...

#include <unary_functor.h>

Inheritance diagram for vspline::broadcast< derived_type, IN, OUT, _vsize >:
vspline::unary_functor< IN, IN, vspline::vector_traits< IN > ::size > vspline::unary_functor_tag< _vsize >

Public Types

typedef vspline::unary_functor< IN, OUT, _vsize > base_type
 
typedef IN in_type
 
typedef OUT out_type
 
typedef vspline::vector_traits< IN >::ele_type in_ele_type
 
typedef vspline::vector_traits< OUT >::ele_type out_ele_type
 
typedef vigra::TinyVector< in_ele_type, dim_inin_nd_ele_type
 
typedef vigra::TinyVector< out_ele_type, dim_outout_nd_ele_type
 
typedef vector_traits< IN, vsize >::type in_v
 vectorized in_type and out_type. vspline::vector_traits supplies these types so that multidimensional/multichannel data come as vigra::TinyVectors, while 'singular' data won't be made into TinyVectors of one element. More...
 
typedef vector_traits< OUT, vsize >::type out_v
 
typedef vector_traits< IN, vsize >::ele_v in_ele_v
 a simdized type of the elementary type of result_type, which is used for coefficients and results. this is fixed via the traits class vector_traits (in vector.h). Note how we derive this type using vsize from the template argument, not what vspline::vector_traits deems appropriate for ele_type - though both numbers will be the same in most cases. More...
 
typedef vector_traits< OUT, vsize >::ele_v out_ele_v
 
typedef vector_traits< IN, vsize >::nd_ele_v in_nd_ele_v
 
typedef vector_traits< OUT, vsize >::nd_ele_v out_nd_ele_v
 
- Public Types inherited from vspline::unary_functor< IN, IN, vspline::vector_traits< IN > ::size >
enum  
 
enum  
 
enum  
 
typedef IN in_type
 
typedef IN out_type
 
typedef vspline::vector_traits< IN >::ele_type in_ele_type
 
typedef vspline::vector_traits< IN >::ele_type out_ele_type
 
typedef vigra::TinyVector< in_ele_type, dim_inin_nd_ele_type
 
typedef vigra::TinyVector< out_ele_type, dim_outout_nd_ele_type
 
typedef vector_traits< IN, vsize >::ele_v in_ele_v
 a simdized type of the elementary type of result_type, which is used for coefficients and results. this is fixed via the traits class vector_traits (in vector.h). Note how we derive this type using vsize from the template argument, not what vspline::vector_traits deems appropriate for ele_type - though both numbers will be the same in most cases. More...
 
typedef vector_traits< IN, vsize >::ele_v out_ele_v
 
typedef vector_traits< IN, vsize >::nd_ele_v in_nd_ele_v
 
typedef vector_traits< IN, vsize >::nd_ele_v out_nd_ele_v
 
typedef vector_traits< IN, vsize >::type in_v
 vectorized in_type and out_type. vspline::vector_traits supplies these types so that multidimensional/multichannel data come as vigra::TinyVectors, while 'singular' data won't be made into TinyVectors of one element. More...
 
typedef vector_traits< IN, vsize >::type out_v
 
typedef vector_traits< int, vsize >::ele_v ic_v
 vsize wide vector of ints, used for gather/scatter indexes More...
 

Public Member Functions

template<typename = std::enable_if < ( vsize > 1 ) >>
void eval (const in_v &inv, out_v &outv) const
 

Additional Inherited Members

- Static Public Attributes inherited from vspline::unary_functor< IN, IN, vspline::vector_traits< IN > ::size >
static const bool has_capped_eval
 

Detailed Description

template<class derived_type, typename IN, typename OUT = IN, size_t _vsize = vspline::vector_traits < IN > :: size>
struct vspline::broadcast< derived_type, IN, OUT, _vsize >

struct broadcast is a mixin providing an 'eval' method to a functor which can process vectorized arguments. This mixin is inherited by the functor missing that capability, using CRTP. Because here, in the providing class, nothing is known (or, even, knowable) about the functor, we need to pass additional template arguments to establish the usual vspline unary functor frame of reference, namely in_type, out_type, vsize etc. The resulting 'vectorized' eval may not be efficient: it has to build individual 'in_type' values from the vectorized input, process them with the derived functor's eval routine, then insert the resulting out_type in the vectorized output. But it's a quick way of getting vectorized evaluation capability without writing the vector code. This is particularly useful when the functor's unvectorized eval() is complex (like, calling into legacy code or even into opaque binary) and 'proper' vectorization is hard to do. And with a bit of luck, the optimizer 'recognizes' what's going on and produces SIMD code anyway. Note that the derived class needs a using declaration for the vectorized eval overload inherited from this base class - see broadcast_type (below) for an example of using this mixin.

Definition at line 366 of file unary_functor.h.

Member Typedef Documentation

◆ base_type

template<class derived_type , typename IN , typename OUT = IN, size_t _vsize = vspline::vector_traits < IN > :: size>
typedef vspline::unary_functor< IN , OUT , _vsize > vspline::broadcast< derived_type, IN, OUT, _vsize >::base_type

Definition at line 369 of file unary_functor.h.

◆ in_ele_type

template<class derived_type , typename IN , typename OUT = IN, size_t _vsize = vspline::vector_traits < IN > :: size>
typedef vspline::vector_traits<IN>::ele_type vspline::unary_functor< IN, OUT, _vsize >::in_ele_type

Definition at line 214 of file unary_functor.h.

◆ in_ele_v

template<class derived_type , typename IN , typename OUT = IN, size_t _vsize = vspline::vector_traits < IN > :: size>
typedef vector_traits<IN,vsize>::ele_v vspline::unary_functor< IN, OUT, _vsize >::in_ele_v

a simdized type of the elementary type of result_type, which is used for coefficients and results. this is fixed via the traits class vector_traits (in vector.h). Note how we derive this type using vsize from the template argument, not what vspline::vector_traits deems appropriate for ele_type - though both numbers will be the same in most cases.

Definition at line 240 of file unary_functor.h.

◆ in_nd_ele_type

template<class derived_type , typename IN , typename OUT = IN, size_t _vsize = vspline::vector_traits < IN > :: size>
typedef vigra::TinyVector< in_ele_type , dim_in > vspline::unary_functor< IN, OUT, _vsize >::in_nd_ele_type

Definition at line 224 of file unary_functor.h.

◆ in_nd_ele_v

template<class derived_type , typename IN , typename OUT = IN, size_t _vsize = vspline::vector_traits < IN > :: size>
typedef vector_traits<IN,vsize>::nd_ele_v vspline::unary_functor< IN, OUT, _vsize >::in_nd_ele_v

Definition at line 247 of file unary_functor.h.

◆ in_type

template<class derived_type , typename IN , typename OUT = IN, size_t _vsize = vspline::vector_traits < IN > :: size>
typedef IN vspline::unary_functor< IN, OUT, _vsize >::in_type

Definition at line 208 of file unary_functor.h.

◆ in_v

template<class derived_type , typename IN , typename OUT = IN, size_t _vsize = vspline::vector_traits < IN > :: size>
typedef vector_traits<IN,vsize>::type vspline::unary_functor< IN, OUT, _vsize >::in_v

vectorized in_type and out_type. vspline::vector_traits supplies these types so that multidimensional/multichannel data come as vigra::TinyVectors, while 'singular' data won't be made into TinyVectors of one element.

Definition at line 254 of file unary_functor.h.

◆ out_ele_type

template<class derived_type , typename IN , typename OUT = IN, size_t _vsize = vspline::vector_traits < IN > :: size>
typedef vspline::vector_traits<OUT>::ele_type vspline::unary_functor< IN, OUT, _vsize >::out_ele_type

Definition at line 215 of file unary_functor.h.

◆ out_ele_v

template<class derived_type , typename IN , typename OUT = IN, size_t _vsize = vspline::vector_traits < IN > :: size>
typedef vector_traits<OUT,vsize>::ele_v vspline::unary_functor< IN, OUT, _vsize >::out_ele_v

Definition at line 241 of file unary_functor.h.

◆ out_nd_ele_type

template<class derived_type , typename IN , typename OUT = IN, size_t _vsize = vspline::vector_traits < IN > :: size>
typedef vigra::TinyVector< out_ele_type , dim_out > vspline::unary_functor< IN, OUT, _vsize >::out_nd_ele_type

Definition at line 225 of file unary_functor.h.

◆ out_nd_ele_v

template<class derived_type , typename IN , typename OUT = IN, size_t _vsize = vspline::vector_traits < IN > :: size>
typedef vector_traits<OUT,vsize>::nd_ele_v vspline::unary_functor< IN, OUT, _vsize >::out_nd_ele_v

Definition at line 248 of file unary_functor.h.

◆ out_type

template<class derived_type , typename IN , typename OUT = IN, size_t _vsize = vspline::vector_traits < IN > :: size>
typedef OUT vspline::unary_functor< IN, OUT, _vsize >::out_type

Definition at line 209 of file unary_functor.h.

◆ out_v

template<class derived_type , typename IN , typename OUT = IN, size_t _vsize = vspline::vector_traits < IN > :: size>
typedef vector_traits<OUT,vsize>::type vspline::unary_functor< IN, OUT, _vsize >::out_v

Definition at line 255 of file unary_functor.h.

Member Function Documentation

◆ eval()

template<class derived_type , typename IN , typename OUT = IN, size_t _vsize = vspline::vector_traits < IN > :: size>
template<typename = std::enable_if < ( vsize > 1 ) >>
void vspline::broadcast< derived_type, IN, OUT, _vsize >::eval ( const in_v inv,
out_v outv 
) const
inline

Definition at line 396 of file unary_functor.h.


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