Learn R Programming

cmvnorm (version 1.1-1)

isHermitian: Is a Matrix Hermitian?

Description

Returns TRUE if a matrix is Hermitian or Hermitian positive-definite

Usage

isHermitian(x, tol = 100 * .Machine$double.eps)
ishpd(x, tol = 100 * .Machine$double.eps)
zapim(x, tol = 100 * .Machine$double.eps)

Arguments

x

A square matrix

tol

Tolerance for numerical scruff

Author

Robin K. S. Hankin

Details

Functions isHermitian() and ishpd() return a Boolean, indicating whether the argument is Hermitian or Hermitian positive definite respectively. Function zapim() zaps small imaginary parts of a vector, returning real if all elements are so zapped.

Examples

Run this code
v <- 2^(1:30)
zapim(v + 1i*exp(-v))

ishpd(matrix(c(1, 0.1i, -0.1i, 1), 2, 2))   # should be TRUE
isHermitian(matrix(c(1, 3i, -3i, 1), 2, 2)) # should be TRUE
ishpd(rcwis(6, 2))                          # should be TRUE

Run the code above in your browser using DataLab