On Wed, Dec 29, 2010 at 9:48 AM, Matthew Brett <matthew.br...@gmail.com> wrote: > Hi, > > On Wed, Dec 29, 2010 at 5:37 PM, Robert Bradshaw > <rober...@math.washington.edu> wrote: >> On Wed, Dec 29, 2010 at 9:05 AM, Keith Goodman <kwgood...@gmail.com> wrote: >>> On Tue, Dec 28, 2010 at 11:22 PM, Robert Bradshaw >>> <rober...@math.washington.edu> wrote: >>>> On Tue, Dec 28, 2010 at 8:10 PM, John Salvatier >>>> <jsalv...@u.washington.edu> wrote: >>>>> Wouldn't that be a cast? You do casts in Cython with <double>(expression) >>>>> and that should be the equivalent of float64 I think. >>>> >>>> Or even <numpy.float64_t >(expression) if you've cimported numpy >>>> (though as mentioned this is the same as double on every platform I >>>> know of). Even easier is just to use the expression in a the right >>>> context and it will convert it for you. >>> >>> That will give me a float object but it will not have dtype, shape, >>> ndim, etc methods. >>> >>>>> m = np.mean([1,2,3]) >>>>> m >>> 2.0 >>>>> m.dtype >>> dtype('float64') >>>>> m.ndim >>> 0 >>> >>> using <np.float64_t> gives: >>> >>> AttributeError: 'float' object has no attribute 'dtype' > > 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. _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion