gmpy
gmpy copied to clipboard
patch: mpz_bitcount, faster mpmath_normalize
In the attached patch there is mpz_bitcount, which is an optimized version
of bit_length which accepts only mpz; in mpmath bitcount has almost always
mpz as argument, so this provides some speedup. Another speedup
comes optimizing input processing in mpmath_normalize.
In issue 94 in http://groups.google.com/group/mpmath-issues
there is a patch to libmpf.py to be used with this patch.
The speedup in runtests is 5% on my Athlon XP 2600.
Original issue reported on code.google.com by [email protected]
on 13 Jan 2009 at 12:14
Attachments:
Added exception handling when mpmath_normalize has wrong number of arguments.
Now mpmath is predisposed for using bitcount1 = gmpy.mpz_bitcount
Original comment by [email protected]
on 13 Jan 2009 at 5:36
Attachments:
Thanks for patches. I did change the name to _mpmath_bitcount. You had that
name in
the doc string, too. I didn't want to cause any confusion with bit_length. I
should
have the patches committed later this evening.
We would like to release gmpy 1.04 within a few days. Are you working on other
patches?
Original comment by casevh
on 14 Jan 2009 at 6:13
- Changed state: Started
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
Sorry I didn't answer before; I didn't see the last line of your message.
I am translating the basic arithmetic operations in libmpf.
Original comment by [email protected]
on 22 Jan 2009 at 5:13
In this patch there is a bug fix for _mpmath_bitcount for the case of n=0,
see issue 94 in mpmath.
Original comment by [email protected]
on 23 Jan 2009 at 7:44
Attachments:
In issue 94 of mpmath Fredrik suggested to drop _mpmath_bitcount, optimizing
instead bit_length. Indeed it can be optimized; I put there a version of
bit_length which is only 4% slower than _mpmath_bitcount; I would like to work
on this a bit before submitting it here, but anyway, I am in favour of dropping
_mpmath_bitcount.
Original comment by [email protected]
on 25 Jan 2009 at 10:01