THANKS!!!!!!!
-Adrian.

On Oct 11, 11:08 pm, "Mike Hansen" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I've attached a patch that fixes the issues that you've mentioned.  To
> apply it, run hg_sage.patch('/path/to/856.patch') from SAGE, exit
> SAGE, and then run ./sage -br .
>
> There still is some work to be done with numpy support -- for example,
> getting the numpy integer types to play well with the SAGE integers:
>
> sage: import numpy
> sage: a = numpy.array([[1,2],[3,4]],'int32')
> sage: matrix(a)
> Traceback (most recent call last):
> ...
> TypeError: cannot convert numpy matrix to SAGE matrix
>
> I'll try to get that taken care of in the near future.
>
> --Mike
>
> On 10/11/07, adrianmatematico <[EMAIL PROTECTED]> wrote:
>
>
>
> > First of all:  Sorry, I duplicated the bug...
>
> > Things change when instead of a 'f' I write float:
>
> > sage: a=numpy.array([[1,2,3],[4,5,6],[7,8,9]],float)
> > sage: a
>
> > array([[ 1.,  2.,  3.],
> >        [ 4.,  5.,  6.],
> >        [ 7.,  8.,  9.]])
> > sage: matrix(a)
>
> > [1.0 2.0 3.0]
> > [4.0 5.0 6.0]
> > [7.0 8.0 9.0]
> > sage:
>
> > Things should be such that matrix(matrix(2,2,[1,2,3,4]).numpy()),
> > should return matrix(2,2,[1,2,3,4]).  Following the documentation one
> > is tempted to write matrix(matrix(2,2,[1,2,3,4]).numpy('f')) which
> > does not work.  One should write matrix(matrix(2,2,
> > [1,2,3,4]).numpy(float)) which works but is not so well documented in
> > matrix.numpy?
>
> > sage: matrix(matrix(2,2,[1,2,3,4]).numpy(float))
>
> > [1.0 2.0]
> > [3.0 4.0]
> > sage: matrix(matrix(2,2,[1,2,3,4]).numpy('f'))
>
> > [     2.00000047311      512.000122547]
> > [8.33944345861e-312 1.58292085852e-264]
>
> > sage: matrix(matrix(2,2,[1,2,3,4]).numpy())
> > ---------------------------------------------------------------------------
> > <type 'exceptions.UnboundLocalError'>     Traceback (most recent call
> > last)
>
> > /home/soto/<ipython console> in <module>()
>
> > /usr/local/sage-u2.8.3-ubuntu-7.04-32bit-i686-Linux/local/lib/
> > python2.5/site-packages/sage/matrix/constructor.py in matrix(arg0,
> > arg1, arg2, arg3, sparse)
> >     371         sparse = False
> >     372
> > --> 373     return matrix_space.MatrixSpace(ring, nrows, ncols,
> > sparse=sparse)(entries)
> >     374
> >     375
>
> > <type 'exceptions.UnboundLocalError'>: local variable 'ring'
> > referenced before assignment
>
> > On Oct 11, 8:23 pm, adrianmatematico <[EMAIL PROTECTED]>
> > wrote:
> > > When I call matrix(a) and a is a numpy array, things do not work:
>
> > > sage: import numpy
> > > sage: a=numpy.array([[1,2,3],[4,5,6],[7,8,9]],'f')
> > > sage: a
>
> > > array([[ 1.,  2.,  3.],
> > >        [ 4.,  5.,  6.],
> > >        [ 7.,  8.,  9.]], dtype=float32)
> > > sage: matrix(a)
>
> > > [     2.00000047311      512.000122547       8192.0019722]
> > > [     131072.031677 6.64723988631e-312 9.63032207325e-270]
> > > [               nan 6.01334411715e-154 1.20061630269e+195]
> > > sage: b=matrix(a)
> > > sage: b
>
> > > [     2.00000047311      512.000122547       8192.0019722]
> > > [     131072.031677 6.64723988631e-312 9.63032207325e-270]
> > > [               nan 6.01334411715e-154 1.20061630269e+195]
> > > sage:
>
>
>
>  856.patch
> 11KDownload


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to