Hashing of QQbar elements seems to be quite inefficient:
sage: R.<x> = AA[]
sage: rho = QQbar.polynomial_root(
....: x^5 - 1/3*x^4 + 1/30*x^3 - 1/600*x^2 + 1/24000*x - 1/2400000,
....: CIF(RIF(0.02, 0.03), RIF(-0.009, -0.007)))
sage: %time hash(rho)
CPU times: user 14 s, sys: 36 ms, total: 14.1 s
Wall time: 14 s
-382033038487191199
sage: %time hash(rho)
CPU times: user 9.18 s, sys: 32 ms, total: 9.21 s
Wall time: 9.12 s
-382033038487191199
It seems that the hashing code at some stage exactifies the rho.imag() (which is
an algebraic number of degree 20).
In qqbar.py, we have the comment
# All of this effort to avoid exact computation is probably wasted,
# anyway... in almost all uses of hash codes, if the hash codes
# match, the next step is to compare for equality; and comparing
# for equality often requires exact computation. (If a==b,
However, IMHO, the unfortunate thing is that rho.real() and rho.imag() are
exactified instead of rho itself (so involving higher degree numbers) and that
these results are then lost.
Any thoughts?
Regards,
Clemens
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.