Skip to contents

Eigenvalues and eigenvectors of a square matrix that need not be symmetric, so eigenvalues and eigenvectors may be complex – TDA's mev. t_mat.c's dispatch comment understates this command's arity (mev(A,ER,EI,EV), four arguments); what m_mev actually parses is five (mev(A,ER,EI,EVR,EVI)), splitting the eigenvector matrix into separate real and imaginary parts, as eigen1's header lists them. Column i of the result, EVR[, i] + 1i * EVI[, i], is the right eigenvector for eigenvalue ER[i] + 1i * EI[i], i.e. A %*% v == lambda * v – the same convention and ordering as base R's eigen(A), confirmed on two matrices, one with real eigenvalues and one with an asymmetric complex pair (not simply plus/minus of each other, which the first, simpler test matrix happened to have and which turned out to mask a construction mistake in an earlier verification attempt – recorded here because it is exactly the kind of false confirmation a too-simple or too-symmetric test case can produce, the same lesson tda_mevs needed).

Usage

tda_mev(A, dir = tempfile("tda"))

Arguments

A

a square numeric matrix.

dir

working directory.

Value

A list: values, a complex vector of eigenvalues; vectors, a complex matrix whose columns are the corresponding right eigenvectors.

Details

TDA's mev(A, ER, EI, EVR, EVI) requires all four output operands (none are optional); the wrapper supplies them and folds the real and imaginary parts into complex $values and $vectors.

Examples

tda_mev(matrix(c(0, -1, 1, 0), 2, 2))   # eigenvalues +-i
#> $values
#> [1] 0+1i 0-1i
#> 
#> $vectors
#>                 [,1]            [,2]
#> [1,] 7.395571e-32-1i 7.395571e-32+1i
#> [2,] 1.000000e+00+0i 1.000000e+00+0i
#> 
#> $er
#> [1] 0 0
#> 
#> $ei
#> [1]  1 -1
#> 
#> $evr
#>              [,1]         [,2]
#> [1,] 7.395571e-32 7.395571e-32
#> [2,] 1.000000e+00 1.000000e+00
#> 
#> $evi
#>      [,1] [,2]
#> [1,]   -1    1
#> [2,]    0    0
#>