Learn R Programming

pdSpecEst (version 1.2.4)

H.coeff: Orthonormal basis expansion of a Hermitian matrix

Description

H.coeff expands a \((d,d)\)-dimensional Hermitian matrix H with respect to an orthonormal (in terms of the Frobenius inner product) basis of the space of Hermitian matrices. That is, H.coeff transforms H into a numeric vector of \(d^2\) real-valued basis coefficients, which is possible as the space of Hermitian matrices is a real vector space. Let \(E_{nm}\) be a \((d,d)\)-dimensional zero matrix with a 1 at location \((1, 1) \leq (n,m) \leq (d,d)\). The orthonormal basis contains the following matrix elements; let \(1 \le n \le d\) and \(1 \le m \le d\),

If n == m

the real matrix element \(E_{nn}\)

If n < m

the complex matrix element \(2i/\sqrt 2 E_{nm}\)

If n > m

the real matrix element \(2/\sqrt 2 E_{nm}\)

The orthonormal basis coefficients are ordered by scanning through the matrix H in a row-by-row fashion.

Usage

H.coeff(H, inverse = FALSE)

Arguments

H

if inverse = FALSE, a \((d,d)\)-dimensional Hermitian matrix; if inverse = TRUE, a numeric vector of length \(d^2\) with \(d\) an integer.

inverse

a logical value that determines whether the forward basis transform (inverse = FALSE) or the inverse basis transform (inverse = TRUE) should be applied.

Value

If inverse = FALSE takes as input a \((d,d)\)-dimensional Hermitian matrix and outputs a numeric vector of length \(d^2\) containing the real-valued basis coefficients. If inverse = TRUE takes as input a \(d^2\)-dimensional numeric vector of basis coefficients and outputs the corresponding \((d,d)\)-dimensional Hermitian matrix.

Examples

Run this code
# NOT RUN {
## random Hermitian matrix
H <- matrix(complex(real = rnorm(9), imaginary = rnorm(9)), nrow = 3)
diag(H) <- rnorm(3)
H[lower.tri(H)] <- t(Conj(H))[lower.tri(H)]

## orthonormal basis expansion
h <- H.coeff(H)
H1 <- H.coeff(h, inverse = TRUE) ## reconstructed Hermitian matrix
all.equal(H, H1)

# }

Run the code above in your browser using DataLab