Module osl_func

module osl_func

    ! Uses
    use osl_core, wp => osl_wp

    ! Subroutines and functions
    public subroutine osl_func_paraboloid(x, f, ctx)
    public subroutine osl_func_paraboloid_max(x, f, ctx)
    public subroutine osl_func_paraboloid_nd(x, f, df, ctx)
    public subroutine osl_func_nnd(x, y, d)
    public subroutine osl_func_nm(x, y, ctx)
    public subroutine osl_func_rosenbrock(x, f)
    public subroutine osl_func_rosenbrock_nd(x, f, df)
    public subroutine osl_func_judge(theta, h, ctx)
    public subroutine osl_func_judge_max(theta, h, ctx)
    public subroutine osl_func_powell(x, y, ctx)
    public subroutine osl_func_helical(x, y, ctx)

end module osl_func

Description of Subroutines and Functions

osl_func_paraboloid

public subroutine osl_func_paraboloid(x, f, ctx)
    real (kind=wp), dimension(:), intent(in) :: x
    real (kind=wp), intent(out) :: f
    integer, optional, dimension(:), intent(in) :: ctx
end subroutine osl_func_paraboloid

A simple example multidimensional function for the purposes of minimization. The function is a simple paraboloid of two variables. This subroutine satisfies the func_n interface.

osl_func_paraboloid_max

public subroutine osl_func_paraboloid_max(x, f, ctx)
    real (kind=wp), dimension(:), intent(in) :: x
    real (kind=wp), intent(out) :: f
    integer, optional, dimension(:), intent(in) :: ctx
    ! Calls: osl_func_paraboloid
end subroutine osl_func_paraboloid_max

A simple example multidimensional function purposes of maximization which returns the negative of osl_func_paraboloid. This subroutine satisfies the func_n interface.

osl_func_paraboloid_nd

public subroutine osl_func_paraboloid_nd(x, f, df, ctx)
    real (kind=wp), dimension(:), intent(in) :: x
    real (kind=wp), intent(out) :: f
    real (kind=wp), optional, dimension(size(x)), intent(out) :: df
    integer, optional, dimension(:), intent(in) :: ctx
end subroutine osl_func_paraboloid_nd

A simple example multidimensional function with derivatives, for the purposes of minimization. The function is a simple paraboloid of two variables. This subroutine satisfies the func_nd interface.

osl_func_nnd

public subroutine osl_func_nnd(x, y, d)
    real (kind=wp), dimension(:), intent(in) :: x
    real (kind=wp), dimension(size(x)), intent(out) :: y
    real (kind=wp), optional, dimension(size(x), size(x)), intent(out) :: d
end subroutine osl_func_nnd

Return the value of a quadratic vector-valued test function of n variables satisfying the func_nnd interface. This function has a zero at `x = (/ 1.2, 7.4 /)`.

osl_func_nm

public subroutine osl_func_nm(x, y, ctx)
    real (kind=wp), dimension(:), intent(in) :: x
    real (kind=wp), dimension(:), intent(out) :: y
    integer, optional, dimension(:), intent(in) :: ctx
end subroutine osl_func_nm

A simple n-by-m test function that adheres to the func_nm interface. Here, n and m happen to be equal but this is not necessary in general. The context argument is unused.

osl_func_rosenbrock

public subroutine osl_func_rosenbrock(x, f)
    real (kind=wp), dimension(:), intent(in) :: x
    real (kind=wp), intent(out) :: f
end subroutine osl_func_rosenbrock

Evaluates the extended Rosenbrock function. This subroutine satisfies the func_n interface.

osl_func_rosenbrock_nd

public subroutine osl_func_rosenbrock_nd(x, f, df)
    real (kind=wp), dimension(:), intent(in) :: x
    real (kind=wp), intent(out) :: f
    real (kind=wp), optional, dimension(size(x)), intent(out) :: df
    ! Calls: osl_func_rosenbrock
end subroutine osl_func_rosenbrock_nd

Evaluates the extended Rosenbrock function and its gradient. This subroutine satisfies the func_nd interface.

osl_func_judge

public subroutine osl_func_judge(theta, h, ctx)
    real (kind=wp), dimension(:), intent(in) :: theta
    real (kind=wp), intent(out) :: h
    integer, optional, dimension(:), intent(in) :: ctx
end subroutine osl_func_judge

This subroutine is from the example in Judge, et al. (1985, p. 956). There are two optima: F(.864,1.23) = 16.0817 (the global minumum) and F(2.35,-.319) = 20.9805. This subroutine satisfies the func_n interface. The context argument is unused.

References

  • Judge, George G., Griffiths, W.E., Hill, R. Carter, Lutkepohl, Helmut, and Lee, Tsoung-Chao (1985): The Theory and Practice of Econometrics, 2nd ed., Wiley, New York.

osl_func_judge_max

public subroutine osl_func_judge_max(theta, h, ctx)
    real (kind=wp), dimension(:), intent(in) :: theta
    real (kind=wp), intent(out) :: h
    integer, optional, dimension(:), intent(in) :: ctx
    ! Calls: osl_func_judge
end subroutine osl_func_judge_max

A wrapper function which negates the Judge function so it can also be used to test maximization routines. This subroutine satisfies the func_n interface. The context argument is unused.

osl_func_powell

public subroutine osl_func_powell(x, y, ctx)
    real (kind=wp), intent(in), dimension(:) :: x
    real (kind=wp), intent(out) :: y
    integer, optional, dimension(:), intent(in) :: ctx
end subroutine osl_func_powell

Evaluate the Powell quartic function. This subroutine satisfies the func_n interface. The context argument is unused.

osl_func_helical

public subroutine osl_func_helical(x, y, ctx)
    real (kind=wp), dimension(:), intent(in) :: x
    real (kind=wp), intent(out) :: y
    integer, optional, dimension(:), intent(in) :: ctx
end subroutine osl_func_helical

Evaluate the Fletcher-Powell helical valley function. This subroutine satisfies the func_n interface. The context argument is unused.