1/* Library libcerf: 2 * Compute complex error functions, based on a new implementation of 3 * Faddeeva's w_of_z. Also provide Dawson and Voigt functions. 4 * 5 * File cerf.h: 6 * Declare exported functions. 7 * 8 * Copyright: 9 * (C) 2012 Massachusetts Institute of Technology 10 * (C) 2013 Forschungszentrum Jülich GmbH 11 * 12 * Licence: 13 * Permission is hereby granted, free of charge, to any person obtaining 14 * a copy of this software and associated documentation files (the 15 * "Software"), to deal in the Software without restriction, including 16 * without limitation the rights to use, copy, modify, merge, publish, 17 * distribute, sublicense, and/or sell copies of the Software, and to 18 * permit persons to whom the Software is furnished to do so, subject to 19 * the following conditions: 20 * 21 * The above copyright notice and this permission notice shall be 22 * included in all copies or substantial portions of the Software. 23 * 24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 28 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 29 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 30 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 31 * 32 * Authors: 33 * Steven G. Johnson, Massachusetts Institute of Technology, 2012, core author 34 * Joachim Wuttke, Forschungszentrum Jülich, 2013, package maintainer 35 * 36 * Website: 37 * http://apps.jcns.fz-juelich.de/libcerf 38 * 39 * Revision history: 40 * ../CHANGELOG 41 * 42 * Man pages: 43 * w_of_z(3), dawson(3), voigt(3), cerf(3), erfcx(3), erfi(3) 44 */ 45 46 /* 47 48 This file is patched by Mojca Miklavec and Hans Hagen for usage in LuaMetaTeX where we use 49 only C and also want to compile with the Microsoft compiler. So, when updating this library 50 one has to check for changes. Not that we expect many as this is a rather stable library. 51 52 In the other files there are a few macros used that deal with the multiplication and addition 53 of complex and real numbers. Of course the original code is kept as-is. 54 55 */ 56 57# ifndef __CERF_H 58# define __CERF_H 59 60# include <complex.h> 61 62# if (_MSC_VER) 63 # define _cerf_cmplx _Dcomplex 64# else 65 typedef double _Complex _cerf_cmplx; 66# endif 67 68# define EXPORT 69 70extern _cerf_cmplx w_of_z (_cerf_cmplx z); /* compute w(z) = exp(-z^2) erfc(-iz), Faddeeva's scaled complex error function */ 71extern double im_w_of_x (double x); /* special case Im[w(x)] of real x */ 72extern double re_w_of_z (double x, double y); 73extern double im_w_of_z (double x, double y); 74 75extern _cerf_cmplx cerf (_cerf_cmplx z); /* compute erf(z), the error function of complex arguments */ 76extern _cerf_cmplx cerfc (_cerf_cmplx z); /* compute erfc(z) = 1 - erf(z), the complementary error function */ 77 78extern _cerf_cmplx cerfcx (_cerf_cmplx z); /* compute erfcx(z) = exp(z^2) erfc(z), an underflow-compensated version of erfc */ 79extern double erfcx (double x); /* special case for real x */ 80 81extern _cerf_cmplx cerfi (_cerf_cmplx z); /* compute erfi(z) = -i erf(iz), the imaginary error function */ 82extern double erfi (double x); /* special case for real x */ 83 84extern _cerf_cmplx cdawson (_cerf_cmplx z); /* compute dawson(z) = sqrt(pi)/2 * exp(-z^2) * erfi(z), Dawson's integral */ 85extern double dawson (double x); /* special case for real x */ 86 87extern double voigt (double x, double sigma, double gamma); /* compute voigt(x,...), the convolution of a Gaussian and a Lorentzian */ 88extern double voigt_hwhm (double sigma, double gamma, int *error); /* compute the full width at half maximum of the Voigt function */ 89 90extern double cerf_experimental_imw (double x, double y); 91extern double cerf_experimental_rew (double x, double y); 92 93#endif 94 |