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?
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?
1 Answer
Reset to default 1why not just use Complex{Int16}
?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745617393a4636317.html
评论列表(0条)