I am moving some of my code to 0.4 and I am having trouble figuring out how 
to get a pointer for beginning of a UInt matrix.  In the past I did:

*julia> **bpt = convert(Ptr{Uint8},b)  #where b it my Uint8 matrix*

*Ptr{Uint8} @0x00007fdd243fca70*

in 0.4 I get:

*julia> **bpt = convert(Ptr{UInt8},b)*

*ERROR: MethodError: `convert` has no method matching 
convert(::Type{Ptr{UInt8}}, ::Array{UInt8,1})*

*This may have arisen from a call to the constructor Ptr{UInt8}(...),*

*since type constructors fall back to convert methods.*

Closest candidates are:

  call{T}(::Type{T}, ::Any)

  convert{T<:Union{Int8,UInt8}}(::Type{Ptr{T<:Union{Int8,UInt8}}}, 
*::Cstring*)

  convert{T}(::Type{Ptr{T}}, *::UInt64*)

Unfortunately I am not certain any of these options match what I am looking 
for:

The method used in 0.3 is:
convert{T}(::Type{Ptr{T}},a::Array{T,N}) at pointer.jl:22
which is:
convert{T}(::Type{Ptr{T}}, a::Array{T}) = ccall(:jl_array_ptr, Ptr{T}, 
(Any,), a)
this obviously does not exist in 0.4.

My use case is that I read in a Uint8 matrix from a PLINK .bed file format 
which is a Uint8 matrix that is a dense way to pack in genetic locus 
genotypes every two bits and every column represents a new locus.  With the 
pointer at the beginning of the Uint8 matrix, I can easily work my way down 
a column and extract the genotype calls with bit operations across the 
matrix.  This kind of work is at the edge of my understanding (i.e. 
pointers and bit operations) so despite looking at some of the code for the 
suggested convert methods I am not sure how to get back to what I 
originally use with what is available in 0.4.

In 0.4 I can just make my own new convert call with the old code from 0.3 
by:
import Base.convert
convert{T}(::Type{Ptr{T}}, a::Array{T}) = ccall(:jl_array_ptr, Ptr{T}, 
(Any,), a)
and it get:

*julia> **bpt = convert(Ptr{UInt8},b)*

*Ptr{UInt8} @0x000000011253ac00*


But I wanted to know if the was a technical reason for that convert call to 
be removed in 0.4 and if using this "reinstated" convert call will do what 
it originally did in 0.3.


Reply via email to