MathUtils Module Source file:MathUtils

Dependencies

Subroutines
  • brentq(obj, func, ax, bx, tol, xzero, fzero, iflag, fax, fbx)
    • class(*)  :: obj
    • real(dl) external :: func a class function f(obj,x)
    • real(dl) intent(in) :: ax left endpoint of initial interval
    • real(dl) intent(in) :: bx right endpoint of initial interval
    • real(dl) intent(in) :: tol desired length of the interval of uncertainty of the final result (>=0)
    • real(dl) intent(out) :: xzero abscissa approximating a zero of `f` in the interval `ax`,`bx`
    • real(dl) intent(out) :: fzero value of `f` at the root (`f(xzero)`)
    • integer intent(out) :: iflag status flag (`-1`=error, `0`=root found)
    • real(dl) intent(in),optional :: fax if `f(ax)` is already known, it can be input here
    • real(dl) intent(in),optional :: fbx if `f(bx)` is already known, it can be input here
  • Gauss_Legendre(n, x, w)
    Get Gauss-Legendre points x and weights w, for n points
    • integer intent(in) :: n
    • real(dl) intent(out) :: x(n)
    • real(dl) intent(out) :: w(n)
  • GetThreeJs(l2in, l3in, m2in, m3in, thrcof)
    Recursive evaluation of 3j symbols. Does minimal error checking on input parameters.
    • integer intent(in) :: l2in
    • integer intent(in) :: l3in
    • integer intent(in) :: m2in
    • integer intent(in) :: m3in
    • real(dl) dimension(*) :: thrcof
  • integrate_3j(lmax, lmax_w, n, W, dopol, M)
    Get coupling matrix, eg for pesudo-CL
    • integer intent(in) :: lmax
    • integer intent(in) :: lmax_w
    • integer intent(in) :: n
    • real(dl) intent(in) :: W(0:lmax_w,n)
    • logical intent(in) :: dopol
    • real(dl) intent(out) :: M(0:lmax,0:lmax, n)
Functions
  • real(dl)
    GetChiSquared(n, Y, c_inv)
    get dot_product(matmul(C_inv,Y), Y) efficiently assuming c_inv symmetric
    • integer intent(in) :: n
    • real(dl) intent(in) :: Y(n)
    • real(dl) intent(in) :: c_inv(n,n)
  • real(dl)
    Integrate_Romberg(obj, fin, a, b, tol, maxit, minsteps, abs_tol)
    Rombint returns the integral from a to b of f(obj,x) using Romberg integration. The method converges provided that f is continuous in (a,b). f must be real(dl). The first argument is a class instance. tol indicates the desired relative accuracy in the integral. Modified by AL to specify max iterations and minimum number of steps (min steps useful to stop wrong results on periodic or sharp functions)
    • class(*)  :: obj
    • real(dl) external :: fin a class function
    • real(dl) intent(in) :: a
    • real(dl) intent(in) :: b
    • real(dl) intent(in) :: tol
    • integer intent(in), optional :: maxit
    • integer intent(in), optional :: minsteps
    • logical intent(in), optional :: abs_tol
  • real(dl)
    Newton_Raphson2(xxl, xxh, funcs, param, param2)
    • real(dl) intent(in) :: xxl root bracket 1
    • real(dl) intent(in) :: xxh root bracket 2
    • external  :: funcs subroutine for non-linear equation
    • real(dl) intent(in) :: param parameters for function
    • real(dl) intent(in) :: param2 parameters for function
  • real(dl)
    obj_function(obj, x)
    • class(*)  :: obj
    • real(dl)  :: x