[Numpy-discussion] NumPy C-API equivalent of np.float64()
kwgoodman at gmail.com
Wed Dec 29 13:27:34 EST 2010
On Wed, Dec 29, 2010 at 10:13 AM, Matthew Brett <matthew.brett at gmail.com> 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 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
> computer and my attention.
I think I need a function. One that does this:
>> n = 10.0
>> hasattr(n, 'ndim')
>> m = np.float64(n)
>> hasattr(m, 'ndim')
np.float64 is fast, just hoping someone had a C-API inline version of
np.float64() that is faster.
More information about the NumPy-Discussion