Cartesius Library
MathematicalSubroutines.f90 File Reference

Data Types

interface  mathematicalsubroutines::real_f_one_var
 Abstract interface required to pass any real function of one variable into the numerical integration algorithm. More...
 

Modules

module  mathematicalsubroutines
 contains either true mathematical procedures or wrappers of to the standard libraries (lapack) to assure communication with the cartesius data structures
 

Functions/Subroutines

real(doubleprecision) function mathematicalsubroutines::det (rin)
 calculates the determinant of 3x3 matrix rin More...
 
integer function mathematicalsubroutines::gcd (M, N)
 calculates the greast common divisor of (m,n) More...
 
integer function mathematicalsubroutines::lcm (M, N)
 calculates the Least common factor of (m,n) More...
 
integer(8) function mathematicalsubroutines::factorial (n)
 calculates the Factorial(n) More...
 
real function mathematicalsubroutines::factorial_real (n)
 Real version of the factorial function. More...
 
real function mathematicalsubroutines::doublefactorial_real (n)
 
integer function mathematicalsubroutines::binomialcoefficient (n, m)
 calculates the BinomialCoefficient(n,m) of integers n and m More...
 
real function mathematicalsubroutines::binomialcoefficient_real (n, m)
 Real number version of the Binomial Coefficient function. More...
 
real function mathematicalsubroutines::lorentzian (w, w0, width)
 calculates the Lorentzian shape at frequency w centered at w0 with width width; integral wrt w equals to unity. More...
 
real function mathematicalsubroutines::lorentzim (w, w0, width)
 calculates the Lorentzian shape at frequency w centered at w0 with width width; integral wrt w equals to unity. \( \frac{1}{\pi} \frac{\gamma}{(\omega - \omega_0)^2 - \gamma^2} \) More...
 
real function mathematicalsubroutines::lorentzre (w, w0, width)
 calculates the real part of Lorentzian shape at frequency w centered at w0 with width width. Magnitude conforms with the imaginary part having integral of unity. More...
 
real function mathematicalsubroutines::gaussian (w, w0, width)
 calculates the real Gaussian shape at frequency w centered at w0 with width width; integral wrt w equals to unity. Magnitude conforms with the integral of unity. More...
 
real function mathematicalsubroutines::wigner3jm (j1, j2, j3, m1, m2, m3)
 calculates the Wigner 3jm symbol for integer arguments j1 j2 j3 m1 m2 m3 More...
 
real function mathematicalsubroutines::gauntcoefficient (k, l1, m1, l2, m2)
 calculates the Gaunt coefficient for intermediate momentum k for the momenta l1,l2 and projections of momenta m1,m2 More...
 
real function mathematicalsubroutines::pleg (l, m, x)
 calculates the m-th adjoint of n-th Legendre polynomial More...
 
real function mathematicalsubroutines::legendre_polynomial (l, m, x)
 General Legendre polynomial function which accepts negative m. More...
 
complex function mathematicalsubroutines::spherical_function (l, m, teta, phi)
 Calculates complex spherical function with Condon-Shortley phase. More...
 
real function mathematicalsubroutines::upperincompletegammaf (n, x)
 Calculates the "upper" incomplete gamma function defined as. More...
 
real function mathematicalsubroutines::upperincompletegammaf_real (s, x)
 Calculates the upper incomplete gamma function defined above for non-integer values of n (renamed to s) More...
 
real function mathematicalsubroutines::lowerincompletegammaf (n, x)
 Calculates the lower incomplete gamma function, the complement to the upper incomplete gamma function, for integer n. More...
 
real function mathematicalsubroutines::lowerincompletegammaf_real (s, x)
 Calculates the lower incomplete gamma function for non-integer values of n (renamed to s) More...
 
complex function mathematicalsubroutines::ex (M, S, C)
 
integer function mathematicalsubroutines::isig (N)
 
integer function mathematicalsubroutines::ihvside (n)
 Heaviside function on integers. Returns 1 if n >= 0 and 0 otherwise. More...
 
subroutine mathematicalsubroutines::sdiagv (N, A, D, X)
 MATRIX DIAGONALIZATION PROCEDURE WE USED FOR DECADES... IS GOOD DUE TO FACT THAT IT SORTS THE EIGENVALUES. More...
 
subroutine mathematicalsubroutines::simplex (start, n, EPSILON, scale, iprint, func, finish, valmin)
 gradientless minimization of function func. Our DirtyTricks are used to make the interface modern (transmission fo the function by pointer More...
 
subroutine mathematicalsubroutines::svdcmp (a, m, n, mp, np, w, v)
 Singular value decomposition of matrix A. More...
 
subroutine mathematicalsubroutines::gradient_minimization (pFunction, pFirstDerivative, init_variables, step, prec, reset)
 Function allows to find local minimum of function by using gradient optimization methid. More...
 
real function mathematicalsubroutines::adapt_simpson_int (f, x_min, x_max, iprec, pars)
 Performs adaptive Simpson's numerical integration of a real function of one variable. This algorithm finds the optimal number of points required to reach the given accuracy of integration, which usually allows to decrease number of function evaluations compared to standard integration algorithm. More...
 
recursive real function adapt_simpson_rec (f, a, fa, b, fb, eps, whole, m, fm, depth, pars)
 
subroutine simpson_interval (f, a, fa, b, fb, m, fm, intg, pars)
 
real function, dimension(2) mathematicalsubroutines::optimize_f_goldensection (f, xmin, xmax, prec, pars)
 Finds minimum of a real function of one variable in a given interval using golden-section search method. Can be used for any unimodal function, when the gradients are not known. Returns an interval where the minimum is located with required precision. More...
 
real function mathematicalsubroutines::opt_scalar_brent (f, xmin, xmax, tol, stat, pars)
 Finds minimum of scalar function f bracketed by [xmin, xmax] More...
 
real function mathematicalsubroutines::solve_scalar_brent (f, xmin, xmax, tol, stat, pars)
 Finds simple root of scalar function f bracketed by [xmin, xmax] More...
 
recursive subroutine mathematicalsubroutines::generalizedlaguerrepolynomialcoefficients (n, l, coef_array)
 
subroutine mathematicalsubroutines::getjacobirotationmatrix (space_dim, dim1, dim2, angle, JacobiMatrix)
 produces Jacobi rotation matrix for angle angle of the size space_dim x space_dim for a pair of components with numbers dim1, dim2 More...
 
subroutine mathematicalsubroutines::getfirstderivativeofjacobirotationmatrix (space_dim, dim1, dim2, angle, DerivativeMatrix)
 produces first derivative wrt angle of the Jacobi rotation matrix for angle angle of the size space_dim x space_dim for a pair of components with numbers dim1, dim2 More...
 
subroutine mathematicalsubroutines::getsecondderivativeofjacobirotationmatrix (space_dim, dim1, dim2, angle, DerivativeMatrix)
 produces second derivative wrt angle of the Jacobi rotation matrix for angle angle of the size space_dim x space_dim for a pair of components with numbers dim1, dim2 More...
 
subroutine mathematicalsubroutines::rotate_matrix_left (space_dim, dim1, dim2, angle, mat)
 Multiplies the given matrix by a Jacobi rotation matrix from the left. More...
 
subroutine mathematicalsubroutines::rotate_matrix_right (space_dim, dim1, dim2, angle, mat)
 Multiplies the given matrix by a Jacobi rotation matrix from the left. More...
 
subroutine mathematicalsubroutines::jacobi (n, a, d, v)
 Diagonalization of matrix a(n,n) by Jacobi method n is the matrix dimension a(n,n) - matrix d(n) - eigenvalues array v(n,n) – eigenvectors array. More...
 
real function, dimension(n, n) mathematicalsubroutines::adj_singular (n, M)
 Calculates adjugate matrix of the degenerate NxN matrix M (detM = 0). More...
 

Variables

logical, private mathematicalsubroutines::ifreach
 Private variable required for the adaptive numerical integration: More...
 

Function/Subroutine Documentation

◆ adapt_simpson_rec()

recursive real function adapt_simpson_int::adapt_simpson_rec ( procedure(real_f_one_var), intent(in), pointer  f,
real, intent(in)  a,
real, intent(in)  fa,
real, intent(in)  b,
real, intent(in)  fb,
real, intent(in)  eps,
real, intent(in)  whole,
real, intent(in)  m,
real, intent(in)  fm,
integer, intent(inout)  depth,
class(*), intent(inout), optional, pointer  pars 
)
Here is the call graph for this function:

◆ simpson_interval()

subroutine adapt_simpson_int::simpson_interval ( procedure(real_f_one_var), intent(in), pointer  f,
real, intent(in)  a,
real, intent(in)  fa,
real, intent(in)  b,
real, intent(in)  fb,
real, intent(out)  m,
real, intent(out)  fm,
real, intent(out)  intg,
class(*), intent(inout), optional, pointer  pars 
)