vdsp.fft Swift Enum vs.vdsp_fft_zrip

发布于 2025-01-30 13:21:31 字数 1247 浏览 4 评论 0原文

Apple提供了 swift vdsp vdsp enum 直观地进行操作。

有了此,您可以将较不可读的代码转换

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吐个泡泡 2025-02-06 13:21:31

看看 vdsp.discretefourierTransTransTransTransForm 。它支持复杂的复合物和复合物。加速的DFT将在可能的地方使用FFT。它还支持交错和分裂复杂数据

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 ????

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文