# NAG FL Interfacef06qkf (dgeapr)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

f06qkf permutes the rows or columns of a real rectangular matrix using a real array of permutations.

## 2Specification

Fortran Interface
 Subroutine f06qkf ( side, n, perm, k, b, ldb)
 Integer, Intent (In) :: n, k, ldb Real (Kind=nag_wp), Intent (In) :: perm(*) Real (Kind=nag_wp), Intent (Inout) :: b(ldb,*) Character (1), Intent (In) :: side, trans
#include <nag.h>
 void f06qkf_ (const char *side, const char *trans, const Integer *n, const double perm[], const Integer *k, double b[], const Integer *ldb, const Charlen length_side, const Charlen length_trans)
The routine may be called by the names f06qkf or nagf_blas_dgeapr.

## 3Description

f06qkf performs one of the permutation operations
 $B←PTB, B←PB, B←BPT or B←BP,$
where $B$ is a real matrix, and $P$ is a permutation matrix.
$P$ is represented in the form
 $P=P1,p1P2,p2⋯Pn,pn,$
where ${P}_{i,j}$ is the permutation matrix that interchanges items $i$ and $j$; that is, ${P}_{i,j}$ is the unit matrix with rows and columns $i$ and $j$ interchanged. If $i=j$, ${P}_{i,j}=I$.
Let $\mathit{m}$ denote the number of rows of $B$ if ${\mathbf{side}}=\text{'L'}$, or the number of columns of $B$ if ${\mathbf{side}}=\text{'R'}$: the routine does not require $\mathit{m}$ to be passed as an argument, but assumes that $m\ge {p}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,n$.
This routine requires the indices ${p}_{i}$ to be supplied in a real array (the routine takes the integer part of the array elements); f06qjf performs the same operation with the indices supplied in an integer array.

None.

## 5Arguments

1: $\mathbf{side}$Character(1) Input
2: $\mathbf{trans}$Character(1) Input
On entry: specifies the operation to be performed.
${\mathbf{side}}=\text{'L'}$ and ${\mathbf{trans}}=\text{'T'}$
$B←{P}^{\mathrm{T}}B$.
${\mathbf{side}}=\text{'L'}$ and ${\mathbf{trans}}=\text{'N'}$
$B←PB$.
${\mathbf{side}}=\text{'R'}$ and ${\mathbf{trans}}=\text{'T'}$
$B←B{P}^{\mathrm{T}}$.
${\mathbf{side}}=\text{'R'}$ and ${\mathbf{trans}}=\text{'N'}$
$B←BP$.
Constraints:
• ${\mathbf{side}}=\text{'L'}$ or $\text{'R'}$;
• ${\mathbf{trans}}=\text{'N'}$ or $\text{'T'}$.
3: $\mathbf{n}$Integer Input
On entry: $n$, the number of interchanges in the representation of $P$.
Constraint: ${\mathbf{n}}\ge 0$.
4: $\mathbf{perm}\left(*\right)$Real (Kind=nag_wp) array Input
Note: the dimension of the array perm must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: the $n$ indices ${p}_{i}$ which define the interchanges in the representation of $P$. It is usual to have ${p}_{i}\ge i$, but this is not necessary.
Constraint: $1\le {\mathbf{perm}}\left(i\right)\le \mathit{m}$, where $\mathit{m}=\underset{\mathit{k}}{\mathrm{max}}\phantom{\rule{0.25em}{0ex}}\left\{\mathrm{int}{\mathbf{perm}}\left(\mathit{k}\right)\right\}$.
5: $\mathbf{k}$Integer Input
On entry: $k$, the number of columns of $B$ if ${\mathbf{side}}=\text{'L'}$, or the number of rows of $B$ if ${\mathbf{side}}=\text{'R'}$.
Constraint: ${\mathbf{k}}\ge 0$.
6: $\mathbf{b}\left({\mathbf{ldb}},*\right)$Real (Kind=nag_wp) array Input/Output
Note: the second dimension of the array b must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$ if ${\mathbf{side}}=\text{'L'}$ and at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{n}},\underset{\mathit{k}}{\mathrm{max}}\phantom{\rule{0.25em}{0ex}}\left\{\mathrm{int}{\mathbf{perm}}\left(\mathit{k}\right)\right\}\right)$ if ${\mathbf{side}}=\text{'R'}$.
On entry: the original matrix $B$; $B$ is $\mathit{m}×k$, where $\mathit{m}=\underset{\mathit{k}}{\mathrm{max}}\phantom{\rule{0.25em}{0ex}}\left\{\mathrm{int}{\mathbf{perm}}\left(\mathit{k}\right)\right\}$ if ${\mathbf{side}}=\text{'L'}$, or $k×\mathit{m}$, where $\mathit{m}=\underset{\mathit{k}}{\mathrm{max}}\phantom{\rule{0.25em}{0ex}}\left\{\mathrm{int}{\mathbf{perm}}\left(\mathit{k}\right)\right\}$ if ${\mathbf{side}}=\text{'R'}$.
On exit: the permuted matrix $B$.
7: $\mathbf{ldb}$Integer Input
On entry: the first dimension of the array b as declared in the (sub)program from which f06qkf is called.
Constraints:
• if ${\mathbf{side}}=\text{'L'}$, ${\mathbf{ldb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{n}},\mathit{m}\right)$;
• if ${\mathbf{side}}=\text{'R'}$, ${\mathbf{ldb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$.

None.

Not applicable.

## 8Parallelism and Performance

f06qkf is not threaded in any implementation.