upiterbarg / mpmath

Automatically exported from code.google.com/p/mpmath
Other
0 stars 0 forks source link

troubles using gmpy with mpmath #235

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

What steps will reproduce the problem?
1. I installed gmplib 5.1.0, mpfr 3.1.1, mpc 1.0.1, GMPY2 2.0.0b3 full source. 
2. configured and make, make install all of these. The tests were OK.
3. I ran my script:

m=2  
import os
from mpmath import *  
mp.dps=1000  
zetazeroval=zetazero(m)

What is the expected output? What do you see instead?
Reported an error

  File "zetazero.py", line 12, in <module>
    zetazeroval=zetazero(m)
  File "/usr/lib/python2.7/site-packages/mpmath/functions/zetazeros.py", line 394, in zetazero
    find_rosser_block_zero(ctx, n)

...
 File "/usr/lib/python2.7/site-packages/mpmath/libmp/libelefun.py", line 101, in g
    return f.memo_val >> (newprec-prec)
TypeError: unsupported operand type(s) for >>: 'mpfr' and 'int'

The same error was reported at many places when I ran
import mpmath
mpmath.runtests()

  File "/usr/lib/python2.7/site-packages/mpmath/libmp/libelefun.py", line 97, in g
    return f.memo_val >> (memo_prec-prec)
TypeError: unsupported operand type(s) for >>: 'mpfr' and 'int'

half the tests were passed

What version of the product are you using? On what operating system?
Fedora 16, python 2.7
gmplib 5.1.0, mpfr 3.1.1, mpc 1.0.1, GMPY2 2.0.0b3

mpmath.__version__
'0.17'
mpmath.libmp.BACKEND
'gmpy'

Please provide any additional information below.

Without gmpy calculations went fine

Original issue reported on code.google.com by gbeli...@gmail.com on 15 Mar 2013 at 11:06

GoogleCodeExporter commented 9 years ago
Can you check if this problem persists with gmpy2 2.0.0b4 (or the gmpy trunk)?

Original comment by fredrik....@gmail.com on 15 Mar 2013 at 11:37

GoogleCodeExporter commented 9 years ago
I am afraid the problem persists

Original comment by gbeli...@gmail.com on 15 Mar 2013 at 12:12

GoogleCodeExporter commented 9 years ago
Our administrator tried to install gmpy2 after mpmath, (on CentoOS) and mpmath 
stopped working:

>>> import mpmath
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/python/2.7.1-gcc/lib/python2.7/site-packages/mpmath/__init__.py", line 5, in <module>
    from .ctx_fp import FPContext
  File "/usr/local/python/2.7.1-gcc/lib/python2.7/site-packages/mpmath/ctx_fp.py", line 1, in <module>
    from .ctx_base import StandardBaseContext
  File "/usr/local/python/2.7.1-gcc/lib/python2.7/site-packages/mpmath/ctx_base.py", line 3, in <module>
    from .libmp.backend import xrange
  File "/usr/local/python/2.7.1-gcc/lib/python2.7/site-packages/mpmath/libmp/__init__.py", line 1, in <module>
    from .libmpf import (prec_to_dps, dps_to_prec, repr_dps,
  File "/usr/local/python/2.7.1-gcc/lib/python2.7/site-packages/mpmath/libmp/libmpf.py", line 20, in <module>
    from .libintmath import (giant_steps,
  File "/usr/local/python/2.7.1-gcc/lib/python2.7/site-packages/mpmath/libmp/libintmath.py", line 302, in <module>
    sqrtrem = gmpy.sqrtrem
AttributeError: 'module' object has no attribute 'sqrtrem'

it has gmp/5.1.0 and mpfr 3.1.1

Original comment by gbeli...@gmail.com on 15 Mar 2013 at 2:25

GoogleCodeExporter commented 9 years ago
Thanks. I will investigate.

Original comment by fredrik....@gmail.com on 15 Mar 2013 at 3:23

GoogleCodeExporter commented 9 years ago
Ah, this should already be fixed in the git repository.

Can you check if a source checkout https://github.com/fredrik-johansson/mpmath 
works?

Original comment by fredrik....@gmail.com on 15 Mar 2013 at 5:55

GoogleCodeExporter commented 9 years ago
After I got the code from git, it seems to have fixed the problem
Thanks!

Original comment by gbeli...@gmail.com on 16 Mar 2013 at 1:21