#4206: convert RDF and CDF vectors to use numpy
----------------------------+-----------------------------------------------
Reporter: jason | Owner: was
Type: enhancement | Status: new
Priority: major | Milestone: sage-3.1.3
Component: linear algebra | Resolution:
Keywords: |
----------------------------+-----------------------------------------------
Comment (by mabshoff):
This is needed after #4205:
{{{
[02:20am] mabshoff: mk
[02:21am] jason-: cdef ndarray _n =
numpy.array(list(self),dtype=numpy.dtype('float64'))
[02:21am] jason-: # temp = PyArray_SimpleNew(1, dims, NPY_DOUBLE)
[02:21am] jason-: # _n = temp
[02:21am] jason-: # for i from 0<=i<_V.v.size:
[02:21am] jason-: # _n[i] = float(_V.v.data[i])
[02:21am] jason-: comment from that line down to the end of the function
[02:21am] jason-: and replace it with the above numpy.array line.
[02:21am] jason-: oh, and add import numpy above that.
<SNIP>
[02:24am] mabshoff: sage: sage: v = vector(RDF,4,range(4))
[02:24am] mabshoff: sage: v.numpy()
[02:24am] mabshoff: array([ 0., 1., 2., 3.])
[02:24am] mabshoff: sage: v
[02:24am] mabshoff: (0.0, 1.0, 2.0, 3.0)
[02:24am] mabshoff: so that works now
[02:24am] jason-: can I just replace it?
[02:24am] jason-: it's going to be really slow, but it works
[02:25am] mabshoff: well, I guess for now we can live with that.
[02:25am] jason-: well, I don't know how much slower
[02:25am] jason-: can you do a timeit test?
[02:25am] mabshoff: sure, in a minute
}}}
Cheers,
Michael
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4206#comment:1>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" 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/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---