26 use,
intrinsic :: iso_c_binding, only: c_double
27 use,
intrinsic :: iso_fortran_env
117 real(c_double) function expm1(x) bind(c, name=
'expm1')
119 real(c_double),
intent(in),
value :: x
144 real(real64),
intent(in) :: x, y
145 real(real64),
optional,
intent(in) :: rtol
146 real(real64),
optional,
intent(in) :: atol
147 real(real64) :: atol_, rtol_
149 atol_ = optional_default(atol, 1.e-8_real64)
150 rtol_ = optional_default(rtol, 1.e-5_real64)
157 complex(real64),
intent(in) :: x, y
158 real(real64),
optional,
intent(in) :: rtol
159 real(real64),
optional,
intent(in) :: atol
160 real(real64) :: atol_, rtol_
162 atol_ = optional_default(atol, 1.e-8_real64)
163 rtol_ = optional_default(rtol, 1.e-5_real64)
173 integer,
intent(in) :: dim
174 integer,
intent(in) :: diag
175 integer :: matrix(dim, dim)
181 matrix(ii, ii) = diag
187 recursive function hermite(n, x)
result (h)
188 integer,
intent(in) :: n
189 real(real64),
intent(in) :: x
207 recursive function factorial (n)
RESULT (fac)
208 integer,
intent(in) :: n
224 real(real64),
intent(in) :: xx(3)
225 integer,
intent(in) :: li, mi
226 complex(real64),
intent(out) :: ylm
229 real(real64) :: dx, dy, dz, r, plm, cosm, sinm, cosmm1, sinmm1, cosphi, sinphi
230 real(real64),
parameter :: tiny = 1.e-15_real64
236 ylm = cmplx(
sqrt(m_one/(m_four*m_pi)), m_zero, real64)
240 r =
sqrt(xx(1)**2 + xx(2)**2 + xx(3)**2)
253 if(abs(dz) > m_one) dz = sign(m_one, dz)
254 plm = loct_legendre_sphplm(li, abs(mi), dz)
257 r =
sqrt(dx*dx + dy*dy)
271 cosm = cosmm1*cosphi - sinmm1*sinphi
272 sinm = cosmm1*sinphi + sinmm1*cosphi
276 ylm = plm*cmplx(cosm, sinm, real64)
295 real(real64),
intent(in) :: xx(3)
296 integer,
intent(in) :: li, mi
297 real(real64),
intent(out) :: ylm
299 integer,
parameter :: lmaxd = 20
300 real(real64),
parameter :: tiny = 1.e-15_real64
301 integer :: i, ilm0, l, m, mabs
302 integer,
save :: lmax = -1
304 real(real64) :: cmi, cosm, cosmm1, cosphi, fac, &
305 fourpi, plgndr, phase, pll, pmm, pmmp1, sinm, &
306 sinmm1, sinphi, rsize, rx, ry, rz, xysize
307 real(real64),
save :: c(0:(lmaxd+1)*(lmaxd+1))
320 do i = l - m + 1, l + m
323 c(ilm0 + m) =
sqrt(fac)
325 if (m /= 0) c(ilm0 + m) = c(ilm0 + m)*
sqrt(m_two)
326 c(ilm0 - m) = c(ilm0 + m)
339 rsize =
sqrt(xx(1)**2 + xx(2)**2 + xx(3)**2)
340 if (rsize < tiny)
then
365 ylm = c(4)*6.0_real64*rx*ry
367 ylm = (-c(5))*m_three*ry*rz
369 ylm = c(6)*m_half*(m_three*rz*rz - m_one)
371 ylm = (-c(7))*m_three*rx*rz
373 ylm = c(8)*m_three*(rx*rx - ry*ry)
380 xysize =
sqrt(max(rx*rx + ry*ry, tiny))
388 cosm = cosmm1*cosphi - sinmm1*sinphi
389 sinm = cosmm1*sinphi + sinmm1*cosphi
400 if (mabs > m_zero)
then
402 pmm = (-pmm)*fac*xysize
410 pmmp1 = rz*(2*mabs + 1)*pmm
411 if (li == mabs + 1)
then
415 pll = (rz*(2*l - 1)*pmmp1 - (l + mabs - 1)*pmm)/(l - mabs)
425 ylm = cmi*plgndr*phase
443 real(real64),
intent(in) :: xx(3)
444 integer,
intent(in) :: li, mi
445 real(real64),
intent(out) :: ylm
446 real(real64),
intent(out) :: grad_theta
447 real(real64),
intent(out) :: grad_phi_oversin
449 real(real64),
parameter :: tiny = 1.e-15_real64
450 real(real64) :: rsize, costh, sinth, ylm_lm1, ylm_negm, gfac
456 rsize =
sqrt(xx(1)**2 + xx(2)**2 + xx(3)**2)
457 if (li == 0 .or. rsize < tiny)
then
459 grad_phi_oversin = m_zero
464 sinth =
sqrt(max(m_one - costh**2, m_zero))
465 if (sinth < tiny)
then
468 grad_phi_oversin = m_zero
473 if (li - 1 >= abs(mi))
then
475 gfac = real(li + abs(mi), real64) * &
476 sqrt(real((2*li+1)*(li-abs(mi)), real64) / real((2*li-1)*(li+abs(mi)), real64))
477 grad_theta = (real(li, real64)*costh*ylm - gfac*ylm_lm1)/sinth
480 grad_theta = real(li, real64)*costh*ylm/sinth
485 grad_phi_oversin = m_zero
488 grad_phi_oversin = -real(mi, real64)*ylm_negm/sinth
503 real(real64) function
real_gaunt(l1, m1, l2, m2, l3, m3) result(coeff)
504 integer,
intent(in) :: l1, m1, l2, m2, l3, m3
506 integer,
parameter :: lmax_cache = 6
507 integer,
parameter :: ngauss = 16
508 integer,
parameter :: nphi = 72
509 real(real64),
save :: cache(0:lmax_cache, -lmax_cache:lmax_cache, &
510 0:lmax_cache, -lmax_cache:lmax_cache, 0:lmax_cache, -lmax_cache:lmax_cache)
511 logical,
save :: initialized(0:lmax_cache, -lmax_cache:lmax_cache, &
512 0:lmax_cache, -lmax_cache:lmax_cache, 0:lmax_cache, -lmax_cache:lmax_cache) = .false.
513 real(real64),
save :: gl_x(1:ngauss), gl_w(1:ngauss)
514 logical,
save :: gl_initialized = .false.
517 real(real64) :: phi, dphi, y1, y2, y3, xx(3), sintheta
521 assert(l1 >= 0 .and. l1 <= lmax_cache)
522 assert(l2 >= 0 .and. l2 <= lmax_cache)
523 assert(l3 >= 0 .and. l3 <= lmax_cache)
524 assert(abs(m1) <= l1)
525 assert(abs(m2) <= l2)
526 assert(abs(m3) <= l3)
528 if (.not. gl_initialized)
then
530 call gauss_legendre_newton(ngauss, gl_x, gl_w)
531 gl_initialized = .
true.
534 if (.not. initialized(l1, m1, l2, m2, l3, m3))
then
535 dphi = m_two*m_pi/real(nphi, real64)
539 sintheta =
sqrt(max(m_one - gl_x(ix)**2, m_zero))
541 phi = (real(iphi, real64) - m_half)*dphi
542 xx(1) = sintheta*
cos(phi)
543 xx(2) = sintheta*
sin(phi)
550 coeff = coeff + y1*y2*y3*gl_w(ix)*dphi
554 cache(l1, m1, l2, m2, l3, m3) = coeff
555 initialized(l1, m1, l2, m2, l3, m3) = .
true.
558 coeff = cache(l1, m1, l2, m2, l3, m3)
572 subroutine weights(N, M, cc, side)
573 integer,
intent(in) :: n, m
574 real(real64),
intent(out) :: cc(0:,0:,0:)
575 integer,
optional,
intent(in) :: side
577 integer :: i, j, k, mn, side_
578 real(real64) :: c1, c2, c3, c4, c5, xi
579 real(real64),
allocatable :: x(:)
583 safe_allocate(x(0:m))
585 if (
present(side))
then
595 x(:) = (/(-i,i=0,mn)/)
599 x(:) = (/(i,i=0,mn)/)
603 x(:) = (/0,(-i,i,i=1,mn)/)
626 if (j <= n) cc(k, j - 1, j) = m_zero
627 cc(k, j, 0) = c4*cc(k, j - 1, 0)/c3
630 cc(k, j, i) = (c4*cc(k, j - 1, i) - i*cc(k, j - 1, i - 1))/c3
633 cc(j, j, 0) = -c1*c5*cc(j - 1, j - 1, 0) / c2
637 cc(j, j, i) = c1*(i*cc(j - 1, j - 1, i - 1) - c5*cc(j - 1, j - 1, i))/c2
648 real(real64)
pure function
ddelta(i, j)
649 integer,
intent(in) :: i
650 integer,
intent(in) :: j
664 integer,
intent(in) :: nn
665 real(real64),
intent(in) :: xa(:)
666 real(real64),
intent(in) :: xx
667 real(real64),
contiguous,
intent(out) :: cc(:)
677 cc(ii) = cc(ii)*(xx - xa(kk))/(xa(ii) - xa(kk))
686 logical pure function
even(n)
687 integer,
intent(in) :: n
689 even = (mod(n, 2) == 0)
696 logical pure function
odd(n)
697 integer,
intent(in) :: n
707 real(real64),
contiguous,
intent(in) :: x(:)
708 real(real64),
contiguous,
intent(out) :: u(:)
711 real(real64) :: sumx2
712 real(real64),
allocatable :: xx(:)
718 assert(
size(u) == n-1)
721 safe_allocate(xx(1:n))
723 if (abs(x(j))<1.0e-8_real64)
then
734 sumx2 = sumx2 + xx(j)**2
736 if (abs(sumx2) <= m_epsilon .and. abs(xx(k)) <= m_epsilon)
exit
740 u(n-1) =
atan2(xx(n), xx(n-1))
754 real(real64),
contiguous,
intent(in) :: u(:)
755 real(real64),
contiguous,
intent(out) :: x(:)
763 assert(
size(u) == n-1)
770 x(2) =
sin(u(1))*
cos(u(2))
771 x(3) =
sin(u(1))*
sin(u(2))
774 x(2) =
sin(u(1))*
cos(u(2))
779 x(j) = x(j) *
sin(u(k))
781 x(j) = x(j) *
cos(u(j))
785 x(n) = x(n) *
sin(u(k))
787 x(n) = x(n) *
sin(u(n-1))
800 real(real64),
contiguous,
intent(out) :: grad_matrix(:,:)
801 real(real64),
intent(in) :: r
802 real(real64),
contiguous,
intent(in) :: x(:)
812 grad_matrix(1,1) = -r*
sin(x(1))
814 grad_matrix(m,1) = m_zero
821 grad_matrix(m,l) = -r*grad_matrix(m,l)*product(
sin(x(1:l)))
823 grad_matrix(m,l) = grad_matrix(m,l)*r*
cos(x(m))*
cos(x(l))*product(
sin(x(1:m-1)))*product(
sin(x(m+1:l-1)))
825 grad_matrix(m,l) = m_zero
832 grad_matrix(m,n) = r*
cos(x(m))*grad_matrix(m,n)*product(
sin(x(1:m-1)))*product(
sin(x(m+1:n-1)))
839 integer(int64) pure function
pad88(size, blk)
840 integer(int64),
intent(in) :: size
841 integer(int64),
intent(in) :: blk
849 pad88 =
size + blk - mm
854 integer(int64) pure function
pad48(size, blk)
855 integer,
intent(in) :: size
856 integer(int64),
intent(in) :: blk
862 integer(int64) pure function
pad8(size, blk)
863 integer(int64),
intent(in) :: size
864 integer,
intent(in) :: blk
870 integer pure function
pad4(size, blk)
871 integer,
intent(in) :: size
872 integer,
intent(in) :: blk
874 pad4 = int(
pad88(int(
size, int64), int(blk, int64)), int32)
883 integer pure function
pad_pow2(size)
884 integer,
intent(in) :: size
892 if (
size == 0)
return
898 if (mm - 2*mm2 /= 0)
exit
912 real(real64)
pure function
dlog2(xx)
913 real(real64),
intent(in) :: xx
920 integer pure function
ilog2(xx)
921 integer,
intent(in) :: xx
928 integer(int64) pure function
llog2(xx)
929 integer(int64),
intent(in) :: xx
931 llog2 = nint(
log2(real(xx, real64) ), kind=int64)
937 complex(real64),
intent(in) :: z
948 complex(real64) pure function
phi1(z)
949 complex(real64),
intent(in) :: z
951 real(real64),
parameter :: cut = 0.002_real64
953 if (abs(z) < cut)
then
954 phi1 = m_one + m_half*z*(m_one + z/m_three*(m_one + m_fourth*z*(m_one + z/m_five)))
967 complex(real64) pure function
phi2(z)
968 complex(real64),
intent(in) :: z
970 real(real64),
parameter :: cut = 0.002_real64
972 if (abs(z) < cut)
then
973 phi2 = m_half + z/6.0_real64*(m_one + m_fourth*z*(m_one + z/m_five*(m_one + z/6.0_real64)))
975 phi2 = (
exp(z) - z - m_z1)/z**2
982 real(real64),
intent(in) :: x
990 integer,
intent(in) :: n
997 message(1) =
"Internal error: is_prime does not take negative numbers."
998 call messages_fatal(1)
1006 root = nint(
sqrt(real(n, real64) ))
1008 if (mod(n,i) == 0)
then
1025 real(real64),
contiguous,
intent(out) :: r(:,:)
1026 real(real64),
intent(in) :: ff(:)
1027 real(real64),
contiguous,
intent(in) :: tt(:)
1029 integer :: dim, i, j
1030 real(real64) :: th, uv, uu, vv, ft
1031 real(real64),
allocatable :: axis(:), u(:), v(:),
f(:), t(:), p(:)
1037 assert((dim == 2) .or. (dim == 3))
1038 assert(
size(tt,1) == dim)
1039 assert((
size(r,1) == dim) .and. (
size(r,2) == dim))
1041 safe_allocate(u(1:dim))
1042 safe_allocate(v(1:dim))
1043 safe_allocate(
f(1:dim))
1044 safe_allocate(t(1:dim))
1051 ft = dot_product(
f,t)
1055 if (abs(ft) < m_one)
then
1068 safe_allocate(axis(1:dim))
1071 u =
f / dot_product(
f,
f)
1072 v = t /dot_product(t,t)
1075 axis = axis / norm2(axis)
1077 r(1,1) =
cos(th) + axis(1)**2 * (1 -
cos(th))
1078 r(1,2) = axis(1)*axis(2)*(1-
cos(th)) + axis(3)*
sin(th)
1079 r(1,3) = axis(1)*axis(3)*(1-
cos(th)) - axis(2)*
sin(th)
1081 r(2,1) = axis(2)*axis(1)*(1-
cos(th)) - axis(3)*
sin(th)
1082 r(2,2) =
cos(th) + axis(2)**2 * (1 -
cos(th))
1083 r(2,3) = axis(2)*axis(3)*(1-
cos(th)) + axis(1)*
sin(th)
1085 r(3,1) = axis(3)*axis(1)*(1-
cos(th)) + axis(2)*
sin(th)
1086 r(3,2) = axis(3)*axis(2)*(1-
cos(th)) - axis(1)*
sin(th)
1087 r(3,3) =
cos(th) + axis(3)**2 * (1 -
cos(th))
1089 safe_deallocate_a(axis)
1098 r(1,1) = u(1)**2 + (1-u(1)**2)*
cos(th)
1099 r(1,2) = u(1)*u(2)*(1-
cos(th)) - u(3)*
sin(th)
1100 r(1,3) = u(1)*u(3) + u(2)*
sin(th)
1102 r(2,1) = u(1)*u(2)*(1-
cos(th)) + u(3)*
sin(th)
1103 r(2,2) = u(2)**2 + (1-u(2)**2)*
cos(th)
1104 r(2,3) = u(2)*u(3)*(1-
cos(th)) - u(1)*
sin(th)
1106 r(3,1) = u(1)*u(3)*(1-
cos(th)) - u(2)*
sin(th)
1107 r(3,2) = u(2)*u(3)*(1-
cos(th)) + u(1)*
sin(th)
1108 r(3,3) = u(3)**2 + (1-u(3)**2)*
cos(th)
1113 safe_allocate(p(1:dim))
1115 if (abs(
f(1)) <= abs(
f(2)) .and. abs(
f(1)) < abs(
f(3)))
then
1116 p = (/m_one, m_zero, m_zero/)
1117 else if (abs(
f(2)) < abs(
f(1)) .and. abs(
f(2)) <= abs(
f(3)))
then
1118 p = (/m_zero, m_one, m_zero/)
1119 else if (abs(
f(3)) <= abs(
f(1)) .and. abs(
f(3)) < abs(
f(2)))
then
1120 p = (/m_zero, m_zero, m_one/)
1126 uu = dot_product(u,u)
1127 vv = dot_product(v,v)
1128 uv = dot_product(u,v)
1133 r(i,j) =
ddelta(i,j) - m_two * u(i)*u(j)/uu - m_two * v(i)*v(j)/vv &
1134 + 4_real64*uv * v(i)*u(j) /(uu*vv)
1139 safe_deallocate_a(p)
1155 safe_deallocate_a(u)
1156 safe_deallocate_a(v)
1172 real(real64),
intent(in) :: x, h
1173 real(real64),
intent(out) :: res, err
1176 use,
intrinsic :: iso_fortran_env
1178 real(real64),
intent(in) :: x
1179 real(real64),
intent(inout) :: fx
1183 real(real64),
parameter :: con = 1.4_real64, big = 1.0e30_real64, safe = m_two
1184 integer,
parameter :: ntab = 20
1186 real(real64) :: errt, fac, hh, fx1, fx2
1187 real(real64),
allocatable :: a(:, :)
1191 if (abs(h) <= m_epsilon)
then
1192 message(1) =
"h must be nonzero in numder_ridders"
1193 call messages_fatal(1)
1196 safe_allocate(a(1:ntab, 1:ntab))
1201 a(1,1) = (fx1-fx2) / (m_two*hh)
1207 a(1,i) = (fx1-fx2) / (m_two*hh)
1210 a(j,i) = (a(j-1,i)*fac-a(j-1,i-1)) / (fac-m_one)
1212 errt = max(abs(a(j,i)-a(j-1,i)),abs(a(j,i)-a(j-1,i-1)))
1213 if (errt .le. err)
then
1218 if (abs(a(i,i)-a(i-1,i-1)) .ge. safe*err)
then
1219 safe_deallocate_a(a)
1225 safe_deallocate_a(a)
1231 real(real64),
contiguous,
intent(in) :: a(:)
1232 complex(real64),
contiguous,
intent(in) :: b(:)
1234 complex(real64) :: c(1:3)
1236 c(1) = a(2)*b(3) - a(3)*b(2)
1237 c(2) = a(3)*b(1) - a(1)*b(3)
1238 c(3) = a(1)*b(2) - a(2)*b(1)
1244 complex(real64),
contiguous,
intent(in) :: a(:)
1245 real(real64),
contiguous,
intent(in) :: b(:)
1247 complex(real64) :: c(1:3)
1249 c(1) = a(2)*b(3) - a(3)*b(2)
1250 c(2) = a(3)*b(1) - a(1)*b(3)
1251 c(3) = a(1)*b(2) - a(2)*b(1)
1357 integer,
intent(in) :: np
1358 integer,
intent(in) :: nn, mm
1359 real(real64),
intent(in) :: xx(np)
1360 real(real64),
intent(out) :: cx(np)
1363 real(real64),
allocatable :: cx_tmp(:,:)
1367 safe_allocate(cx_tmp(1:np, 0:nn))
1379 cx_tmp(1:np,0) = m_one
1383 cx_tmp(ip,1) = real(mm + 1, real64) - xx(ip)
1390 (( real(mm + 2*ii - 1, real64) - xx(ip)) * cx_tmp(ip,ii-1) &
1391 + real(-mm -ii + 1, real64) * cx_tmp(ip,ii-2)) / real(ii, real64)
1396 cx(1:np) = cx_tmp(1:np, nn)
1398 safe_deallocate_a(cx_tmp)
1403 integer,
intent(in) :: nn
1404 real(real64),
contiguous,
intent(inout) :: aa(:, :)
1410 aa(jj, ii) = aa(ii, jj)
1416 integer,
intent(in) :: nn
1417 complex(real64),
contiguous,
intent(inout) :: aa(:, :)
1423 aa(jj, ii) = conjg(aa(ii, jj))
1425 aa(jj, jj) = real(aa(jj, jj), real64)
1430 integer,
intent(in) :: nn
1431 real(real64),
contiguous,
intent(inout) :: aa(:, :)
1437 aa(ii, jj) = aa(jj, ii)
1443 integer,
intent(in) :: nn
1444 complex(real64),
contiguous,
intent(inout) :: aa(:, :)
1450 aa(ii, jj) = conjg(aa(jj, ii))
1452 aa(jj, jj) = real(aa(jj, jj), real64)
1458 integer,
intent(in) :: nn
1459 real(real64),
contiguous,
intent(inout) :: aa(:, :)
1465 aa(ii, jj) = m_half * (aa(ii, jj) + aa(jj, ii))
1466 aa(jj, ii) = aa(ii, jj)
1473 integer,
intent(in) :: n
1474 complex(real64),
contiguous,
intent(inout) :: a(:, :)
1480 a(i, j) = m_half * (a(i, j) + conjg(a(j, i)))
1481 a(j, i) = conjg(a(i, j))
1488 real(real64),
contiguous,
intent(inout) :: aa(:, :)
1489 real(real64),
intent(in) :: tol
1498 real(real64),
intent(in) :: a(:, :)
1499 real(real64),
optional,
intent(in) :: tol
1501 real(real64) :: tolerance
1505 tolerance = optional_default(tol, 1.0e-8_real64)
1507 assert(
size(a, 1) ==
size(a, 2))
1516 logical pure function is_diagonal(dim, matrix, tol)
1517 integer,
intent(in) :: dim
1518 real(real64),
intent(in) :: matrix(:, :)
1519 real(real64),
intent(in) :: tol
1522 real(real64) :: max_diag
1526 max_diag = max(abs(matrix(ii, ii)), max_diag)
1533 if (abs(matrix(ii, jj)) > tol*max_diag)
is_diagonal = .false.
1541 integer,
intent(in) :: num
1542 integer,
intent(in) :: base
1543 integer,
contiguous,
intent(out) :: converted(:)
1545 integer :: i, num_, length
1552 length =
floor(
log(real(num, real64)) /
log(real(base, real64))) + 1
1553 assert(
size(converted) >= length)
1557 do i = 1,
size(converted)
1558 converted(i) = mod(num_, base)
1567 integer,
intent(in) :: converted(:)
1568 integer,
intent(in) :: base
1569 integer,
intent(out) :: num
1576 do i = 1,
size(converted)
1577 num = num + converted(i) * base**(i-1)
1585 pure real(real64) function cos_safe(deg)
1586 real(real64),
intent(in) :: deg
1588 if (abs(abs(deg) - 90.0_real64) < m_epsilon)
then
1590 else if (abs(deg) < m_epsilon)
then
1592 else if (abs(abs(deg) - 180.0_real64) < m_epsilon)
then
1602 pure real(real64) function sin_safe(deg)
1603 real(real64),
intent(in) :: deg
1605 if (abs(deg - 90.0_real64) < m_epsilon)
then
1607 else if (abs(deg + 90.0_real64) < m_epsilon)
then
1609 else if (abs(deg) < m_epsilon .or. abs(abs(deg) - 180.0_real64) < m_epsilon)
then
1617#include "complex.F90"
1618#include "math_inc.F90"
1622#include "math_inc.F90"
This is the common interface to a simple-minded polynomical interpolation procedure (simple use of th...
double acos(double __x) __attribute__((__nothrow__
double log(double __x) __attribute__((__nothrow__
double exp(double __x) __attribute__((__nothrow__
double sin(double __x) __attribute__((__nothrow__
double sqrt(double __x) __attribute__((__nothrow__
double cos(double __x) __attribute__((__nothrow__
double atan2(double __y, double __x) __attribute__((__nothrow__
double floor(double __x) __attribute__((__nothrow__
This module is intended to contain "only mathematical" functions and procedures.
subroutine zsymmetrize_matrix(n, a)
make a complex matrix Hermitian
complex(real64) pure function, public phi2(z)
Compute phi2(z) = (phi1(z)-1)/z = (exp(z) - z - 1)/z^2.
integer pure function ilog2(xx)
logical pure function, public even(n)
Returns if n is even.
pure real(real64) function, dimension(dim, dim) ddiagonal_matrix(dim, diag)
Currently only returns a matrix whose diagonal elements are all the same. Note that the integer versi...
subroutine, public generalized_laguerre_polynomial(np, nn, mm, xx, cx)
complex(real64) pure function, public exponential(z)
Wrapper for exponential.
subroutine dinterpolate_0(xa, ya, x, y)
subroutine, public ylmr_cmplx(xx, li, mi, ylm)
Computes spherical harmonics ylm at position (x, y, z)
subroutine zinterpolate_0(xa, ya, x, y)
subroutine, public convert_to_base(num, base, converted)
convert an integer in base 10 to a different base
subroutine dinterpolate_1(xa, ya, x, y)
real(real64) pure function dlog2(xx)
integer(int64) pure function pad88(size, blk)
real(real64) pure function, public square_root(x)
Wrapper for sqrt.
integer pure function pad4(size, blk)
subroutine dlower_triangular_to_hermitian(nn, aa)
pure complex(real64) function, dimension(1:3), public dzcross_product(a, b)
subroutine, public cartesian2hyperspherical(x, u)
Performs a transformation of an n-dimensional vector from Cartesian coordinates to hyperspherical coo...
integer pure function, public pad_pow2(size)
create array size, which is padded to powers of 2
pure real(real64) function, public cos_safe(deg)
Cosine of an angle in degrees, exact at multiples of 90 degrees.
subroutine, public dzero_small_elements_matrix(aa, tol)
subroutine zinterpolate_1(xa, ya, x, y)
pure real(real64) function, dimension(1:3), public dcross_product(a, b)
integer(int64) pure function pad48(size, blk)
subroutine dsymmetrize_matrix(nn, aa)
symmetrize a real matrix
subroutine, public ylmr_real_with_grad(xx, li, mi, ylm, grad_theta, grad_phi_oversin)
Real spherical harmonic together with its angular gradient.
subroutine, public ylmr_real(xx, li, mi, ylm)
This is a Numerical Recipes-based subroutine computes real spherical harmonics ylm at position (x,...
subroutine dupper_triangular_to_hermitian(nn, aa)
subroutine, public interpolation_coefficients(nn, xa, xx, cc)
logical function, public is_symmetric(a, tol)
Check if a 2D array is symmetric.
subroutine, public generate_rotation_matrix(R, ff, tt)
Generates a rotation matrix R to rotate a vector f to t.
elemental logical function zis_close_scalar(x, y, rtol, atol)
Same as dis_close_scalar for complex numbers.
logical pure function, public odd(n)
Returns if n is odd.
real(real64) pure function, public ddelta(i, j)
pure real(real64) function, public sin_safe(deg)
Sine of an angle in degrees, exact at multiples of 90 degrees.
logical function, public is_prime(n)
complex(real64) pure function, public phi1(z)
Compute phi1(z) = (exp(z)-1)/z.
pure complex(real64) function, dimension(1:3), public zcross_product(a, b)
subroutine, public weights(N, M, cc, side)
Compute the weights for finite-difference calculations:
subroutine zinterpolate_2(xa, ya, x, y)
pure complex(real64) function, dimension(dim, dim) zdiagonal_matrix(dim, diag)
Currently only returns a matrix whose diagonal elements are all the same. Note that the integer versi...
subroutine zlower_triangular_to_hermitian(nn, aa)
logical pure function, public is_diagonal(dim, matrix, tol)
Returns true is the matrix of size dim x dim is diagonal, given a relative tolerance.
subroutine zupper_triangular_to_hermitian(nn, aa)
pure integer function, dimension(dim, dim) idiagonal_matrix(dim, diag)
Currently only returns a matrix whose diagonal elements are all the same. Note that the real and comp...
integer(int64) pure function pad8(size, blk)
subroutine dinterpolate_2(xa, ya, x, y)
subroutine, public numder_ridders(x, h, res, err, f)
Numerical derivative (Ridder`s algorithm).
integer(int64) pure function llog2(xx)
recursive real(real64) function, public hermite(n, x)
elemental logical function dis_close_scalar(x, y, rtol, atol)
Are and equal within a tolerance.
pure complex(real64) function, dimension(1:3), public zdcross_product(a, b)
subroutine, public convert_from_base(converted, base, num)
convert an integer to base 10 from a different base
real(real64) function, public real_gaunt(l1, m1, l2, m2, l3, m3)
Real Gaunt coefficient , by quadrature.
subroutine, public hyperspherical2cartesian(u, x)
Performs the inverse transformation of cartesian2hyperspherical.
subroutine, public hypersphere_grad_matrix(grad_matrix, r, x)
Gives the hyperspherical gradient matrix, which contains the derivatives of the Cartesian coordinates...
recursive integer function, public factorial(n)
/* To use the profiling module, call profiling_in and profiling_out with the label of the region as a...
static double f(double w, void *p)