range_qfr(): internal function to obtain the possible range of
a ratio of quadratic forms,
\(\frac{ \mathbf{x^{\mathit{T}} A x} }{ \mathbf{x^{\mathit{T}} B x} }
\).
gen_eig() is an internal function to obtain generalized eigenvalues,
i.e., roots of
\(\det{\mathbf{A} - \lambda \mathbf{B}} = 0\),
which are the eigenvalues of \(\mathbf{B}^{-1} \mathbf{A}\) if
\(\mathbf{B}\) is nonsingular.
range_qfr(
A,
B,
eigB = eigen(B, symmetric = TRUE),
tol = .Machine$double.eps * 100,
t = 0.001
)gen_eig(
A,
B,
eigB = eigen(B, symmetric = TRUE),
Ad = with(eigB, crossprod(crossprod(A, vectors), vectors)),
tol = .Machine$double.eps * 100,
t = 0.001
)
Symmetric matrices. No check is done.
Result of eigen(B) can be passed when already computed
Tolerance to determine numerical zero
Tolerance used to determine whether estimates are numerically stable; \(t\) in Jennings et al. (1978).
A rotated with eigenvectors of B can be passed
when already computed
gen_eig() solves the generalized eigenvalue problem with
Jennings et al.'s (1978) algorithm. The sign of infinite eigenvalue
(when present) cannot be determined from this algorithm, so is deduced
as follows: (1) \(\mathbf{A}\) and \(\mathbf{B}\) are rotated by
the eigenvectors of \(\mathbf{B}\); (2) the submatrix of rotated
\(\mathbf{A}\) corresponding to the null space of \(\mathbf{B}\)
is examined; (3) if this is nonnegative (nonpositive) definite, the result
must have positive (negative, resp.) infinity; if this is indefinite,
the result must have both positive and negative infinities;
if this is (numerically) zero, the result must have NaN. The last
case is expeted to happen very rarely, as in this case Jennings algorithm
would fail. This is where the null space of \(\mathbf{B}\) is
a subspace of that of \(\mathbf{A}\), so that the range of ratio of
quadratic forms can be well-behaved. range_qfr() tries to detect
this case and handle the range accordingly, but if that is infeasible
it returns c(-Inf, Inf).
Jennings, A., Halliday, J. and Cole, M. J. (1978) Solution of linear generalized eigenvalue problems containing singular matrices. Journal of the Institute of Mathematics and Its Applications, 22, 401--410. tools:::Rd_expr_doi("10.1093/imamat/22.4.401").