SVIGN
Sorts an integer array by algebraically increasing value.
Required Arguments
IA — Integer vector of length N containing the array to be sorted. (Input)
IB — Integer vector of length N containing the sorted array. (Output)
If IA is not needed, IA and IB can share the same storage locations.
Optional Arguments
N — Number of elements in the array to be sorted. (Input)
Default: N = size (IA,1).
FORTRAN 90 Interface
Generic: CALL SVIGN (IA, IB [, …])
Specific: The specific interface name is S_SVIGN .
FORTRAN 77 Interface
Single: CALL SVIGN (N, IA, IB)
Description
Routine
SVIGN sorts the elements of an integer array,
A, into ascending order by algebraic value. The routine
SVIGN uses the algorithm discussed in
SVRGN. On completion,
Aj ≤ Ai for
j <
i.
Example
This example sorts the 10‑element array IA algebraically.
USE SVIGN_INT
USE UMACH_INT
IMPLICIT NONE
! Declare variables
INTEGER N, J, NOUT
PARAMETER (N=10)
INTEGER IA(N), IB(N)
! Set values for IA
! IA = ( -1 2 -3 4 -5 6 -7 8 -9 10 )
!
DATA IA/-1, 2, -3, 4, -5, 6, -7, 8, -9, 10/
! Sort IA by algebraic value into IB
CALL SVIGN (IA, IB)
! Print results
CALL UMACH (2,NOUT)
WRITE (NOUT, 99999) (IB(J),J=1,N)
!
99999 FORMAT (' The output vector is:', /, 10(1X,I5))
END
Output
The Output vector is:
-9 -7 -5 -3 -1 2 4 6 8 10