Developer Reference for Intel® oneAPI Math Kernel Library for C

ID 766684
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

?latm3

Returns set entry of a random matrix.

Syntax

float slatm3 (lapack_int *m, lapack_int *n, lapack_int *i, lapack_int *j, lapack_int *isub, lapack_int *jsub, lapack_int *kl, lapack_int *ku, lapack_int *idist, lapack_int *iseed, float *d, lapack_int *igrade, float *dl, float *dr, lapack_int *ipvtng, lapack_int *iwork, float *sparse);

double dlatm3 (lapack_int *m, lapack_int *n, lapack_int *i, lapack_int *j, lapack_int *isub, lapack_int *jsub, lapack_int *kl, lapack_int *ku, lapack_int *idist, lapack_int *iseed, double *d, lapack_int *igrade, double *dl, double *dr, lapack_int *ipvtng, lapack_int *iwork, double *sparse);

The data types for complex variations depend on whether or not the application links with Gnu Fortran (gfortran) libraries.

For non-gfortran (libmkl_intel_*) interface libraries:

void clatm3 (lapack_complex_float *res, lapack_int *m, lapack_int *n, lapack_int *i, lapack_int *j, lapack_int *isub, lapack_int *jsub, lapack_int *kl, lapack_int *ku, lapack_int *idist, lapack_int *iseed, lapack_complex_float *d, lapack_int *igrade, lapack_complex_float *dl, lapack_complex_float *dr, lapack_int *ipvtng, lapack_int *iwork, float *sparse);

void zlatm3 (lapack_complex_double *res, lapack_int *m, lapack_int *n, lapack_int *i, lapack_int *j, lapack_int *isub, lapack_int *jsub, lapack_int *kl, lapack_int *ku, lapack_int *idist, lapack_int *iseed, lapack_complex_double *d, lapack_int *igrade, lapack_complex_double *dl, lapack_complex_double *dr, lapack_int *ipvtng, lapack_int *iwork, double *sparse);

For gfortran (libmkl_gf_*) interface libraries:

lapack_complex_float clatm3 (lapack_int *m, lapack_int *n, lapack_int *i, lapack_int *j, lapack_int *isub, lapack_int *jsub, lapack_int *kl, lapack_int *ku, lapack_int *idist, lapack_int *iseed, lapack_complex_float *d, lapack_int *igrade, lapack_complex_float *dl, lapack_complex_float *dr, lapack_int *ipvtng, lapack_int *iwork, float *sparse);

lapack_complex_double zlatm3 (lapack_int *m, lapack_int *n, lapack_int *i, lapack_int *j, lapack_int *isub, lapack_int *jsub, lapack_int *kl, lapack_int *ku, lapack_int *idist, lapack_int *iseed, lapack_complex_double *d, lapack_int *igrade, lapack_complex_double *dl, lapack_complex_double *dr, lapack_int *ipvtng, lapack_int *iwork, double *sparse);

To understand the difference between the non-gfortran and gfortran interfaces and when to use each of them, see Dynamic Libraries in the lib/intel64 Directory in the oneAPI Math Kernel Library Developer Guide.

Include Files

  • mkl.h

Description

The ?latm3 routine returns the (isub, jsub) entry of a random matrix of dimension (m, n) described by the other parameters. (isub, jsub) is the final position of the (i ,j ) entry after pivoting according to ipvtng and iwork. ?latm3 is called by the ?latmr routine in order to build random test matrices. No error checking on parameters is done, because this routine is called in a tight loop by ?latmr which has already checked the parameters.

Use of ?latm3 differs from ?latm2 in the order in which the random number generator is called to fill in random matrix entries. With ?latm2, the generator is called to fill in the pivoted matrix columnwise. With ?latm3, the generator is called to fill in the matrix columnwise, after which it is pivoted. Thus, ?latm3 can be used to construct random matrices which differ only in their order of rows and/or columns. ?latm2 is used to construct band matrices while avoiding calling the random number generator for entries outside the band (and therefore generating random numbers in different orders for different pivot orders).

The matrix whose (isub, jsub ) entry is returned is constructed as follows (this routine only computes one entry):

  • If isub is outside (1..m) or jsub is outside (1..n), returns zero (this is convenient for generating matrices in band format).

  • Generate a matrix A with random entries of distribution idist.

  • Set the diagonal to D.

  • Grade the matrix, if desired, from the left (by dl) and/or from the right (by dr or dl) as specified by igrade.

  • Permute, if desired, the rows and/or columns as specified by ipvtng and iwork.

  • Band the matrix to have lower bandwidth kl and upper bandwidth ku.

  • Set random entries to zero as specified by sparse.

Input Parameters

m

Number of rows of matrix.

n

Number of columns of matrix.

i

Row of unpivoted entry to be returned.

j

Column of unpivoted entry to be returned.

isub

Row of pivoted entry to be returned.

jsub

Column of pivoted entry to be returned.

kl

Lower bandwidth.

ku

Upper bandwidth.

idist

On entry, idist specifies the type of distribution to be used to generate a random matrix.

for slatm2 and dlatm2:

= 1: uniform (0,1)

= 2: uniform (-1,1)

= 3: normal (0,1)

for clatm2 and zlatm2:

= 1: real and imaginary parts each uniform (0,1)

= 2: real and imaginary parts each uniform (-1,1)

= 3: real and imaginary parts each normal (0,1)

= 4: complex number uniform in disk(0, 1)

iseed

Array, size 4.

Seed for random number generator.

d

Array, size (min(i, j)). Diagonal entries of matrix.

igrade

Specifies grading of matrix as follows:

= 0: no grading

= 1: matrix premultiplied by diag( dl )

= 2: matrix postmultiplied by diag( dr )

= 3: matrix premultiplied by diag( dl ) and postmultiplied by diag( dr)

= 4: matrix premultiplied by diag( dl ) and postmultiplied by inv( diag( dl ) )

For slatm2 and slatm2:

= 5: matrix premultiplied by diag( dl ) and postmultiplied by diag( dl)

For clatm2 and zlatm2:

= 5: matrix premultiplied by diag( dl ) and postmultiplied by diag( conjg( dl ) )

= 6: matrix premultiplied by diag( dl ) and postmultiplied by diag( dl)

dl

Array, size (i or j, as appropriate).

Left scale factors for grading matrix.

dr

Array, size (i or j, as appropriate).

Right scale factors for grading matrix.

ipvtng

On entry specifies pivoting permutations as follows:

If ipvtng = 0: none.

If ipvtng = 1: row pivoting.

If ipvtng = 2: column pivoting.

If ipvtng = 3: full pivoting, i.e., on both sides.

sparse

On entry, specifies the sparsity of the matrix if sparse matrix is to be generated. sparse should lie between 0 and 1. A uniform( 0, 1 ) random number x is generated and compared to sparse; if x is larger the matrix entry is unchanged and if x is smaller the entry is set to zero. Thus on the average a fraction sparse of the entries will be set to zero.

iwork

Array, size (i or j, as appropriate). This array specifies the permutation used. The row (or column) originally in position k is in position iwork[k - 1] after pivoting. This differs from iwork for ?latm2.

Output Parameters

isub

On exit, row of pivoted entry is updated.

jsub

On exit, column of pivoted entry is updated.

iseed

On exit, the seed is updated.

Return Values

The function returns an entry of a random matrix (for complex variations libmkl_gf_* interface layer/libraries return the result as the parameter res).