Schur-methods.Rd
Computes the Schur factorization of an \(n \times n\) real matrix \(A\), which has the general form $$A = Q T Q'$$ where \(Q\) is an orthogonal matrix and \(T\) is a block upper triangular matrix with \(1 \times 1\) and \(2 \times 2\) diagonal blocks specifying the real and complex conjugate eigenvalues of \(A\). The column vectors of \(Q\) are the Schur vectors of \(A\), and \(T\) is the Schur form of \(A\).
Methods are built on LAPACK routine dgees
.
Schur(x, vectors = TRUE, ...)
An object representing the factorization, inheriting
from virtual class SchurFactorization
if vectors = TRUE
. Currently, the specific class
is always Schur
in that case.
An exception is if x
is a traditional matrix,
in which case the result is a named list containing
Q
, T
, and EValues
slots of the
Schur
object.
If vectors = FALSE
, then the result is the same
named list but without Q
.
The LAPACK source code, including documentation; see https://netlib.org/lapack/double/dgees.f.
Golub, G. H., & Van Loan, C. F. (2013). Matrix computations (4th ed.). Johns Hopkins University Press. doi:10.56021/9781421407944
showMethods("Schur", inherited = FALSE)
#> Function: Schur (package Matrix)
#> x="dgeMatrix"
#> x="diagonalMatrix"
#> x="dsyMatrix"
#> x="generalMatrix"
#> x="matrix"
#> x="symmetricMatrix"
#> x="triangularMatrix"
#>
set.seed(0)
Schur(Hilbert(9L)) # real eigenvalues
#> Schur factorization of Formal class 'Schur' [package "Matrix"] with 5 slots
#> ..@ Q :Formal class 'dgeMatrix' [package "Matrix"] with 4 slots
#> .. .. ..@ Dim : int [1:2] 9 9
#> .. .. ..@ Dimnames:List of 2
#> .. .. .. ..$ : NULL
#> .. .. .. ..$ : NULL
#> .. .. ..@ x : num [1:81] 0.709 0.429 0.318 0.255 0.215 ...
#> .. .. ..@ factors : list()
#> ..@ T :Formal class 'ddiMatrix' [package "Matrix"] with 4 slots
#> .. .. ..@ diag : chr "N"
#> .. .. ..@ Dim : int [1:2] 9 9
#> .. .. ..@ Dimnames:List of 2
#> .. .. .. ..$ : NULL
#> .. .. .. ..$ : NULL
#> .. .. ..@ x : num [1:9] 1.73 3.22e-01 3.10e-02 1.98e-03 8.76e-05 ...
#> ..@ EValues : num [1:9] 1.73 3.22e-01 3.10e-02 1.98e-03 8.76e-05 ...
#> ..@ Dim : int [1:2] 9 9
#> ..@ Dimnames:List of 2
#> .. ..$ : NULL
#> .. ..$ : NULL
(A <- Matrix(round(rnorm(25L, sd = 100)), 5L, 5L))
#> 5 x 5 Matrix of class "dgeMatrix"
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 126 -154 76 -41 -22
#> [2,] -33 -93 -80 25 38
#> [3,] 133 -29 -115 -89 13
#> [4,] 127 -1 -29 44 80
#> [5,] 41 240 -30 -124 -6
(sch.A <- Schur(A)) # complex eigenvalues
#> Schur factorization of Formal class 'Schur' [package "Matrix"] with 5 slots
#> ..@ Q :Formal class 'dgeMatrix' [package "Matrix"] with 4 slots
#> .. .. ..@ Dim : int [1:2] 5 5
#> .. .. ..@ Dimnames:List of 2
#> .. .. .. ..$ : NULL
#> .. .. .. ..$ : NULL
#> .. .. ..@ x : num [1:25] 0.217 0.589 0.218 0.172 -0.727 ...
#> .. .. ..@ factors : list()
#> ..@ T :Formal class 'dgeMatrix' [package "Matrix"] with 4 slots
#> .. .. ..@ Dim : int [1:2] 5 5
#> .. .. ..@ Dimnames:List of 2
#> .. .. .. ..$ : NULL
#> .. .. .. ..$ : NULL
#> .. .. ..@ x : num [1:25] -174 0 0 0 0 ...
#> .. .. ..@ factors : list()
#> ..@ EValues : cplx [1:5] -174+0i -127+0i 171+0i ...
#> ..@ Dim : int [1:2] 5 5
#> ..@ Dimnames:List of 2
#> .. ..$ : NULL
#> .. ..$ : NULL
## A ~ Q T Q' in floating point
str(e.sch.A <- expand2(sch.A), max.level = 2L)
#> List of 3
#> $ Q :Formal class 'dgeMatrix' [package "Matrix"] with 4 slots
#> $ T :Formal class 'dgeMatrix' [package "Matrix"] with 4 slots
#> $ Q.:Formal class 'dgeMatrix' [package "Matrix"] with 4 slots
stopifnot(all.equal(A, Reduce(`%*%`, e.sch.A)))
(e1 <- eigen(sch.A@T, only.values = TRUE)$values)
#> [1] -174.40264+ 0.00000i 170.69832+ 0.00000i -127.02417+ 0.00000i
#> [4] 43.36424+84.24445i 43.36424-84.24445i
(e2 <- eigen( A , only.values = TRUE)$values)
#> [1] -174.40264+ 0.00000i 170.69832+ 0.00000i -127.02417+ 0.00000i
#> [4] 43.36424+84.24445i 43.36424-84.24445i
(e3 <- sch.A@EValues)
#> [1] -174.40264+ 0.00000i -127.02417+ 0.00000i 170.69832+ 0.00000i
#> [4] 43.36424+84.24445i 43.36424-84.24445i
stopifnot(exprs = {
all.equal(e1, e2, tolerance = 1e-13)
all.equal(e1, e3[order(Mod(e3), decreasing = TRUE)], tolerance = 1e-13)
identical(Schur(A, vectors = FALSE),
list(T = sch.A@T, EValues = e3))
identical(Schur(as(A, "matrix")),
list(Q = as(sch.A@Q, "matrix"),
T = as(sch.A@T, "matrix"), EValues = e3))
})