nag_rngs_orthog_matrix (g05qac) generates a random orthogonal matrix.
nag_rngs_orthog_matrix (g05qac) pre- or post-multiplies an
by
matrix
by a random orthogonal matrix
, overwriting
. The matrix
may optionally be initialized to the identity matrix before multiplying by
, hence
is returned.
is generated using the method of
Stewart (1980). The algorithm can be summarized as follows.
Let
follow independent multinormal distributions with zero mean and variance
and dimensions
; let
, where
is the identity matrix and
is the Householder transformation that reduces
to
,
being the vector with first element one and the remaining elements zero and
being a scalar, and let
. Then the product
is a random orthogonal matrix distributed according to the Haar measure over the set of orthogonal matrices of
. See
Theorem 3.3 in
Stewart (1980).
One of the initialization functions
nag_rngs_init_repeatable (g05kbc) (for a repeatable sequence if computed sequentially) or
nag_rngs_init_nonrepeatable (g05kcc) (for a non-repeatable sequence) must be called prior to the first call to nag_rngs_orthog_matrix (g05qac).
Stewart G W (1980) The efficient generation of random orthogonal matrices with an application to condition estimates SIAM J. Numer. Anal. 17 403–409
- NE_ALLOC_FAIL
Dynamic memory allocation failed.
- NE_BAD_PARAM
On entry, argument had an illegal value.
- NE_ENUM_INT
On entry, and .
Constraint:
if , ;
otherwise .
On entry, and .
Constraint:
if , ;
otherwise .
- NE_INT
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
- NE_INT_2
On entry, and .
Constraint: .
On entry, and .
Constraint: .
- NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact
NAG for assistance.
- NE_ORTHOGONAL_MATRIX
Orthogonal matrix of dimension requested.
The maximum error in
should be a modest multiple of
machine precision (see
Chapter x02).
nag_rngs_corr_matrix (g05qbc) computes a random correlation matrix from a random orthogonal matrix.
Following initialization of the pseudorandom number generator by a call to
nag_rngs_init_repeatable (g05kbc), a
by
orthogonal matrix is generated using the
option and the result printed.
None.