Developer Reference for Intel® oneAPI Math Kernel Library for Fortran

ID 766686
Date 3/31/2023
Public

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

Document Table of Contents

?latm2

Returns an entry of a random matrix.

Syntax

res = slatm2( m, n, i, j, kl, ku, idist, iseed, d, igrade, dl, dr, ipvtng, iwork, sparse )

res = dlatm2( m, n, i, j, kl, ku, idist, iseed, d, igrade, dl, dr, ipvtng, iwork, sparse )

res = clatm2( m, n, i, j, kl, ku, idist, iseed, d, igrade, dl, dr, ipvtng, iwork, sparse )

res = zlatm2( m, n, i, j, kl, ku, idist, iseed, d, igrade, dl, dr, ipvtng, iwork, sparse )

Include Files
  • mkl.fi
Description

The ?latm2 routine returns entry (i , j ) of a random matrix of dimension (m, n). It 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 ?latm2 differs from ?latm3 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 ?latm2, 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).

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

  • If i is outside (1..m) or j 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

INTEGER. Number of rows of the matrix.

n

INTEGER. Number of columns of the matrix.

i

INTEGER. Row of the entry to be returned.

j

INTEGER. Column of the entry to be returned.

kl

INTEGER. Lower bandwidth.

ku

INTEGER. Upper bandwidth.

idist

INTEGER. 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

INTEGER. Array, size 4.

Seed for the random number generator.

d

REAL for slatm2,

DOUBLE PRECISION for dlatm2,

COMPLEX for clatm2,

DOUBLE COMPLEX for zlatm2,

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

igrade

INTEGER. 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

REAL for slatm2,

DOUBLE PRECISION for dlatm2,

COMPLEX for clatm2,

DOUBLE COMPLEX for zlatm2,

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

Left scale factors for grading matrix.

dr

REAL for slatm2,

DOUBLE PRECISION for dlatm2,

COMPLEX for clatm2,

DOUBLE COMPLEX for zlatm2,

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

Right scale factors for grading matrix.

ipvtng

INTEGER. On entry specifies pivoting permutations as follows:

= 0: none

= 1: row pivoting

= 2: column pivoting

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

iwork

INTEGER.

Array, size (i or j), as appropriate. This array specifies the permutation used. The row (or column) in position k was originally in position iwork( k ). This differs from iwork for ?latm3.

sparse

REAL for slatm2,

DOUBLE PRECISION for dlatm2,

REAL for clatm2,

DOUBLE PRECISION for zlatm2,

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.

Output Parameters
iseed

INTEGER.

On exit, the seed is updated.

res

REAL for slatm2,

DOUBLE PRECISION for dlatm2,

COMPLEX for clatm2,

DOUBLE COMPLEX for zlatm2,

Entry of a random matrix.