randorth {randRotation} | R Documentation |
Generation of a random orthogonal n x n
matrix.
randorth(n, type = c("orthonormal", "unitary"), I.matrix = FALSE)
n |
|
type |
Either |
I.matrix |
If |
A random orthogonal matrix R
is generated in order that t(R)
(for "orthonormal"
) or Conj(t(R))
(for "unitary"
) equals the inverse matrix of R
.
This function was adapted from the pracma package (pracma::randortho
).
The random orthogonal matrices are distributed with Haar measure over
O(n)
, where O(n)
is the set of orthogonal matrices of order n
.
The random orthogonal matrices are basically distributed "uniformly" in the
space of random orthogonal matrices of dimension n x n
.
See also the Examples
and (Stewart 1980; Mezzadri 2007).
A random orthogonal matrix of dimension n x n
.
Peter Hettegger
Mezzadri F (2007).
“How to generate random matrices from the classical compact groups.”
Notices of the American Mathematical Society, 54(5), 592–604.
ISSN 1088-9477, 0609050, http://arxiv.org/abs/0609050.
Stewart GW (1980).
“The Efficient Generation of Random Orthogonal Matrices with an Application to Condition Estimators.”
SIAM Journal on Numerical Analysis.
ISSN 0036-1429, doi: 10.1137/0717034, https://doi.org/10.1137/0717034.
# The following example shows the orthogonality of the random orthogonal matrix: R1 <- randorth(4) zapsmall(t(R1) %*% R1) R1 <- randorth(4, "unitary") zapsmall(Conj(t(R1)) %*% R1) # The following example shows the distribution of 2-dimensional random orthogonal vectors # on the unit circle. tmp1 <- vapply(1:400, function(i)randorth(2)[,1], numeric(2)) plot(t(tmp1), xlab = "x", ylab = "y")