H.coeff: Orthonormal basis expansion of a Hermitian matrix

Description Usage Arguments Value Examples

View source: R/benchmark.R

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) ≤q (n,m) ≤q (d,d). The orthonormal basis contains the following matrix elements; let 1 ≤ n ≤ d and 1 ≤ m ≤ d,

If n == m

the real matrix element E_{nn}

If n < m

the complex matrix element 2i/√ 2 E_{nm}

If n > m

the real matrix element 2/√ 2 E_{nm}

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

Usage

1
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

1
2
3
4
5
6
7
8
9
## 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)

pdSpecEst documentation built on Jan. 8, 2020, 5:08 p.m.