Loading lib/configure.pl +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ sub createMakefile local *FH = $fh; my @units = ("MersenneTwister","Matrix","Mpi","ApplicationInfo","Concurrency", "ProgressIndicator","Tokenizer","MemResolv","PsimagLite","PsiBase64", "GammaFunction"); "SpecialFunctions"); my $combinedUnits = combine("",\@units,".o "); my $combinedUnits2 = combine("../src/",\@units,".cpp "); Loading src/GslWrapper.h +22 −5 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS. #include <gsl/gsl_errno.h> #include <gsl/gsl_sf_result.h> #include <gsl/gsl_sf_gamma.h> #include <gsl/gsl_sf_expint.h> #endif #include <stdexcept> Loading @@ -97,7 +98,10 @@ public: typedef int DummyType; typedef DummyType gsl_integration_workspace; typedef double (* GslWrapperFunctionType) (double, void * ); typedef double gsl_sf_result; typedef struct { double val; double err; } gsl_sf_result; typedef void (* gsl_error_handler_t) (const char *,const char *,int,int); Loading Loading @@ -186,16 +190,23 @@ public: thereSnoGsl(); } int gsl_sf_lngamma_complex_e(double zr, double zi, gsl_sf_result* lnr, gsl_sf_result* arg) const int gsl_sf_lngamma_complex_e(double, double, gsl_sf_result*, gsl_sf_result*) const { thereSnoGsl(); return 0; } int gsl_sf_Ci_e(double, gsl_sf_result*) { thereSnoGsl(); return 0; } private: void thereSnoGsl() const { throw RuntimeError("You need to compile with the GSL\n"); Loading @@ -210,6 +221,7 @@ public: typedef ::gsl_integration_workspace gsl_integration_workspace; typedef ::gsl_function gsl_function; typedef ::gsl_sf_result gsl_sf_result; void printError(int status) const { Loading Loading @@ -306,6 +318,11 @@ public: return ::gsl_sf_lngamma_complex_e(zr, zi, lnr, arg); } int gsl_sf_Ci_e(double x, gsl_sf_result* result) const { return ::gsl_sf_Ci_e(x,result); } }; // class GslWrapper #endif Loading src/SpecialFunctions.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -4,10 +4,18 @@ namespace PsimagLite { std::complex<double> LnGammaFunction(const std::complex<double>& z) { GslWrapper gslWrapper; double lnr = 0.0; double arg = 0.0; GslWrapper::gsl_sf_result lnr; GslWrapper::gsl_sf_result arg; gslWrapper.gsl_sf_lngamma_complex_e(std::real(z),std::imag(z),&lnr,&arg); return std::complex<double>(lnr,arg); return std::complex<double>(lnr.val,arg.val); } double Ci(const double& x) { GslWrapper gslWrapper; GslWrapper::gsl_sf_result result; gslWrapper.gsl_sf_Ci_e(x,&result); return result.val; } } Loading src/SpecialFunctions.h +5 −3 Original line number Diff line number Diff line #ifndef GAMMAFUNCTION_H #define GAMMAFUNCTION_H #ifndef PSI_SPECIAL_FUNCTIONS_H #define PSI_SPECIAL_FUNCTIONS_H #include "GslWrapper.h" namespace PsimagLite { std::complex<double> LnGammaFunction(const std::complex<double>&); double Ci(const double& x); } #endif // GAMMAFUNCTION_H #endif // PSI_SPECIAL_FUNCTIONS_H Loading
lib/configure.pl +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ sub createMakefile local *FH = $fh; my @units = ("MersenneTwister","Matrix","Mpi","ApplicationInfo","Concurrency", "ProgressIndicator","Tokenizer","MemResolv","PsimagLite","PsiBase64", "GammaFunction"); "SpecialFunctions"); my $combinedUnits = combine("",\@units,".o "); my $combinedUnits2 = combine("../src/",\@units,".cpp "); Loading
src/GslWrapper.h +22 −5 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS. #include <gsl/gsl_errno.h> #include <gsl/gsl_sf_result.h> #include <gsl/gsl_sf_gamma.h> #include <gsl/gsl_sf_expint.h> #endif #include <stdexcept> Loading @@ -97,7 +98,10 @@ public: typedef int DummyType; typedef DummyType gsl_integration_workspace; typedef double (* GslWrapperFunctionType) (double, void * ); typedef double gsl_sf_result; typedef struct { double val; double err; } gsl_sf_result; typedef void (* gsl_error_handler_t) (const char *,const char *,int,int); Loading Loading @@ -186,16 +190,23 @@ public: thereSnoGsl(); } int gsl_sf_lngamma_complex_e(double zr, double zi, gsl_sf_result* lnr, gsl_sf_result* arg) const int gsl_sf_lngamma_complex_e(double, double, gsl_sf_result*, gsl_sf_result*) const { thereSnoGsl(); return 0; } int gsl_sf_Ci_e(double, gsl_sf_result*) { thereSnoGsl(); return 0; } private: void thereSnoGsl() const { throw RuntimeError("You need to compile with the GSL\n"); Loading @@ -210,6 +221,7 @@ public: typedef ::gsl_integration_workspace gsl_integration_workspace; typedef ::gsl_function gsl_function; typedef ::gsl_sf_result gsl_sf_result; void printError(int status) const { Loading Loading @@ -306,6 +318,11 @@ public: return ::gsl_sf_lngamma_complex_e(zr, zi, lnr, arg); } int gsl_sf_Ci_e(double x, gsl_sf_result* result) const { return ::gsl_sf_Ci_e(x,result); } }; // class GslWrapper #endif Loading
src/SpecialFunctions.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -4,10 +4,18 @@ namespace PsimagLite { std::complex<double> LnGammaFunction(const std::complex<double>& z) { GslWrapper gslWrapper; double lnr = 0.0; double arg = 0.0; GslWrapper::gsl_sf_result lnr; GslWrapper::gsl_sf_result arg; gslWrapper.gsl_sf_lngamma_complex_e(std::real(z),std::imag(z),&lnr,&arg); return std::complex<double>(lnr,arg); return std::complex<double>(lnr.val,arg.val); } double Ci(const double& x) { GslWrapper gslWrapper; GslWrapper::gsl_sf_result result; gslWrapper.gsl_sf_Ci_e(x,&result); return result.val; } } Loading
src/SpecialFunctions.h +5 −3 Original line number Diff line number Diff line #ifndef GAMMAFUNCTION_H #define GAMMAFUNCTION_H #ifndef PSI_SPECIAL_FUNCTIONS_H #define PSI_SPECIAL_FUNCTIONS_H #include "GslWrapper.h" namespace PsimagLite { std::complex<double> LnGammaFunction(const std::complex<double>&); double Ci(const double& x); } #endif // GAMMAFUNCTION_H #endif // PSI_SPECIAL_FUNCTIONS_H