vdsp.fft Swift Enum vs.vdsp_fft_zrip
Apple提供了 swift
enum 直观地进行操作。vdsp
vdsp
有了此,您可以将较不可读的代码转换
vDSP_vmul(arrayA, 1, arrayB, 1, arrayC, 1, vDSP_length(arrayA.count))
为
let arrayC = vDSP.multiply(arrayA, arrayB)
类似的代码,但是,嵌套 fft class 似乎只支持复杂 - >复杂的FFT。为了做一个真实的 - >复杂的FFT,利用共轭复杂的对称性,您似乎仍然需要使用 不是很直观(经典的旧苹果文档问题)。
我错过了某种真实的方式吗?使用Swift Enum的复杂FFT?提前致谢!
这是一些使用它的示例代码:
let fft = vDSP.FFT(log2n: vDSP_Length(log2n),
radix: .radix2,
ofType: DSPSplitComplex.self)
/// create DSPSplitComplex, splitComplex, with array for real component,
/// zero array for imaginary component
fft?.forward(input: splitComplex, output: &splitComplex)
Apple has provided a Swift vDSP
enum for more intuitively doing operations.
With this you can convert less readable code like
vDSP_vmul(arrayA, 1, arrayB, 1, arrayC, 1, vDSP_length(arrayA.count))
to
let arrayC = vDSP.multiply(arrayA, arrayB)
However, the nested FFT class seems to only support complex --> complex FFTs. In order to do a real --> complex FFT, taking advantage of conjugate complex symmetry, it seems you still need to use vDSP_fft_zrip which is not very intuitive (classic old Apple docs issues).
Am I missing some way of doing a real --> complex FFT using the Swift enum? Thanks in advance!
Here's some example code using it:
let fft = vDSP.FFT(log2n: vDSP_Length(log2n),
radix: .radix2,
ofType: DSPSplitComplex.self)
/// create DSPSplitComplex, splitComplex, with array for real component,
/// zero array for imaginary component
fft?.forward(input: splitComplex, output: &splitComplex)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看
。它支持复杂的复合物和复合物。加速的DFT将在可能的地方使用FFT。它还支持交错和分裂复杂数据vdsp.discretefourierTransTransTransTransForm
Take a look at
vDSP.DiscreteFourierTransform
. It supports complex-complex and complex-real. Accelerate's DFT will use FFT where it can. It also supports interleaved and split-complex data ????