Re: [Numpy-discussion] Creating a bool array with Cython

2012-02-26 Thread Keith Goodman
On Sat, Feb 25, 2012 at 7:04 PM, Dag Sverre Seljebotn wrote: > On 02/25/2012 03:26 PM, Keith Goodman wrote: >> Is this a reasonable (and fast) way to create a bool array in cython? >> >>      def makebool(): >>          cdef: >>              int n = 2 >>              np.npy_intp *dims = [n] >>    

Re: [Numpy-discussion] Creating a bool array with Cython

2012-02-26 Thread Neal Becker
Keith Goodman wrote: > Is this a reasonable (and fast) way to create a bool array in cython? > > def makebool(): > cdef: > int n = 2 > np.npy_intp *dims = [n] > np.ndarray[np.uint8_t, ndim=1] a > a = PyArray_EMPTY(1, dims, NPY_UINT8, 0) >

Re: [Numpy-discussion] Creating a bool array with Cython

2012-02-25 Thread Dag Sverre Seljebotn
On 02/25/2012 03:26 PM, Keith Goodman wrote: > Is this a reasonable (and fast) way to create a bool array in cython? > > def makebool(): > cdef: > int n = 2 > np.npy_intp *dims = [n] > np.ndarray[np.uint8_t, ndim=1] a > a = PyArray_EMPTY

[Numpy-discussion] Creating a bool array with Cython

2012-02-25 Thread Keith Goodman
Is this a reasonable (and fast) way to create a bool array in cython? def makebool(): cdef: int n = 2 np.npy_intp *dims = [n] np.ndarray[np.uint8_t, ndim=1] a a = PyArray_EMPTY(1, dims, NPY_UINT8, 0) a[0] = 1 a[1] = 0