I have a large binary file with interleaved Int16 values representing the real and imaginary parts of each sample. Letting S_i represent the sample number i, the data is arranged as
[Re(S_1), Im(S_1), Re(S_2), Im(S_2), ...]
My thought was to define a custom ComplexInt16 type and operate on that. I produced the code below:
struct ComplexInt16
re::Int16
im::Int16
end
filehandle = open("y_baseband.dat")
dh = mmap(filehandle, Vector{ComplexInt16})
The code above functions as expected, but I am unable to use functions that are defined for complex numbers (e.g. real(dh[1])
returns an error.) Is there a way to have my ComplexInt16
type work with the existing Complex functions within Julia?
why not just use Complex{Int16}
?