Table of Contents


qt_allpairs, qt_allpairs_output - computes a given function over all pairs of the input data


#include <qthread/allpairs.h>

qt_allpairs (const qarray *array1, const qarray *array2, const dist_f distfunc);

qt_allpairs_output (const qarray *array1, const qarray *array2, const dist_out_f distfunc, void *restrict *restrict output, const size_t outsize);


The All-Pairs abstraction takes as input two sets of data (array1 and array2) and a "combination" function (distfunc) that accepts two elements as input, one from each data set. This function is then applied to all pairs of elements from the two sets. The computation occurs in locations influenced by the location of the input data.

The distfunc function must match the following prototype:

int distfunc (void *a, void *b);

There are two forms of the All-Pairs abstraction: one (qt_allpairs)thatleavestheoutputtotheuser,andone (qt_allpairs_output) that handles collecting the output. In the latter case, the output must be a pointer to a two-dimensional array and outsize specifies the size of the elements within that array.

See Also


Table of Contents