Add Lagrange interpolation subroutine and update calls in prolongrestrict modules
This commit is contained in:
@@ -1177,6 +1177,30 @@ end subroutine d2dump
|
||||
|
||||
return
|
||||
end subroutine polint
|
||||
|
||||
subroutine polint0(xa, ya, y, ordn)
|
||||
! Lagrange interpolation at x=0, O(n) direct formula
|
||||
implicit none
|
||||
integer, intent(in) :: ordn
|
||||
real*8, dimension(ordn), intent(in) :: xa, ya
|
||||
real*8, intent(out) :: y
|
||||
|
||||
integer :: j, k
|
||||
real*8 :: wj
|
||||
|
||||
y = 0.d0
|
||||
do j = 1, ordn
|
||||
wj = 1.d0
|
||||
do k = 1, ordn
|
||||
if (k .ne. j) then
|
||||
wj = wj * xa(k) / (xa(k) - xa(j))
|
||||
endif
|
||||
enddo
|
||||
y = y + wj * ya(j)
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine polint0
|
||||
!------------------------------------------------------------------------------
|
||||
!
|
||||
! interpolation in 2 dimensions, follow yx order
|
||||
|
||||
Reference in New Issue
Block a user