dsclb Subroutine

public pure subroutine dsclb(np, beta, ssf)

Uses

  • proc~~dsclb~~UsesGraph proc~dsclb dsclb module~odrpack_kinds odrpack_kinds proc~dsclb->module~odrpack_kinds iso_fortran_env iso_fortran_env module~odrpack_kinds->iso_fortran_env

Select scaling values for beta according to the algorithm given in the ODRPACK95 reference guide.

Arguments

Type IntentOptional 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 beta.


Called by

proc~~dsclb~~CalledByGraph proc~dsclb dsclb proc~diniwk diniwk proc~diniwk->proc~dsclb proc~doddrv doddrv proc~doddrv->proc~diniwk proc~dodcnt dodcnt proc~dodcnt->proc~doddrv proc~odr odr proc~odr->proc~dodcnt proc~odr_long_c odr_long_c proc~odr_long_c->proc~odr proc~odr_medium_c odr_medium_c proc~odr_medium_c->proc~odr proc~odr_short_c odr_short_c proc~odr_short_c->proc~odr program~example1 example1 program~example1->proc~odr program~example2 example2 program~example2->proc~odr program~example3 example3 program~example3->proc~odr program~example4 example4 program~example4->proc~odr program~example5 example5 program~example5->proc~odr

Variables

Type Visibility Attributes Name Initial
real(kind=wp), public :: bmax
real(kind=wp), public :: bmin
integer, public :: k
logical, public :: bigdif

Source Code

   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