18 double precision function dli2(x)
20 double precision :: x, y, r, s, z, p, q, l, dhorner
21 double precision,
parameter :: PI = 3.14159265358979324d0
22 double precision,
parameter :: cp(8) = (/ &
23 1.0706105563309304277d+0, &
24 -4.5353562730201404017d+0, &
25 7.4819657596286408905d+0, &
26 -6.0516124315132409155d+0, &
27 2.4733515209909815443d+0, &
28 -4.6937565143754629578d-1, &
29 3.1608910440687221695d-2, &
30 -2.4630612614645039828d-4 /)
31 double precision,
parameter :: cq(8) = (/ &
32 1.0000000000000000000d+0, &
33 -4.5355682121856044935d+0, &
34 8.1790029773247428573d+0, &
35 -7.4634190853767468810d+0, &
36 3.6245392503925290187d+0, &
37 -8.9936784740041174897d-1, &
38 9.8554565816757007266d-2, &
39 -3.2116618742475189569d-3 /)
45 r = -pi**2/6 + l*(0.5d0*l - log(-x))
47 elseif (x .eq. -1)
then 50 elseif (x .lt. 0)
then 52 r = -0.5d0*log(1 - x)**2
54 elseif (x .eq. 0)
then 57 elseif (x .lt. 0.5d0)
then 61 elseif (x .lt. 1)
then 63 r = pi**2/6 - log(x)*log(1 - x)
65 elseif (x .eq. 1)
then 68 elseif (x .lt. 2)
then 71 r = pi**2/6 - l*(log(1 - 1/x) + 0.5d0*l)
75 r = pi**2/3 - 0.5d0*log(x)**2
96 double complex function cdli2(z)
98 double complex :: z, rest, u, u2, u4, sum, fast_cdlog
99 double precision :: rz, iz, nz, sgn, dli2
100 double precision,
parameter :: PI = 3.14159265358979324d0
101 double precision,
parameter :: bf(10) = (/ &
105 + 1.0d0/211680.0d0, &
106 - 1.0d0/10886400.0d0, &
107 + 1.0d0/526901760.0d0, &
108 - 4.0647616451442255d-11, &
109 + 8.9216910204564526d-13, &
110 - 1.9939295860721076d-14, &
111 + 4.5189800296199182d-16 /)
118 if (rz .le. 1)
cdli2 = dcmplx(dli2(rz), 0)
119 if (rz .gt. 1)
cdli2 = dcmplx(dli2(rz), -pi*log(rz))
125 if (nz .lt. epsilon(1d0))
then 131 if (rz .le. 0.5d0)
then 133 u = -fast_cdlog(1 - 1/z)
134 rest = -0.5d0*fast_cdlog(-z)**2 - pi**2/6
137 u = -fast_cdlog(1 - z)
142 if (nz .le. 2*rz)
then 144 rest = u*fast_cdlog(1 - z) + pi**2/6
147 u = -fast_cdlog(1 - 1/z)
148 rest = -0.5d0*fast_cdlog(-z)**2 - pi**2/6
162 u4*(bf(5) + u2*bf(6)) + &
163 u4*u4*(bf(7) + u2*bf(8) + u4*(bf(9) + u2*bf(10))) &
166 cdli2 = sgn*sum + rest
179 double precision function dhorner(x, c, len)
182 double precision :: x, c(len)
201 double precision :: re, im
205 fast_cdlog = dcmplx(0.5d0*log(re**2 + im**2), datan2(im, re))
218 subroutine li2c(re_in, im_in, re_out, im_out) bind(C, name="li2c_")
220 double precision,
intent(in) :: re_in, im_in
221 double precision,
intent(out) :: re_out, im_out
222 double complex z, l, cdli2
224 z = dcmplx(re_in, im_in)
double precision function dli2(x)
Real dilogarithm .
double precision function dhorner(x, c, len)
Evaluation of polynomial P(x) with len coefficients c.
double complex function cdli2(z)
Complex dilogarithm .
double complex function fast_cdlog(z)
Fast implementation of complex logarithm.
subroutine li2c(re_in, im_in, re_out, im_out)
C wrapper for complex dilogarithm.