cgwt Subroutine

subroutine cgwt(num_pts, x, w)

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: num_pts
real(kind=wp), intent(out), dimension(:):: x
real(kind=wp), intent(out), dimension(:):: w

Contents

Source Code


Source Code

    subroutine cgwt(num_pts, x, w)

        ! This function determines the points and weights associated
        ! with Chebyshev-Gauss quadrature

        ! Variables in/out
        integer, intent(in) :: num_pts
        real(wp), intent(out), dimension(:) :: x, w

        ! Local variables
        integer:: ii
        real(wp), parameter:: pi = 4._wp*datan(1._wp)

        x = cos( (dble(2*[( ii, ii=1,num_pts )]-1) )/dble(2*num_pts) * pi)

        w = pi/dble(num_pts) / ((1.0_wp - x**2._wp)**(-0.5_wp))

        ! print*, x
        ! print*, w
        ! stop
        return
    end subroutine cgwt