Post not yet marked as solved
I might solve it by myself.
let numerators: [Float] = ...
let denominators: [Float] = ... // actually these are integers in my case
let denominatorsEpsilon = vDSP.add(Float.leastNonzeroMagnitude * 10000000, denominators) // (Float.leastNonzeroMagnitude * 10000000 is minimal number to avoid NaN when dividing.
let divides = vDSP.divide(numerators, denominatorsEpsilon)
let alternativesOfNAN: [Float] = ...
let denominatorsClip = vDSP.clip(denominators, to: 0...1) // denominatorsClip are 0 or 1 since denominators are integers
let result = vDSP.subtract(multiplication: (divides, denominatorsClip), multiplication: (alternativesOfNAN, vDSP.add(-1, denominatorsClip)))
I don't like this code since it is not precise and includes many unnecessary operations, but it is much faster than code checking isNaN.
Post not yet marked as solved
Sorry, I misunderstood.
What I need is masking nan values, not gathering non-nan values.
As you said, vDSP_vdiv returns nan(, not inf) when you divide by zero. And I cannot find any effective compare operations to mask nan.
Are there any good functions?
What I am really doing is,
let numerators: [Float] = ...
let denominators: [Float] = ...
let divides = vDSP.divide(numerators, denominators)
let alternativesOfNAN: [Float] = ...
for i in divides {
if divides[i].isNaN {
divides[i] = alternativesOfNAN[i]
}
}
The last loop is quite slow compared with other parts using vDSP.
Post not yet marked as solved
Thank you!
vDSP_vcmprs is what I need!
Post not yet marked as solved
I solved it by myself.
newDocument argument returns a document with some magic keyword.
If a document of the argument of editor argument has the magic keyword, editor shows a template selector view.
The template selector view updates the document and it trigger showing a real editor view.
Post not yet marked as solved
Now I noticed that this issue was not posting.
Any notification banners, such as timer alert, are prevented during my broadcast upload extension is running.
Do I need special settings of the extension to allow banners?
Post not yet marked as solved
I had flied this issue via Feedback Assistant on 2022/09/20.(FB11549664)
No response yet.
Post not yet marked as solved
Rincewind san,
Thank you for your comment!
However, I confirmed that both windows' isKeyWindow are true and no didBecomeKeyNotification are triggered even when the app has two scenes.
I think that they are deprecated.
Post not yet marked as solved
Wrapping the related code by autoreleasepool solved this issue.
I have never known existence of autoreleasepool in Swift.
Post not yet marked as solved
No.I don't have AirPods so I cannot do any experiment.I am waiting for information to buy it.
eskimo san,Thank you for your reply!I am actually using BlueSocket, which is an open source written by IBM.The error occurs since the line https://github.com/IBM-Swift/BlueSocket/blob/c46a3d41f5b2401d18bcb46d0101cdc5cd13e307/Sources/Socket/Socket.swift#L2392 returns minus value.I will try your suggestion and ask if I will encounter other trouble.UPDATE:I successfully moved from BlueSocket to Foundation API with socketpair.Thank you!