Subroutine to compute the quadrature matrices
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=pfdp), | intent(out) | :: | qmat(ndst-1,nsrc) | O to dst quadrature weights |
||
real(kind=pfdp), | intent(out) | :: | smat(ndst-1,nsrc) | dst(m) to dst(m+1) quadrature weights |
||
real(kind=pfqp), | intent(in) | :: | dst(ndst) | Destination points |
||
real(kind=pfqp), | intent(in) | :: | src(nsrc) | Source points |
||
integer, | intent(in) | :: | flags(nsrc) | |||
integer, | intent(in), | value | :: | ndst | Number of destination points |
|
integer, | intent(in), | value | :: | nsrc | Number of source points |
subroutine sdc_qmats(qmat, smat, dst, src, flags, ndst, nsrc)
integer , intent(in), value :: ndst !! Number of destination points
integer , intent(in), value :: nsrc !! Number of source points
real(pfqp), intent(in) :: dst(ndst) !! Destination points
real(pfqp), intent(in) :: src(nsrc) !! Source points
real(pfdp), intent(out) :: qmat(ndst-1, nsrc) !! O to dst quadrature weights
real(pfdp), intent(out) :: smat(ndst-1, nsrc) !! dst(m) to dst(m+1) quadrature weights
integer , intent(in) :: flags(nsrc)
integer :: i, j, m
real(pfqp) :: q, s, den, p(0:nsrc)
qmat = 0.0_pfqp
smat = 0.0_pfqp
! construct qmat and smat
do i = 1, nsrc
if (not_proper(flags, i)) cycle
! construct interpolating polynomial coefficients
p = 0.0_pfdp
p(0) = 1.0_pfdp
do m = 1, nsrc
if (not_proper(flags, m) .or. m == i) cycle
p = eoshift(p, -1) - src(m) * p
end do
den = poly_eval(p, nsrc, src(i))
call poly_int(p, nsrc)
! evaluate integrals
do j = 2, ndst
q = poly_eval(p, nsrc, dst(j)) - poly_eval(p, nsrc, 0.0_pfqp)
s = poly_eval(p, nsrc, dst(j)) - poly_eval(p, nsrc, dst(j-1))
qmat(j-1,i) = real(q / den, pfqp)
smat(j-1,i) = real(s / den, pfqp)
end do
end do
end subroutine sdc_qmats