Function necsim::cantorPairing

Function Documentation

unsigned long necsim::cantorPairing(const unsigned long &x1, const unsigned long &x2)

Generates a unique ID for the pair of provided parameters.

Maps ZxZ -> N, so only relevant for positive numbers. For any A and B, generates C such that no D and E produce C unless D=A and B=E.

Return
a unique reference for the two provided integers
Parameters
  • x1: the first integer reference
  • x2: the second integer reference