The PERMUTI routines

Fortran version:

Fortran-90 generic routine PERMUTI() for I/O API-3.2:: compiler selects the appropriate type-specific form depending upon the number and types of the INTEGER, INTEGER*8 dimensions and permute-indices and permutation-arrays

For I/O API Versions 3.2 December, 2023 or later.

    SUBROUTINE SORTI( N,  INDX,  ILIST1 )
    SUBROUTINE SORTI( N,  INDX,  ILIST1, ILIST2 )
    SUBROUTINE SORTI( N,  INDX,  ILIST1, ILIST2 , ILIST3 )
    SUBROUTINE SORTI( N8, INDX8, ILIST1 )
    SUBROUTINE SORTI( N8, INDX8, ILIST1, ILIST2 )
    SUBROUTINE SORTI( N8, INDX8, ILIST1, ILIST2 , ILIST3 )
    SUBROUTINE SORTI( N,  INDX,  LLIST1 )
    SUBROUTINE SORTI( N,  INDX,  LLIST1, LLIST2 )
    SUBROUTINE SORTI( N,  INDX,  LLIST1, LLIST2 , LLIST3 )
    SUBROUTINE SORTI( N8, INDX8, LLIST1 )
    SUBROUTINE SORTI( N8, INDX8, LLIST1, LLIST2 )
    SUBROUTINE SORTI( N8, INDX8, LLIST1, LLIST2 , LLIST3 )
    SUBROUTINE SORTI( N,  INDX,  RLIST1 )
    SUBROUTINE SORTI( N,  INDX,  RLIST1, RLIST2 )
    SUBROUTINE SORTI( N,  INDX,  RLIST1, RLIST2 , RLIST3 )
    SUBROUTINE SORTI( N8, INDX8, RLIST1 )
    SUBROUTINE SORTI( N8, INDX8, RLIST1, RLIST2 )
    SUBROUTINE SORTI( N8, INDX8, RLIST1, RLIST2 , RLIST3 )
    SUBROUTINE SORTI( N,  INDX,  DLIST1 )
    SUBROUTINE SORTI( N,  INDX,  DLIST1, DLIST2 )
    SUBROUTINE SORTI( N,  INDX,  DLIST1, DLIST2 , DLIST3 )
    SUBROUTINE SORTI( N8, INDX8, DLIST1 )
    SUBROUTINE SORTI( N8, INDX8, DLIST1, DLIST2 )
    SUBROUTINE SORTI( N8, INDX8, DLIST1, DLIST2 , DLIST3 )
    SUBROUTINE SORTI( N,  INDX,  CLIST1 )
    SUBROUTINE SORTI( N,  INDX,  CLIST1, CLIST2 )
    SUBROUTINE SORTI( N,  INDX,  CLIST1, CLIST2 , CLIST3 )
    SUBROUTINE SORTI( N8, INDX8, CLIST1 )
    SUBROUTINE SORTI( N8, INDX8, CLIST1, CLIST2 )
    SUBROUTINE SORTI( N8, INDX8, CLIST1, CLIST2 , CLIST3 )

        INTEGER  ,    INTENT(IN   ) :: N           !  table size
        INTEGER*8,    INTENT(IN   ) :: N8          !  table size
        INTEGER  ,    INTENT(IN   ) :: INDX ( N )  !  permutation-index from SORTI*
        INTEGER*8,    INTENT(IN   ) :: INDX8( N8 ) !  permutation-index from SORTI*
        INTEGER  ,    INTENT(INOUT) :: ILIST1( N )
        INTEGER  ,    INTENT(INOUT) :: ILIST2( N )
        INTEGER  ,    INTENT(INOUT) :: ILIST3( N )
        INTEGER*8,    INTENT(INOUT) :: LLIST1( N )
        INTEGER*8,    INTENT(INOUT) :: LLIST2( N )
        INTEGER*8,    INTENT(INOUT) :: LLIST3( N )
        REAL,         INTENT(INOUT) :: RLIST1( N )
        REAL,         INTENT(INOUT) :: RLIST2( N )
        REAL,         INTENT(INOUT) :: RLIST3( N )
        REAL*8,       INTENT(INOUT) :: DLIST1( N )
        REAL*8,       INTENT(INOUT) :: DLIST2( N )
        REAL*8,       INTENT(INOUT) :: DLIST3( N )
        CHARACTER(*), INTENT(INOUT) :: CLIST1( N )
        CHARACTER(*), INTENT(INOUT) :: CLIST2( N )
        CHARACTER(*), INTENT(INOUT) :: CLIST3( N )

No C version:

Summary:

Takes a permutation index-table such as constructed by the SORTI, and permutes asociated key and/or data arrays in-place according to that index.

Functionally, a single multi-array call to PERMUTI, e.g.,

    CALL PERMUTI( N, INDX, ARRAY1, ARRAY2, ARRAY3 )
is equivalent to the corresponding sequence of single-array calls:
    CALL PERMUTI( N, INDX, ARRAY1 )
    CALL PERMUTI( N, INDX, ARRAY2 )
    CALL PERMUTI( N, INDX, ARRAY3 )
Which of these offers better computational performance depends upon problem size, hardware (cache-size, particularly), and compiler quality.

Preconditions:

Permutation table <N, INDX > or <N8, INDX8 > such as from SORTI

Fortran Usage:

To sort in-place an un-sorted 3-tuple table {LIST1,LIST2,LIST3} with an associated data arrays DATA1, DATA2 :
    ...
    USE M3UTILIO
    ...
    INTEGER       N
    PARAMETER   ( N = ...
    ...
    INTEGER       I
    INTEGER       INDX ( N )   !  index array to be sorted
    INTEGER       LIST1( N )   !  input unsorted 3-tuple table
    INTEGER       LIST2( N )   !  input unsorted 3-tuple table
    INTEGER       LIST3( N )   !  input unsorted 3-tuple table
    REAL          DATA1( N )   !  input data table with same subscripting
    REAL          DATA2( N )   !  as <LIST1,LIST2,LIST3>
    ...
    DATA          LIST1 / 1983, 1980, 1988, 1988, 1990, ...
    DATA          LIST2 /    1,    5,    4,   11,    7, ...
    DATA          LIST3 /   10,    3,   15,   19,   20, ...
    DATA          DATA1 / 1.23,  -0.7,   5.5,  11.9,  -4.3, ...
    DATA          DATA2 /1.2e5,-2.7e3, 4.8e4, 2.2e6, -7.72, ...
    ...
    DO  I = 1, N	!  initialize INDX array
        INDX( I ) = I
    END DO
    CALL SORTI3(  N, INDX, LIST1, LIST2, LIST3 )
    CALL PERMUTI( N, INDX, LIST1, LIST2, LIST3 )
    CALL PERMUTI( N, INDX, DATA1, DATA2 )
    ...

Previous: PCOEF

Next: POLY

SEE ALSO: FIND* Binary Search Routines

SEE ALSO: LOCAT* Binary Search-and-Insert Routines

SEE ALSO: SORTI* Indirect Sort Routines

Up: Utility Routines

To: Models-3/EDSS I/O API: The Help Pages

    $Id: PERMUTI.html 257 2023-12-01 16:13:33Z coats $