Developer Reference

  • 0.10
  • 10/21/2020
  • Public Content
Contents

?latmr

Generates random matrices of various types.

Syntax

void slatmr
(
lapack_int
*m
,
lapack_int
*n
,
char
*dist
,
lapack_int
*iseed
,
char
*sym
,
float
*d
,
lapack_int
*mode
,
float
*cond
,
float
*dmax
,
char
*rsign
,
char
*grade
,
float
*dl
,
lapack_int
*model
,
float
*condl
,
float
*dr
,
lapack_int
*moder
,
float
*condr
,
char
*pivtng
,
lapack_int
*ipivot
,
lapack_int
*kl
,
lapack_int
*ku
,
float
*sparse
,
float
*anorm
,
char
*pack
,
float
*a
,
lapack_int
*lda
,
lapack_int
*iwork
,
lapack_int
*info
);
void dlatmr
(
lapack_int
*m
,
lapack_int
*n
,
char
*dist
,
lapack_int
*iseed
,
char
*sym
,
double
*d
,
lapack_int
*mode
,
double
*cond
,
double
*dmax
,
char
*rsign
,
char
*grade
,
double
*dl
,
lapack_int
*model
,
double
*condl
,
double
*dr
,
lapack_int
*moder
,
double
*condr
,
char
*pivtng
,
lapack_int
*ipivot
,
lapack_int
*kl
,
lapack_int
*ku
,
double
*sparse
,
double
*anorm
,
char
*pack
,
double
*a
,
lapack_int
*lda
,
lapack_int
*iwork
,
lapack_int
*info
);
void clatmr
(
lapack_int
*m
,
lapack_int
*n
,
char
*dist
,
lapack_int
*iseed
,
char
*sym
,
lapack_complex
*d
,
lapack_int
*mode
,
float
*cond
,
lapack_complex
*dmax
,
char
*rsign
,
char
*grade
,
lapack_complex
*dl
,
lapack_int
*model
,
float
*condl
,
lapack_complex
*dr
,
lapack_int
*moder
,
float
*condr
,
char
*pivtng
,
lapack_int
*ipivot
,
lapack_int
*kl
,
lapack_int
*ku
,
float
*sparse
,
float
*anorm
,
char
*pack
,
float
*a
,
lapack_int
*lda
,
lapack_int
*iwork
,
lapack_int
*info
);
void zlatmr
(
lapack_int
*m
,
lapack_int
*n
,
char
*dist
,
lapack_int
*iseed
,
char
*sym
,
lapack_complex_double
*d
,
lapack_int
*mode
,
float
*cond
,
lapack_complex_double
*dmax
,
char
*rsign
,
char
*grade
,
lapack_complex_double
*dl
,
lapack_int
*model
,
float
*condl
,
lapack_complex_double
*dr
,
lapack_int
*moder
,
float
*condr
,
char
*pivtng
,
lapack_int
*ipivot
,
lapack_int
*kl
,
lapack_int
*ku
,
float
*sparse
,
float
*anorm
,
char
*pack
,
float
*a
,
lapack_int
*lda
,
lapack_int
*iwork
,
lapack_int
*info
);
Description
The
?latmr
routine operates by applying the following sequence of operations:
  1. Generate a matrix
    A
    with random entries of distribution
    dist
    :
    If
    sym
    =
    'S'
    , the matrix is symmetric,
    If
    sym
    =
    'H'
    , the matrix is Hermitian,
    If
    sym
    =
    'N'
    , the matrix is nonsymmetric.
  2. Set the diagonal to
    D
    , where
    D
    may be input or computed according to
    mode
    ,
    cond
    ,
    dmax
    and
    rsign
    as described below.
  3. Grade the matrix, if desired, from the left or right as specified by grade. The inputs
    dl
    ,
    model
    ,
    condl
    ,
    dr
    ,
    moder
    and
    condr
    also determine the grading as described below.
  4. Permute, if desired, the rows and/or columns as specified by
    pivtng
    and
    ipivot
    .
  5. Set random entries to zero, if desired, to get a random sparse matrix as specified by
    sparse
    .
  6. Make
    A
    a band matrix, if desired, by zeroing out the matrix outside a band of lower bandwidth
    kl
    and upper bandwidth
    ku
    .
  7. Scale
    A
    , if desired, to have maximum entry
    anorm
    .
  8. Pack the matrix if desired. See options specified by the
    pack
    parameter.
If two calls to
?latmr
differ only in the pack parameter, they generate mathematically equivalent matrices. If two calls to
?latmr
both have full bandwidth (
kl
=
m
-1
and
ku
=
n
-1
), and differ only in the
pivtng
and
pack
parameters, then the matrices generated differ only in the order of the rows and columns, and otherwise contain the same data. This consistency cannot be and is not maintained with less than full bandwidth.
Input Parameters
m
Number of rows of
A
.
n
Number of columns of
A
.
dist
On entry,
dist
specifies the type of distribution to be used to generate a random matrix .
If
dist
=
'U'
, real and imaginary parts are independent uniform( 0, 1 ).
If
dist
=
'S'
, real and imaginary parts are independent uniform( -1, 1 ).
If
dist
=
'N'
, real and imaginary parts are independent normal( 0, 1 ).
If
dist
=
'D'
, distribution is uniform on interior of unit disk.
iseed
Array, size 4.
On entry,
iseed
specifies the seed of the random number generator. They should lie between 0 and 4095 inclusive, and
iseed
[3]
should be odd. The random number generator uses a linear congruential sequence limited to small integers, and so should produce machine independent random numbers.
sym
If
sym
=
'S'
, generated matrix is symmetric.
If
sym
=
'H'
, generated matrix is Hermitian.
If
sym
=
'N'
, generated matrix is nonsymmetric.
d
On entry this array specifies the diagonal entries of the diagonal of
A
.
d
may either be specified on entry, or set according to
mode
and
cond
as described below. If the matrix is Hermitian, the real part of
d
is taken. May be changed on exit if
mode
is nonzero.
mode
On entry describes how
d
is to be used:
mode
= 0
means use
d
as input.
mode
= 1
sets
d
[0]
=1
and
d
[1:
n
- 1]
=1.0/
cond
.
mode
= 2
sets
d
[0:
n
- 2]
=1 and
d
[
n
- 1]
=1.0/
cond
.
mode
= 3
sets
d
[
i
- 1]
=
cond
**(-(
i
-1)/(
n
-1))
.
mode
= 4
sets
d
[
i
- 1]
=1 - (
i
-1)/(
n
-1)*(1 - 1/
cond
)
.
mode
= 5
sets
d
to random numbers in the range
( 1/
cond
, 1 )
such that their logarithms are uniformly distributed.
mode
= 6
sets
d
to random numbers from same distribution as the rest of the matrix.
mode
< 0
has the same meaning as
abs(
mode
)
, except that the order of the elements of
d
is reversed.
Thus if
mode
is between 1 and 4,
d
has entries ranging from 1 to 1/
cond
, if between -1 and -4,
D
has entries ranging from 1/
cond
to 1.
cond
On entry, used as described under
mode
above. If used,
cond
must be
1.
dmax
If
mode
is not -6, 0, or 6, the diagonal is scaled by
dmax
/ max(abs(
d
[
i
]
))
, so that maximum absolute entry of diagonal is
abs(
dmax
)
. If
dmax
is complex (or zero), the diagonal is scaled by a complex number (or zero).
rsign
If
mode
is not -6, 0, or 6, specifies the sign of the diagonal as follows:
For
slatmr
and
dlatmr
, if
rsign
=
'T'
, diagonal entries are multiplied 1 or -1 with a probability of 0.5.
For
clatmr
and
zlatmr
, if
rsign
=
'T'
, diagonal entries are multiplied by a random complex number uniformly distributed with absolute value 1.
If
r
sign
=
'F'
, diagonal entries are unchanged.
grade
Specifies grading of matrix as follows:
If
grade
=
'N'
, there is no grading
If
grade
=
'L'
, matrix is premultiplied by diag(
dl
) (only if matrix is nonsymmetric)
If
grade
=
'R'
, matrix is postmultiplied by diag(
dr
) (only if matrix is nonsymmetric)
If
grade
=
'B'
, matrix is premultiplied by diag(
dl
) and postmultiplied by diag(
dr
) (only if matrix is nonsymmetric)
If
grade
=
'H'
, matrix is premultiplied by diag(
dl
) and postmultiplied by diag(
conjg(
dl
)
) (only if matrix is Hermitian or nonsymmetric)
If
grade
=
'S'
, matrix is premultiplied by diag(
dl
) and postmultiplied by diag(
dl
) (only if matrix is symmetric or nonsymmetric)
If
grade
=
'E'
, matrix is premultiplied by diag(
dl
) and postmultiplied by
inv( diag(
dl
) )
(only if matrix is nonsymmetric)
if
grade
=
'E'
, then
m
must equal
n
.
dl
Array, size (
m
).
If
model
= 0
, then on entry this array specifies the diagonal entries of a diagonal matrix used as described under grade above.
If
model
is not zero, then
dl
is set according to
model
and
condl
, analogous to the way
D
is set according to
mode
and
cond
(except there is no
dmax
parameter for
dl
).
If
grade
=
'E'
, then
dl
cannot have zero entries.
Not referenced if
grade
=
'N'
or
'R'
. Changed on exit.
model
This specifies how the diagonal array
dl
is computed, just as
mode
specifies how
D
is computed.
condl
When
model
is not zero, this specifies the condition number of the computed
dl
.