This is the home page of libcerf, a self-contained numeric library that provides an efficient and accurate implementation of complex error functions, along with Dawson, Faddeeva, and Voigt functions.
Bug warning: Release 1.8 has broken the normalization of the Voigt function. Do not use releases 1.8 to 1.10. Everything is corrected in release 1.11.
On current GNU/Linux systems, the man page complex(7) has a “see also” section that lists complex mathematical functions like cabs(3), cacos(3), and so on. Among them, there is a complex error function. However, its manual page cerf(3) describes the functions cerf and cerfc as “unimplemented” and “reserved for future use”. The present library libcerf provides the missing implementation, along with a related functions. It comes with a set of man pages, including a page cerf(3) that overwrites the standard one.
In the following, “complex” stands for the C99 data type “double _Complex”:
The library libcerf is written in C. It can be compiled as C code (default) or as C++ code (with option -DCERF_CPP=ON). Compilation as C++ is useful especially under MS Windows because as per 2018 the C compiler of Visual Studio does not support C90, nor any newer language standard, and is unable to cope with complex numbers.
For use with other programming languages, libcerf should be either linked directly, or provided with a trivial wrapper. Such language bindings are added to the libcerf package as contributed by their authors.
The following bindings are available:
Further contributions will be highly welcome.
By construction, it is expected that the relative accuracy is generally better than 1E-13. This has been confirmed by comparison with high-precision Maple computations and with a long double computation using Fourier transform representation and double-exponential transform.
License: MIT License
When using libcerf in scientific work, please cite as follows:
Please send bug reports to the authors.
Most function evaluations in this library rely on Faddeeva's function w(z).
This function has been reimplemented from scratch by Steven G. Johnson; project web site http://ab-initio.mit.edu/Faddeeva. The implementation partly relies on algorithms from the following publications:
Download location: http://apps.jcns.fz-juelich.de/src/libcerf/
Build&install are based on CMake. Out-of-source build is enforced. After unpacking the source, go to the source directory and do:
mkdir build cd build cmake .. make make install
To test, run the programs in directory test/.
The library has been developed using gcc-4.7. Reports about successful compilation with older versions of gcc would be welcome. For correct support of complex numbers it seems that at least gcc-4.3 is required. Compilation with gcc-4.2 works after removing of the “-Werror” flag from configure.