Skip to content

Commit

Permalink
Merge pull request #88 from drewrobson/master
Browse files Browse the repository at this point in the history
Support conversion of np.array with dtype=bool
  • Loading branch information
stevengj committed Aug 25, 2014
2 parents 36c341f + 5c4b4f8 commit 7ca8691
Showing 1 changed file with 4 additions and 2 deletions.
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

0 comments on commit 7ca8691

Please sign in to comment.