Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create boolean numpy array #2953

Open
david-cortes opened this issue May 15, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@david-cortes
Copy link

commented May 15, 2019

All of the following will fail to compile:

from libcpp cimport bool as bool_t
import numpy as np
cimport numpy as np
import ctypes

cdef np.ndarray[bool_t, ndim = 1] arr0 = np.zeros(10, dtype = ctypes.c_bool)
cdef np.ndarray[bool, ndim = 1] arr1 = np.zeros(10, dtype = ctypes.c_bool)
cdef np.ndarray[bool_t, ndim = 1] arr2 = <np.ndarray[bool_t, ndim = 1]> np.zeros(10, dtype = ctypes.c_char)
cdef np.ndarray[bool, ndim = 1] arr3 = <np.ndarray[bool_t, ndim = 1]> np.zeros(10, dtype = ctypes.c_char)
cdef np.ndarray[bool_t, ndim = 1] arr4 = np.zeros(10, dtype = "bool")

There doesn't seem to be a way to create a numpy array of C's boolean type.

@scoder

This comment has been minimized.

Copy link
Contributor

commented May 19, 2019

Try latest master.

@scoder

This comment has been minimized.

Copy link
Contributor

commented May 19, 2019

Duplicate of #2675.

@scoder scoder added the R: duplicate label May 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.