Interleaves the elements of a \((p x p)\) matrix with those of a different \((p x p)\) matrix to form a \((2p x 2p)\) matrix. This function was originally made to combine the covariance and pseudo covariance matrices of a complex random vector into a single "double covariance matrix", as described in (van den Bos 1995). However, it will accept and operate on matrices of any storage mode.
matrixweave(cov, pcov, FUNC = Conj)
A square matrix with dimension twice that of the input matrices. Each element of which is an element from one of the inputs, and its nearest non-diagonal neighbors are from the other input.
Half of the elements from pcov
present in the output matrix are replaced by FUNC
operated on them. Thus if two 2x2 matrices, A
and B
are given to matrixweave()
, the elements of the result are:
matrixweave(A,B)[i,j] = if(i+j is even) A[ceiling(i/2), ceiling(j/2)]
if(i+j is odd and i > j) B[ceiling(i/2), ceiling(j/2)]
if(i+j is odd and i < j) FUNC(B[ceiling(i/2),ceiling(j/2)])
A square matrix, such as one describing the covariance between two complex random vectors.
A square matrix with the same size as cov. Perhaps a pseudo covariance matrix.
A function to operate on the elements of pcov
. The results of which will be a quarter of the elements of the returned matrix. Default is Conj
.
A. van den Bos, The Multivariate Complex Normal Distribution-a Generalization, IEEE Trans. Inform. Theory 41, 537 (1995).
mahalanobis, vcov.zlm, vcov.rzlm
set.seed(4242)
mata <- matrix(rnorm(9), nrow = 3)
matb <- matrix(rnorm(9), nrow = 3)
matrixweave(mata, matb)
Run the code above in your browser using DataLab