# ?lapmt

Performs a forward or backward permutation of the columns of a matrix.

## Syntax

call slapmt( forwrd, m, n, x, ldx, k )

call dlapmt( forwrd, m, n, x, ldx, k )

call clapmt( forwrd, m, n, x, ldx, k )

call zlapmt( forwrd, m, n, x, ldx, k )

## Description

The routine ?lapmt rearranges the columns of the m-by-n matrix X as specified by the permutation `k(1),k(2),...,k(n)` of the integers `1,...,n`.

If `forwrd = .TRUE.`, forward permutation:

`X(*,k(j))` is moved to `X(*,j)` for `j=1,2,...,n`.

If `forwrd = .FALSE.`, backward permutation:

`X(*,j)` is moved to `X(*,k(j))` for `j = 1,2,...,n`.

## Input Parameters

forwrd

  LOGICAL.

  If `forwrd = .TRUE.`, forward permutation

  If `forwrd = .FALSE.`, backward permutation

m

  INTEGER. The number of rows of the matrix X. `m ≥ 0`.

n

  INTEGER. The number of columns of the matrix X. `n ≥ 0`.

x

  REAL for slapmt

  DOUBLE PRECISION for dlapmt

  COMPLEX for clapmt

  COMPLEX*16 for zlapmt

  Array, DIMENSION (ldx,n). On entry, the m-by-n matrix X.

ldx

  INTEGER. The leading dimension of the array X, ldx ≥ max(1,m).

k

  INTEGER. Array, DIMENSION (n). On entry, k contains the permutation vector and is used as internal workspace.

## Output Parameters

x

  On exit, x contains the permuted matrix X.

k

  On exit, k is reset to its original value.

Parent topic: Auxiliary Routines