flintlib / calcium

Calcium has been merged into FLINT -- use https://github.com/flintlib/flint/ instead
http://fredrikj.net/calcium/
GNU Lesser General Public License v2.1
79 stars 11 forks source link

Number hash function #31

Open fredrik-johansson opened 3 years ago

fredrik-johansson commented 3 years ago

There is a ca_hash_repr which hashes the internal representation of a ca_t. More interesting is to have a genuine hash function C -> Z to allow using hash tables to represent finite sets of numbers. Such a function must either be trivial (e.g. always return 0) or be allowed to fail (i.e. some numbers are unhashable).

Here is a possible algorithm:

  1. Let z = a*x+b where a, b are some fixed complex numbers. Compute a precise enclosure of z.
  2. Round the real and imaginary parts of z to 64-bit floating-point numbers with correct rounding, and return a hash of the floating-point representations.

Note: