Re: [Numpy-discussion] NumPy C-API equivalent of np.float64()

2010-12-29 Thread Keith Goodman
On Wed, Dec 29, 2010 at 11:54 AM, Pauli Virtanen wrote: > Keith Goodman wrote: >> np.float64 is fast, just hoping someone had a C-API inline version of >> np.float64() that is faster. > > You're looking for PyArrayScalar_New and _ASSIGN. > See > https://github.com/numpy/numpy/blob/master/numpy/co

Re: [Numpy-discussion] NumPy C-API equivalent of np.float64()

2010-12-29 Thread Pauli Virtanen
Keith Goodman wrote: > np.float64 is fast, just hoping someone had a C-API inline version of > np.float64() that is faster. You're looking for PyArrayScalar_New and _ASSIGN. See https://github.com/numpy/numpy/blob/master/numpy/core/include/numpy/arrayscalars.h Undocumented (bad), but AFAIK publi

Re: [Numpy-discussion] NumPy C-API equivalent of np.float64()

2010-12-29 Thread Keith Goodman
On Wed, Dec 29, 2010 at 11:43 AM, Matthew Brett wrote: > Hi, > >>> That might be because I'm not understanding you very well, but I was >>> thinking that: >>> >>> cdef dtype descr = PyArray_DescrFromType(NPY_FLOAT64) >>> >>> would give you the float64 dtype that I thought you wanted?  I'm >>> shoo

Re: [Numpy-discussion] NumPy C-API equivalent of np.float64()

2010-12-29 Thread Matthew Brett
Hi, >> That might be because I'm not understanding you very well, but I was >> thinking that: >> >> cdef dtype descr = PyArray_DescrFromType(NPY_FLOAT64) >> >> would give you the float64 dtype that I thought you wanted?  I'm >> shooting from the hip here, in between nieces competing for the >> com

Re: [Numpy-discussion] NumPy C-API equivalent of np.float64()

2010-12-29 Thread Keith Goodman
On Wed, Dec 29, 2010 at 10:13 AM, Matthew Brett wrote: >>> Forgive me if I haven't understood your question, but can you use >>> PyArray_DescrFromType with e.g  NPY_FLOAT64 ? >> >> I'm pretty hopeless here. I don't know how to put all that together in >> a function. > > That might be because I'm n

Re: [Numpy-discussion] NumPy C-API equivalent of np.float64()

2010-12-29 Thread Matthew Brett
>> Forgive me if I haven't understood your question, but can you use >> PyArray_DescrFromType with e.g  NPY_FLOAT64 ? > > I'm pretty hopeless here. I don't know how to put all that together in > a function. That might be because I'm not understanding you very well, but I was thinking that: cdef d

Re: [Numpy-discussion] NumPy C-API equivalent of np.float64()

2010-12-29 Thread Keith Goodman
On Wed, Dec 29, 2010 at 9:48 AM, Matthew Brett wrote: > Hi, > > On Wed, Dec 29, 2010 at 5:37 PM, Robert Bradshaw > wrote: >> On Wed, Dec 29, 2010 at 9:05 AM, Keith Goodman wrote: >>> On Tue, Dec 28, 2010 at 11:22 PM, Robert Bradshaw >>> wrote: On Tue, Dec 28, 2010 at 8:10 PM, John Salvatie

Re: [Numpy-discussion] NumPy C-API equivalent of np.float64()

2010-12-29 Thread Matthew Brett
Hi, On Wed, Dec 29, 2010 at 5:37 PM, Robert Bradshaw wrote: > On Wed, Dec 29, 2010 at 9:05 AM, Keith Goodman wrote: >> On Tue, Dec 28, 2010 at 11:22 PM, Robert Bradshaw >> wrote: >>> On Tue, Dec 28, 2010 at 8:10 PM, John Salvatier >>> wrote: Wouldn't that be a cast? You do casts in Cython

Re: [Numpy-discussion] NumPy C-API equivalent of np.float64()

2010-12-29 Thread Keith Goodman
On Wed, Dec 29, 2010 at 9:37 AM, Robert Bradshaw wrote: > On Wed, Dec 29, 2010 at 9:05 AM, Keith Goodman wrote: >> On Tue, Dec 28, 2010 at 11:22 PM, Robert Bradshaw >> wrote: >>> On Tue, Dec 28, 2010 at 8:10 PM, John Salvatier >>> wrote: Wouldn't that be a cast? You do casts in Cython with

Re: [Numpy-discussion] NumPy C-API equivalent of np.float64()

2010-12-29 Thread Robert Bradshaw
On Wed, Dec 29, 2010 at 9:05 AM, Keith Goodman wrote: > On Tue, Dec 28, 2010 at 11:22 PM, Robert Bradshaw > wrote: >> On Tue, Dec 28, 2010 at 8:10 PM, John Salvatier >> wrote: >>> Wouldn't that be a cast? You do casts in Cython with (expression) >>> and that should be the equivalent of float64 I

Re: [Numpy-discussion] NumPy C-API equivalent of np.float64()

2010-12-29 Thread Keith Goodman
On Tue, Dec 28, 2010 at 11:22 PM, Robert Bradshaw wrote: > On Tue, Dec 28, 2010 at 8:10 PM, John Salvatier > wrote: >> Wouldn't that be a cast? You do casts in Cython with (expression) >> and that should be the equivalent of float64 I think. > > Or even (expression) if you've cimported numpy > (t

Re: [Numpy-discussion] NumPy C-API equivalent of np.float64()

2010-12-28 Thread Robert Bradshaw
On Tue, Dec 28, 2010 at 8:10 PM, John Salvatier wrote: > Wouldn't that be a cast? You do casts in Cython with (expression) > and that should be the equivalent of float64 I think. Or even (expression) if you've cimported numpy (though as mentioned this is the same as double on every platform I kno

Re: [Numpy-discussion] NumPy C-API equivalent of np.float64()

2010-12-28 Thread John Salvatier
Wouldn't that be a cast? You do casts in Cython with (expression) and that should be the equivalent of float64 I think. On Tue, Dec 28, 2010 at 3:32 PM, Keith Goodman wrote: > I'm looking for the C-API equivalent of the np.float64 function, > something that I could use inline in a Cython functio

[Numpy-discussion] NumPy C-API equivalent of np.float64()

2010-12-28 Thread Keith Goodman
I'm looking for the C-API equivalent of the np.float64 function, something that I could use inline in a Cython function. I don't know how to write the function. Anyone have one sitting around? I'd like to use it, if it is faster than np.float64 (np.int32, np.float32, ...) in the Bottleneck package