Hi
On Tue, Nov 25, 2008 at 4:43 PM, William Hunter <[EMAIL PROTECTED]> wrote:
>
> Something is still not quite right though, look at this for example:
>
> In [1]: from sympy import Matrix, symbols, __version__
>
> In [2]: from numpy import array, load
>
> In [3]: __version__
> Out[3]: '0.6.3'
>
> In [4]: m = array(Matrix([1,2,3])).astype('d')
>
> In [5]: m
> Out[5]:
> array([[ 1.],
> [ 2.],
> [ 3.]])
>
> In [6]: m.dump('spam.dat')
>
> In [7]: M = load('spam.dat') # no problems here
>
> In [8]: M
> Out[8]:
> array([[ 1.],
> [ 2.],
> [ 3.]])
>
> In [9]: m = array(Matrix([1,2,3])).astype('object')
>
> In [10]: m.dump('spam.dat')
>
> In [11]: M = load('spam.dat') # problem here
> ---------------------------------------------------------------------------
> TypeError Traceback (most recent call last)
>
> /home/williamh/<ipython console> in <module>()
>
> /usr/lib/python2.5/site-packages/numpy/core/numeric.pyc in load(file)
> 609 if isinstance(file, type("")):
> 610 file = _file(file,"rb")
> --> 611 return _cload(file)
> 612
> 613 # Adapted from matplotlib
>
> TypeError: __new__() takes exactly 2 arguments (1 given)
>
> Looks like the problem arises when the numpy array contains 'objects',
> right? However, if I construct a 'clean' NumPy array containing
> 'objects', I get different behaviour:
>
> In [16]: m = array([1,2,3]).astype('object') # no sympy Matrix here
>
> In [17]: m.dump('spam.dat')
>
> In [18]: M = load('spam.dat') # and no problem here
>
> In [20]: numpy.__version__
> Out[20]: '1.0.4'
>
> Something probably (obviously?) goes astray during the conversion from
> sympy.Matrix -> numpy.array. Perhaps a symbol to string conversion?
> Dunno.
Indeed -- thanks for the bug report. One needs to debug it to see what
is wrong. E.g. you need to discover which arguments get passed to the
__new__ so that it produces the error:
TypeError: __new__() takes exactly 2 arguments (1 given)
Could you please create an issue for it? This issue seems to be related:
http://code.google.com/p/sympy/issues/detail?id=1176
Ondrej
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---