xTAx | R Documentation |
Common quadratic forms
xTAx(x, A)
xAxT(x, A)
xTAx_solve(x, A, ...)
xTAx_qrsolve(x, A, tol = 1e-07, ...)
sandwich_solve(A, B, ...)
xTAx_eigen(x, A, tol = sqrt(.Machine$double.eps), ...)
x |
a vector |
A |
a square matrix |
... |
additional arguments to subroutines |
tol |
tolerance argument passed to the relevant subroutine |
B |
a square matrix |
These are somewhat inspired by emulator::quad.form.inv() and others.
xTAx()
: Evaluate x'Ax
for vector x
and square
matrix A
.
xAxT()
: Evaluate xAx'
for vector x
and square
matrix A
.
xTAx_solve()
: Evaluate x'A^{-1}x
for vector x
and
invertible matrix A
using solve()
.
xTAx_qrsolve()
: Evaluate x'A^{-1}x
for vector x
and
matrix A
using QR decomposition and confirming that x
is in the span of A
if A
is singular; returns rank
and nullity
as attributes just in case subsequent calculations
(e.g., hypothesis test degrees of freedom) are affected.
sandwich_solve()
: Evaluate A^{-1}B(A')^{-1}
for B
a
square matrix and A
invertible.
xTAx_eigen()
: Evaluate x' A^{-1} x
for vector x
and
matrix A
(symmetric, nonnegative-definite) via
eigendecomposition; returns rank
and nullity
as attributes
just in case subsequent calculations (e.g., hypothesis test
degrees of freedom) are affected.
Decompose A = P L P'
for L
diagonal matrix of
eigenvalues and P
orthogonal. Then A^{-1} = P L^{-1}
P'
.
Substituting,
x' A^{-1} x = x' P L^{-1} P' x
= h' L^{-1} h
for h = P' x
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.