admin管理员组文章数量:1434227
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}
?
本文标签: juliaImplementation of ComplexInt16 typeStack Overflow
版权声明:本文标题:julia - Implementation of ComplexInt16 type - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745617393a2666482.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论