Select scaling values for beta
according to the algorithm given in the ODRPACK95
reference guide.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | np |
The number of function parameters. |
||
real(kind=wp), | intent(in) | :: | beta(np) |
The function parameters. |
||
real(kind=wp), | intent(out) | :: | ssf(np) |
The scaling values for |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=wp), | public | :: | bmax | ||||
real(kind=wp), | public | :: | bmin | ||||
integer, | public | :: | k | ||||
logical, | public | :: | bigdif |
pure subroutine dsclb(np, beta, ssf) !! Select scaling values for `beta` according to the algorithm given in the ODRPACK95 !! reference guide. ! Routines Called (NONE) ! Date Written 860529 (YYMMDD) ! Revision Date 920304 (YYMMDD) use odrpack_kinds, only: zero, one, ten integer, intent(in) :: np !! The number of function parameters. real(wp), intent(in) :: beta(np) !! The function parameters. real(wp), intent(out) :: ssf(np) !! The scaling values for `beta`. ! Local scalars real(wp) :: bmax, bmin integer :: k logical ::bigdif ! Variable Definitions (alphabetically) ! BETA: The function parameters. ! BIGDIF: The variable designating whether there is a significant difference in the ! magnitudes of the nonzero elements of BETA (BIGDIF=.TRUE.) or not (BIGDIF=.FALSE.). ! BMAX: The largest nonzero magnitude. ! BMIN: The smallest nonzero magnitude. ! K: An indexing variable. ! NP: The number of function parameters. ! SSF: The scaling values for BETA. bmax = abs(beta(1)) do k = 2, np bmax = max(bmax, abs(beta(k))) end do if (bmax == zero) then ! All input values of BETA are zero ssf(1:np) = one else ! Some of the input values are nonzero bmin = bmax do k = 1, np if (beta(k) /= zero) then bmin = min(bmin, abs(beta(k))) end if end do bigdif = log10(bmax) - log10(bmin) >= one do k = 1, np if (beta(k) == zero) then ssf(k) = ten/bmin else if (bigdif) then ssf(k) = one/abs(beta(k)) else ssf(k) = one/bmax end if end if end do end if end subroutine dsclb