50 integer,
intent(in) :: n
51 real(
dp),
intent(in) :: alpha, beta
54 real(
dp) :: ab, abi, a2b2
56 allocate (jacmat%diagonal(n))
57 allocate (jacmat%off_diagonal(n - 1))
61 jacmat%diagonal(1) = (beta - alpha) / abi
62 jacmat%off_diagonal(1) = 4.0_dp * (1.0_dp + alpha) * (1.0_dp + beta) &
63 / ((abi + 1.0_dp) * abi * abi)
64 a2b2 = beta * beta - alpha * alpha
66 abi = 2.0_dp * idx + ab
67 jacmat%diagonal(idx) = a2b2 / ((abi - 2.0_dp) * abi)
70 jacmat%off_diagonal(idx) = 4.0_dp * idx * (idx + alpha) * (idx + beta) &
71 * (idx + ab) / ((abi - 1.0_dp) * abi)
74 jacmat%off_diagonal(1:n - 1) = sqrt(jacmat%off_diagonal(1:n - 1))
90 real(
dp),
intent(in) :: alpha, beta
97 zmom = 2.0_dp**(alpha + beta + 1.0_dp) * exp(log_gamma(alpha + 1.0_dp) &
98 + log_gamma(beta + 1.0_dp) - log_gamma(abi))
100 if (zmom <= 0.0_dp)
then
101 error stop
"Zeroth moment is not positive but should be"
This module provides utility functions for computing Jacobi matrices and zeroth moments.
type(gjp_sparse_matrix) function jacobi_matrix(n, alpha, beta)
Computes the Jacobi matrix for given parameters.
real(dp) function jacobi_zeroeth_moment(alpha, beta)
Computes the zeroth moment for Jacobi polynomials.
Module for defining types and precision levels for Gauss-Jacobi Polynomial (GJP) calculations.
integer, parameter, public dp
Define various kinds for real numbers.
Sparse representation of a Jacobi matrix.