Developer Reference for Intel® oneAPI Math Kernel Library for C

ID 766684
Date 10/31/2024
Public
Document Table of Contents

p?lapiv

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

Syntax

void pslapiv (char *direc , char *rowcol , char *pivroc , MKL_INT *m , MKL_INT *n , float *a , MKL_INT *ia , MKL_INT *ja , MKL_INT *desca , MKL_INT *ipiv , MKL_INT *ip , MKL_INT *jp , MKL_INT *descip , MKL_INT *iwork );

void pdlapiv (char *direc , char *rowcol , char *pivroc , MKL_INT *m , MKL_INT *n , double *a , MKL_INT *ia , MKL_INT *ja , MKL_INT *desca , MKL_INT *ipiv , MKL_INT *ip , MKL_INT *jp , MKL_INT *descip , MKL_INT *iwork );

void pclapiv (char *direc , char *rowcol , char *pivroc , MKL_INT *m , MKL_INT *n , MKL_Complex8 *a , MKL_INT *ia , MKL_INT *ja , MKL_INT *desca , MKL_INT *ipiv , MKL_INT *ip , MKL_INT *jp , MKL_INT *descip , MKL_INT *iwork );

void pzlapiv (char *direc , char *rowcol , char *pivroc , MKL_INT *m , MKL_INT *n , MKL_Complex16 *a , MKL_INT *ia , MKL_INT *ja , MKL_INT *desca , MKL_INT *ipiv , MKL_INT *ip , MKL_INT *jp , MKL_INT *descip , MKL_INT *iwork );

Include Files

  • mkl_scalapack.h

Description

The p?lapivfunction 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':

lipivLOCr(ia+m-1) + mb_a if pivroc='C' or 'c',

lipivLOCc(m + mod(jp-1, nb_p)) if pivroc='R' or 'r', and,

when rowcol='C' or 'c':

lipivLOCr(n + mod(ip-1, mb_p)) if pivroc='C' or 'c',

lipivLOCc(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.

See Also