Statistics
| Branch: | Revision:

root / synthbench / euroben-dm / mod2ci / .svn / text-base / diagsk.f.svn-base @ 0:839f52ef7657

History | View | Annotate | Download (843 Bytes)

1
      Subroutine diagsk( n, a, diag, offset )
2
! ----------------------------------------------------------------------
3
! --- diagsk determines whether diag is in a(n) where a(n) is a 
4
!     sorted array of integers. Because n is small (<= 1000) a(n)
5
!     is simply linearly traversed. When diag is in a(n), offset
6
!     is the index where it was found, if not,
7
!     offset = largest index < diag.
8
! ----------------------------------------------------------------------
9
      Integer :: n
10
      Integer :: a(n), offset, diag
11
! ----------------------------------------------------------------------
12
      offset = 0
13
      Do i = 1, n
14
         If ( a(i) >= diag ) Then
15
            offset = i - 1
16
            Exit
17
         End If
18
      End Do
19
! ----------------------------------------------------------------------
20
      End Subroutine diagsk