add complex error functions (via http:https://ab-initio.mit.edu/Faddeeva) #1799
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch adds support for error functions erf and erfc of arbitrary complex arguments, as well as the related functions erfi, erfcx, and dawson. (It requires the most recent version of openlibm with the Faddeeva package merged.)
Note that the ugliness with the libFaddeeva_wrapper library can go away once ccall supports C99 complex numbers (issue #85).
The code works, but a little tweak from a Julia expert would be useful. In
I declared w as a local variable to hold the return value. I tried declaring
in the surrounding let block instead, similar to how the Bessel and Airy functions are handled, but for some reason this led to Julia complaining that w was not defined inside the function. I'm guessing that it is some kind of macro hygiene problem, but using $(esc(w)) did not seem to work.