qt_allpairs(3)

πŸ“¦ version 1.22^20251007gitcedb1fc, in fedora 43, fedora 44

πŸ’– qt_allpairs β€” the libqthread era πŸ’–

okay bestie, gather round, because we're talking about qt_allpairs and qt_allpairs_output from libqthread, and honestly? it's giving "i do one job and i do it flawlessly" energy. ✨


🌸 NAME 🌸

qt_allpairs, qt_allpairs_output β€” computes a given function over all pairs of the input data. that's it, that's the whole vibe. every pair. no skips. no cap. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <qthread/allpairs.h>

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

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

like… look at those signatures. iconic. no notes. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, bestie. πŸ“

The All-Pairs abstraction takes, as input, two sets of data β€” that's array1 and array2 β€” plus a "combination" function called distfunc that accepts two elements as input, one from each data set. Then that function gets applied to all pairs of elements from the two sets. every single combination. the whole grid. no leftovers.

and the ✨magic✨ part? the computation happens in locations influenced by the location of the input data. so it's smart about where the work lands. main character scheduling energy, fr fr. πŸ’«

the distfunc function must match this prototype β€” like, this is non-negotiable, it's the dress code:

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

now, there are two forms of the All-Pairs abstraction, and you gotta pick your fighter:

  • qt_allpairs β€” this one leaves the output to the user. you want the results? you handle the results. DIY queen. 🫢
  • qt_allpairs_output β€” this one handles collecting the output for you. so helpful of her.

for that second one, heads up: the output must be a pointer to a two-dimensional array, and outsize specifies the size of the elements within that array. don't forget it, or it's giving chaos. 😭


🌈 SEE ALSO 🌈

  • qarray(3) β€” go read her too, she's part of the squad πŸ’œ

and that's the whole page, bestie!! this one came from libqthread, dated OCTOBER 2009 β€” yes, she's a vintage icon, a little time capsule, and she still ate. πŸ’…βœ¨ stay hydrated, read your manpages, and remember: every pair deserves to be computed. periodt. πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from