-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6a3e8ea
commit 8048334
Showing
3 changed files
with
57 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// g++ -shared -o cernlibc2.so -fPIC cinterface.cpp | ||
|
||
#include <math.h> | ||
#include <exception> | ||
#include <complex> | ||
#include "cern_polygamma.hpp" | ||
|
||
extern "C" double c_getdouble(double* ptr) { | ||
return *ptr; | ||
} | ||
|
||
extern "C" int c_cern_polygamma(const double re_in, const double im_in, const unsigned int K, double* re_out, double* im_out) { | ||
const std::complex<double> Z (re_in, im_in); | ||
try { | ||
const std::complex<double> H = cern_polygamma(Z, K); | ||
*re_out = H.real(); | ||
*im_out = H.imag(); | ||
} catch (std::invalid_argument &e) { | ||
return -1; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters