[sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-18 Thread Ted Horst
I'm a little late to the party, but I just tested 0.7.0 tip and got this error (stopped testing): This is with python 2.5.1, numpy 1.5.0, no scipy, no gmpy on OSX 10.5.8 PPC (big endian). I can get the error from just importing sympy.physics.quantum.matrixcache. It makes sense because we

Re: [sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-19 Thread Aaron Meurer
Thanks for reporting this. It seems you've uncovered two bugs (the second one is that the error killed the test runner). I'll see if I can figure out how to fix at least the numpy one for the release. Do you know how to fix it? If so, please send a pull request. Aaron Meurer On Sat, Jun 18, 2

Re: [sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-19 Thread Aaron Meurer
I don't know much about numpy, so this one has me stumped. For some reason numpy.matrix([[0, I]], dtype='complex') fails in Python 2.5 (with the above error), but not in Python 2.6 or 2.7 (I is sympy.I). Can someone with numpy knowledge give any insight here? Otherwise, I think the solution migh

Re: [sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-19 Thread Aaron Meurer
On Sun, Jun 19, 2011 at 7:32 PM, Aaron Meurer wrote: > I don't know much about numpy, so this one has me stumped.  For some > reason numpy.matrix([[0, I]], dtype='complex') fails in Python 2.5 > (with the above error), but not in Python 2.6 or 2.7 (I is sympy.I). > > Can someone with numpy knowled

Re: [sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-19 Thread Aaron Meurer
I think I have a lead. In numpy 1.6, this instead gives >>> numpy.matrix([[0, I]], dtype='complex') Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/matrixlib/defmatrix.py", line 257, in __new__

Re: [sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-19 Thread Aaron Meurer
OK, this is definitely a bug in numpy (or Python). I created a file numpyfloattest.py with the following contents: import numpy class A(object): def __float__(self): return 2.0 def __complex__(self): return 5.0j a = A() print numpy.matrix([[a]], dtype='complex') And ra

Re: [sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-19 Thread Aaron Meurer
The way the quantum code is written, it's not very easy to disable numpy globally. I could do it, but it would require copying the same four lines checking the system version and emitting a warning in the half dozen files that import numpy. So, to fix this right, I need advice from Brian and othe

Re: [sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-20 Thread Ted Horst
Thanks for investigating, Aaron. Maybe numpy importing should be pulled out into its own module. This would probably be necessary anyway if someone implements the "numpy array for sympy" idea that was talked about a while back. Ted On 2011-06-20, at 00:42, Aaron Meurer wrote: The way t

Re: [sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-20 Thread Aaron Meurer
It should at least be in a separate file for the quantum code. I didn't consider to make one file for it for all of SymPy. I'm waiting to see what Brian Granger thinks, since he knows the most about the quantum module. Aaron Meurer On Mon, Jun 20, 2011 at 6:06 PM, Ted Horst wrote: > Thanks for

Re: [sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-22 Thread Aaron Meurer
So far, I've coded up an import_module function, that wraps the try, except ImportError logic into a single unified function. It has support for checking the module version and the Python version and returning None if they are too old, even if the module is installed, and it also supports raising

Re: [sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-22 Thread Ted Horst
Seem like it would be more consistent to raise an ImportError rather than return None. That would also mean less change to existing code. Thinking a bit further, could this be done in an import hook (I haven't done one myself, so not sure)? Ted On 2011-06-22, at 02:09, Aaron Meurer wrote

Re: [sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-22 Thread Ondrej Certik
On Wed, Jun 22, 2011 at 12:09 AM, Aaron Meurer wrote: > So far, I've coded up an import_module function, that wraps the try, > except ImportError logic into a single unified function.  It has > support for checking the module version and the Python version and > returning None if they are too old,

Re: [sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-22 Thread Aaron S. Meurer
On Jun 22, 2011, at 6:55 AM, Ted Horst wrote: > Seem like it would be more consistent to raise an ImportError rather than > return None. That would also mean less change to existing code. That would defeat the whole purpose of the function, except when we need to check for versions or you w

Re: [sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-22 Thread Brian Granger
Hi, Just returned from being out of town for 4 days. I will try to get caught up on sympy things tomorrow. Brian On Sun, Jun 19, 2011 at 10:42 PM, Aaron Meurer wrote: > The way the quantum code is written, it's not very easy to disable > numpy globally.  I could do it, but it would require cop

Re: [sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-22 Thread Aaron Meurer
OK. You can follow my fixes at my external branch (it's almost ready for review). Another question that came up when doing this: how do I test the circuitplot module to make sure it works? I didn't see any tests or examples that used it anywhere. Aaron Meurer On Wed, Jun 22, 2011 at 11:47 PM,

Re: [sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-23 Thread Aaron Meurer
OK, I've finished it up. See https://github.com/sympy/sympy/pull/451. Please review the changes to that branch, and also if you have the chance, test it as you would the release candidate, as this should be the last fix needed for the 0.7.0 release. Aaron Meurer -- You received this message

Re: [sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-23 Thread Aaron S. Meurer
On Jun 22, 2011, at 8:51 AM, Ondrej Certik wrote: > On Wed, Jun 22, 2011 at 12:09 AM, Aaron Meurer wrote: >> So far, I've coded up an import_module function, that wraps the try, >> except ImportError logic into a single unified function. It has >> support for checking the module version and the

Re: [sympy] Test failure in 0.7.0 pysics.quantum.matrixcache

2011-06-24 Thread Ted Horst
All tests pass for me now on 0.7.0. Thanks Aaron On 2011-06-23, at 03:13, Aaron Meurer wrote: OK, I've finished it up. See https://github.com/sympy/sympy/pull/ 451. Please review the changes to that branch, and also if you have the chance, test it as you would the release candidate, as thi