STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Public Member Functions
stapl::dist_spec_impl::index_times_lower_dim_size< Last, Iteration > Struct Template Reference

Implements the linearization of a multidimensional id to a scalar. More...

Public Member Functions

template<typename Index , typename Size >
std::pair< typename tuple_element< 0, Index >::type, typename tuple_element< 0, Size >::type > operator() (Index const &id, Size const &size)
 

Detailed Description

template<int Last, int Iteration = Last>
struct stapl::dist_spec_impl::index_times_lower_dim_size< Last, Iteration >

Implements the linearization of a multidimensional id to a scalar.

The linearization is the sum of the products of each element of the index and all lower-dimension elements of the size. For example, index (2,0,1) given size (4, 2, 3) would linearize to 2*3*2 + 0*3 + 1 = 13.

Two template parameters are used to allow the linearization to be performed in a linear number of instances. The instantiations traverse down to the innermost dimension, and then in the returns construct the product and sum on the fly. This struct is used in all but the first and last instance.


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