Evaluate a matrix-induced inner product
Source:R/03_03_DeCovarT_estimate_ratios_frequentist.R
dot-inner_product.RdComputes \(\langle\boldsymbol{x},\boldsymbol{y}\rangle_{\boldsymbol{A}} =\boldsymbol{x}^{\mathsf{T}}\boldsymbol{A}\boldsymbol{y}\). When \(\boldsymbol{A}\) is symmetric positive definite (as for a non-degenerate Gaussian covariance or precision), this is the \(\boldsymbol{A}\)-inner product on \(\mathbb{R}^{p}\) (https://en.wikipedia.org/wiki/Inner_product_space#Basic_properties). Prefer this name over the generic "bilinear form" when \(\boldsymbol{A}\) is SPD; the Euclidean inner product is the special case \(\boldsymbol{A}=\mathbf{I}\) (\(\boldsymbol{x}^{\mathsf{T}}\boldsymbol{y}\)).
Details
Implementation uses base::crossprod() as
drop(crossprod(x, A %*% y)), which is the standard efficient route to
a bilinear / quadratic form in R (avoids an explicit transpose of
\(\boldsymbol{x}\) and a temporary outer product).