Sorry for the delayed response. You are using recast, which is a wrapper around assumingMemoryBound(to:), in two interesting cases:
The first is to reconcile a pointer-type mismatch between C APIs. You're passing a pointer to Numerics' Complex type into Accelerate's __CLPK_complex type:
DSPSplitComplex(realp: recast(&real), ...
The sanctioned way to do this is to call withMemoryRebound(to:capacity:). Then as long as you follow the usual rules for pointer-generating closures (don't escape the pointer out of the closure), then you're safe. As time goes on, the compiler will get better at enforcing that rule to catch mistakes.
Even though your code is using an unsafe approach that can't be checked by the compiler, it actually safe in practice. It cannot be miscompiled as-is because you are following the following unwritten rules for type punning across compilation boundaries:
Swift code is only accessing Numerics' Complex type. It never loads or stores using
Accelerate's type.
You only use recast within an argument expression of a call into
Accelerate. So the only code accessing that type is inside
Accelerate.
In the second case, you have a pointer to a generic type
X : UnsafePointer<Self>
And dynamically know the concrete type:
UnsafePointer<Float> = recast(X)
That is original motivation for the assumingMemoryBound(to:), and if I'm reading the code correctly, what you're doing is perfectly safe.