************80
! R8VEC_ASCENDS_STRICTLY determines if an R8VEC is strictly ascending.
Discussion:
An R8VEC is a vector of R8 values.
Notice the effect of entry number 6 in the following results:
X = ( -8.1, 1.3, 2.2, 3.4, 7.5, 7.4, 9.8 )
Y = ( -8.1, 1.3, 2.2, 3.4, 7.5, 7.5, 9.8 )
Z = ( -8.1, 1.3, 2.2, 3.4, 7.5, 7.6, 9.8 )
R8VEC_ASCENDS_STRICTLY ( X ) = FALSE
R8VEC_ASCENDS_STRICTLY ( Y ) = FALSE
R8VEC_ASCENDS_STRICTLY ( Z ) = TRUE
Licensing:
This code is distributed under the GNU LGPL license.
Modified:
03 December 2007
Author:
John Burkardt
Parameters:
Input, integer ( kind = 4 ) N, the size of the array.
Input, real ( kind = 8 ) X(N), the array to be examined.
Output, logical R8VEC_ASCENDS_STRICTLY, is TRUE if the
entries of X strictly ascend.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=4) | :: | n | ||||
real(kind=8) | :: | x(n) |
function r8vec_ascends_strictly ( n, x ) !*****************************************************************************80 ! !! R8VEC_ASCENDS_STRICTLY determines if an R8VEC is strictly ascending. ! ! Discussion: ! ! An R8VEC is a vector of R8 values. ! ! Notice the effect of entry number 6 in the following results: ! ! X = ( -8.1, 1.3, 2.2, 3.4, 7.5, 7.4, 9.8 ) ! Y = ( -8.1, 1.3, 2.2, 3.4, 7.5, 7.5, 9.8 ) ! Z = ( -8.1, 1.3, 2.2, 3.4, 7.5, 7.6, 9.8 ) ! ! R8VEC_ASCENDS_STRICTLY ( X ) = FALSE ! R8VEC_ASCENDS_STRICTLY ( Y ) = FALSE ! R8VEC_ASCENDS_STRICTLY ( Z ) = TRUE ! ! Licensing: ! ! This code is distributed under the GNU LGPL license. ! ! Modified: ! ! 03 December 2007 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, integer ( kind = 4 ) N, the size of the array. ! ! Input, real ( kind = 8 ) X(N), the array to be examined. ! ! Output, logical R8VEC_ASCENDS_STRICTLY, is TRUE if the ! entries of X strictly ascend. ! implicit none integer ( kind = 4 ) n integer ( kind = 4 ) i logical r8vec_ascends_strictly real ( kind = 8 ) x(n) do i = 1, n - 1 if ( x(i+1) <= x(i) ) then r8vec_ascends_strictly = .false. print*,i return end if end do r8vec_ascends_strictly = .true. return end function r8vec_ascends_strictly