This function computes the Hermite cubic interpolant at a point s.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | f0 |
Function value at the start of the interval. |
||
| real(kind=dp), | intent(in) | :: | fp0 |
Derivative value at the start of the interval. |
||
| real(kind=dp), | intent(in) | :: | f1 |
Function value at the end of the interval. |
||
| real(kind=dp), | intent(in) | :: | fp1 |
Derivative value at the end of the interval. |
||
| real(kind=dp), | intent(in) | :: | dels |
Width of the interpolation interval. |
||
| real(kind=dp), | intent(in) | :: | s |
Local coordinate of the interpolation point to the start. |
elemental pure function qofs(f0, fp0, f1, fp1, dels, s) result(res) !! This function computes the Hermite cubic interpolant at a point `s`. real(dp), intent(in) :: f0 !! Function value at the start of the interval. real(dp), intent(in) :: fp0 !! Derivative value at the start of the interval. real(dp), intent(in) :: f1 !! Function value at the end of the interval. real(dp), intent(in) :: fp1 !! Derivative value at the end of the interval. real(dp), intent(in) :: dels !! Width of the interpolation interval. real(dp), intent(in) :: s !! Local coordinate of the interpolation point to the start. real(dp) :: res real(dp) :: dd01, dd001, dd011, dd0011 ! Calculate divided differences sequentially dd01 = (f1 - f0)/dels dd001 = (dd01 - fp0)/dels dd011 = (fp1 - dd01)/dels dd0011 = (dd011 - dd001)/dels ! Evaluate the cubic polynomial using Horner's method res = ((dd0011*(s - dels) + dd001)*s + fp0)*s + f0 end function qofs