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

Support conversion of np.array with dtype=bool #88

Merged
merged 1 commit into from
Aug 25, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/numpy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ const NPY_ARRAY_ELEMENTSTRIDES = int32(0x0080)
#########################################################################
# conversion from Julia types to NPY_TYPES constant

npy_type(::Type{Bool}) = NPY_BOOL
npy_type(::Type{Int8}) = NPY_BYTE
npy_type(::Type{Uint8}) = NPY_UBYTE
npy_type(::Type{Int16}) = NPY_SHORT
Expand All @@ -162,10 +163,11 @@ npy_type(::Type{Complex64}) = NPY_CFLOAT
npy_type(::Type{Complex128}) = NPY_CDOUBLE
npy_type(::Type{PyPtr}) = NPY_OBJECT

typealias NPY_TYPES Union(Int8,Uint8,Int16,Uint16,Int32,Uint32,Int64,Uint64,Float32,Float64,Complex64,Complex128,PyPtr)
typealias NPY_TYPES Union(Bool,Int8,Uint8,Int16,Uint16,Int32,Uint32,Int64,Uint64,Float32,Float64,Complex64,Complex128,PyPtr)

# conversions from __array_interface__ type strings to supported Julia types
const npy_typestrs = (String=>Type)[ "i1"=>Int8, "u1"=>Uint8,
const npy_typestrs = (String=>Type)[ "b1"=>Bool,
"i1"=>Int8, "u1"=>Uint8,
"i2"=>Int16, "u2"=>Uint16,
"i4"=>Int32, "u4"=>Uint32,
"i8"=>Int64, "u8"=>Uint64,
Expand Down