Description Usage Arguments Value Examples
View source: R/quadratic_form.R
quadratic_form
computes the quadratic form \mathbf{x}' \mathbf{A} \mathbf{x} for an
n \times n matrix \mathbf{A} and an n-dimensional vector
\mathbf{x}, i.e., a wrapper for t(x) %*% A %*% x
.
fill_symmetric
and quadratic_form
work with
real and complex valued matrices/vectors.
fill_hermitian
fills up the lower triangular part (NA
)
of an upper triangular matrix to its
Hermitian (symmetric if real matrix) version, such that it satisfies
\mathbf{A} = \bar{\mathbf{A}}', where \bar{z} is the complex
conjugate of z. If the matrix is real-valued this makes it
simply symmetric.
Note that the input matrix must have a real-valued diagonal and
NA
s in the lower triangular part.
1 2 3 | quadratic_form(mat, vec)
fill_hermitian(mat)
|
mat |
numeric; n \times n matrix (real or complex). |
vec |
numeric; n \times 1 vector (real or complex). |
A real/complex value \mathbf{x}' \mathbf{A} \mathbf{x}.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.