Faddeeva.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* Copyright (c) 2012 Massachusetts Institute of Technology
  2. *
  3. * Permission is hereby granted, free of charge, to any person obtaining
  4. * a copy of this software and associated documentation files (the
  5. * "Software"), to deal in the Software without restriction, including
  6. * without limitation the rights to use, copy, modify, merge, publish,
  7. * distribute, sublicense, and/or sell copies of the Software, and to
  8. * permit persons to whom the Software is furnished to do so, subject to
  9. * the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be
  12. * included in all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  15. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  17. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  18. * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  19. * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  20. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21. */
  22. /* Available at: http://ab-initio.mit.edu/Faddeeva
  23. Header file for Faddeeva.c; see Faddeeva.cc for more information. */
  24. #ifndef FADDEEVA_H
  25. #define FADDEEVA_H 1
  26. // Require C99 complex-number support
  27. #include <complex.h>
  28. #ifdef __cplusplus
  29. extern "C"
  30. {
  31. #endif /* __cplusplus */
  32. // compute w(z) = exp(-z^2) erfc(-iz) [ Faddeeva / scaled complex error func ]
  33. extern double complex Faddeeva_w(double complex z,double relerr);
  34. extern double Faddeeva_w_im(double x); // special-case code for Im[w(x)] of real x
  35. // Various functions that we can compute with the help of w(z)
  36. // compute erfcx(z) = exp(z^2) erfc(z)
  37. extern double complex Faddeeva_erfcx(double complex z, double relerr);
  38. extern double Faddeeva_erfcx_re(double x); // special case for real x
  39. // compute erf(z), the error function of complex arguments
  40. extern double complex Faddeeva_erf(double complex z, double relerr);
  41. extern double Faddeeva_erf_re(double x); // special case for real x
  42. // compute erfi(z) = -i erf(iz), the imaginary error function
  43. extern double complex Faddeeva_erfi(double complex z, double relerr);
  44. extern double Faddeeva_erfi_re(double x); // special case for real x
  45. // compute erfc(z) = 1 - erf(z), the complementary error function
  46. extern double complex Faddeeva_erfc(double complex z, double relerr);
  47. extern double Faddeeva_erfc_re(double x); // special case for real x
  48. // compute Dawson(z) = sqrt(pi)/2 * exp(-z^2) * erfi(z)
  49. extern double complex Faddeeva_Dawson(double complex z, double relerr);
  50. extern double Faddeeva_Dawson_re(double x); // special case for real x
  51. #ifdef __cplusplus
  52. }
  53. #endif /* __cplusplus */
  54. #endif // FADDEEVA_H