The unique with for a bspline_1d (for example, a monotonic spline). This is a wrapper for db1root.
Returns iflag=4005 if there is no solution, and iflag=4006
if there is more than one (in which case x is the smallest).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(bspline_1d), | intent(inout) | :: | me |
the spline |
||
| real(kind=wp), | intent(in) | :: | y |
the spline value |
||
| real(kind=wp), | intent(out) | :: | x |
the solution of |
||
| integer(kind=ip), | intent(out) | :: | iflag |
status flag (see db1root) |
pure subroutine inverse_1d(me,y,x,iflag) implicit none class(bspline_1d),intent(inout) :: me !! the spline real(wp),intent(in) :: y !! the spline value real(wp),intent(out) :: x !! the solution of \( s(x) = y \) integer(ip),intent(out) :: iflag !! status flag (see [[db1root]]) real(wp),dimension(:),allocatable :: roots !! all the roots of \( s(x) = y \) x = 0.0_wp call me%roots(y,roots,iflag) if (iflag==0_ip .or. iflag==4004_ip) then if (size(roots)>0) x = roots(1) if (iflag==4004_ip .or. size(roots)>1) then iflag = 4006_ip ! s(x) = y on a whole interval, or more than one root else if (size(roots)==0) then iflag = 4005_ip end if end if me%iflag = iflag end subroutine inverse_1d