Function necsim::elegantPairing

Function Documentation

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

A more elegant version of cantor pairing, which allows for storing of a greater number of digits without experiencing integer overflow issues.

Note
For scenarios when performance is critical, and the integers are known to be small, cantorPairing provides equivalent functionality.
Return
Parameters
  • x1: the first integer
  • x2: