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]
>>
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)
>
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
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