# Name

HPL_perm Combine 2 index arrays - Generate the permutation.

# Synopsis

`#include "hpl.h"`
`void` `HPL_perm(` `const int` `N`, `int *` `LINDXA`, `int *` `LINDXAU`, `int *` `IWORK` `);`

# Description

HPL_perm combines two index arrays and generate the corresponding permutation. First, this function computes the inverse of LINDXA, and then combine it with LINDXAU. Second, in order to be able to perform the permutation in place, LINDXAU is overwritten by the sequence of permutation producing the same result. What we ultimately want to achieve is: U[LINDXAU[i]] := U[LINDXA[i]] for i in [0..N). After the call to this function, this in place permutation can be performed by for i in [0..N) swap U[i] with U[LINDXAU[i]].

# Arguments

    N       (global input)                const int
            On entry,  N  specifies the length of the arrays  LINDXA  and
            LINDXAU. N should be at least zero.

    LINDXA  (global input/output)         int *
            On entry,  LINDXA  is an array of dimension N  containing the
            source indexes. On exit,  LINDXA  contains the combined index
            array.

    LINDXAU (global input/output)         int *
            On entry,  LINDXAU is an array of dimension N  containing the
            target indexes.  On exit,  LINDXAU  contains  the sequence of
            permutation,  that  should be applied  in increasing order to
            permute the underlying array U in place.

    IWORK   (workspace)                   int *
            On entry, IWORK is a workarray of dimension N.

# See Also

HPL_plindx1, HPL_pdlaswp01N, HPL_pdlaswp01T.