Contents

# p?lapiv

Applies a permutation matrix to a general distributed matrix, resulting in row or column pivoting.

## Syntax

Include Files
• mkl_scalapack.h
Description
The
p?lapiv
function
applies either
P
(permutation matrix indicated by
ipiv
) or inv(
P
) to a general
m
-by-
n
distributed matrix sub
(
A
) =
A
(
ia
:
ia
+
m
-1
,
ja
:
ja
+
n
-1)
, resulting in row or column pivoting. The pivot vector may be distributed across a process row or a column. The pivot vector should be aligned with the distributed matrix
A
. This
function
will transpose the pivot vector, if necessary.
For example, if the row pivots should be applied to the columns of sub(
A
), pass
rowcol
=
'C'
and
pivroc
=
'C'
.
Input Parameters
direc
(global)
Specifies in which order the permutation is applied:
=
'F'
(Forward): Applies pivots forward from top of matrix. Computes
P
*sub(
A
)
.
=
'B'
(Backward): Applies pivots backward from bottom of matrix. Computes
inv(
P
)*sub(
A
)
.
rowcol
(global)
Specifies if the rows or columns are to be permuted:
=
'R'
: Rows will be permuted,
=
'C'
: Columns will be permuted.
pivroc
(global)
Specifies whether
ipiv
is distributed over a process row or column:
=
'R'
:
ipiv
is distributed over a process row,
=
'C'
:
ipiv
is distributed over a process column.
m
(global)
The number of rows in the distributed matrix sub(
A
). When
m
= 0
,
p?lapiv
is set to zero.
m
0
.
n
(global)
The number of columns in the distributed matrix sub(
A
). When
n
= 0
,
p?lapiv
is set to zero.
n
0.
a
(local).
Pointer into the local memory to an array of size
lld_a
*
LOCc
(
ja
+
n
-1)
containing the local pieces of the distributed matrix sub(
A
).
ia
,
ja
(global)
The row and column indices in the global matrix
A
indicating the first row and the first column of the matrix sub(
A
), respectively.
desca
(global and local) array of size
dlen_
. The array descriptor for the distributed matrix A.
ipiv
(local)
Array of size
lipiv
;
when
rowcol
=
'R'
or
'r'
:
lipiv
LOCr
(
ia
+
m
-1) +
mb_a
if
pivroc
=
'C'
or
'c'
,
lipiv
LOCc
(
m
+
mod
(
jp
-1,
nb_p
))
if
pivroc
=
'R'
or
'r'
, and,
when
rowcol
=
'C'
or
'c'
:
lipiv
LOCr
(
n
+
mod
(
ip
-1,
mb_p
))
if
pivroc
=
'C'
or
'c'
,
lipiv
LOCc
(
ja
+
n
-1) +
nb_a
if
pivroc
=
'R'
or
'r'
.
This array contains the pivoting information.
ipiv(i)
is the global row (column), local row (column)
i
was swapped with. When
rowcol
=
'R'
or
'r'
and
pivroc
=
'C'
or
'c'
, or
rowcol
=
'C'
or
'c'
and
pivroc
=
'R'
or
'r'
, the last piece of this array of size
mb_a
(resp.
nb_a
) is used as workspace. In those cases, this array is tied to the distributed matrix
A
.
ip
,
jp
(global) The row and column indices in the global matrix
P
indicating the first row and the first column of the matrix sub(
P
), respectively.
descip
(global and local) array of size
dlen_
. The array descriptor for the distributed vector
ipiv
.
iwork
(local).
Array of size
ldw
, where
ldw
is equal to the workspace necessary for transposition, and the storage of the transposed
ipiv
:
Let
lcm
be the least common multiple of
nprow
and
npcol
.
```if( *rowcol == 'r' &&  *pivroc == 'r') {
if( nprow == npcol) {
ldw = LOCr( n_p + (*jp-1)%nb_p ) + nb_p;
} else {
ldw = LOCr( n_p + (*jp-1)%nb_p )+
nb_p * ceil( ceil(LOCc(n_p)/nb_p) / (lcm/npcol) );
}
} else if( *rowcol == 'c' &&  *pivroc == 'c') {
if( nprow == npcol ) {
ldw = LOCc( m_p + (*ip-1)%mb_p ) + mb_p;
} else {
ldw = LOCc( m_p + (*ip-1)%mb_p ) +
mb_p *ceil(ceil(LOCr(m_p)/mb_p) / (lcm/nprow) );
}
} else {
// iwork is not referenced.
```
Output Parameters
a
(local).
On exit, the local pieces of the permuted distributed submatrix.

#### Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.