vDSP.DCT 展开为零

vDSP.DCT unwraps to nil

当我执行这行代码时:

self.forwardDCTSetup = vDSP.DCT(count: 40, transformType: vDSP.DCTTransformType.II)!

我得到:

Fatal error: Unexpectedly found nil while unwrapping an Optional value

我几乎完全按照本教程进行操作:https://developer.apple.com/documentation/accelerate/signal_extraction_from_noise

vDSP.DCT 在长度/计数方面遵循与 vDSP_DCT_CreateSetup 相同的规则:

The supported values are Length = f * 2**n, where f is 1, 3, 5, or 15 and n is at least 4. 

参见:https://developer.apple.com/documentation/accelerate/1449930-vdsp_dct_createsetup