Method
NumCosmoMathMatrixchol_chi2_cols
Declaration [src]
void
ncm_matrix_chol_chi2_cols (
const NcmMatrix* cm,
const NcmVector* theta,
const NcmMatrix* U,
NcmMatrix* work,
NcmVector* chi2
)
Description [src]
Computes the squared Mahalanobis distance of each column of cm from theta under the
covariance $C = U^\intercal U$,
$$\chi^2_p = (x_p - \theta)^\intercal C^{-1} (x_p - \theta),$$
and stores it in the first $n_p$ entries of chi2. The triangular solve
$y_p = (x_p - \theta) U^{-1}$ and the norm $|y_p|^2$ are done in one pass, on blocks of $n_b$
columns, with work as the only scratch.
Only the upper triangle of U is read, its diagonal taken as stored. Since work belongs to
the caller, several threads can share cm and U, each with its own work. The four
arguments must be distinct objects that do not overlap.
Parameters
theta-
Type:
NcmVectorA
NcmVector$\theta$ of length $d$.The data is owned by the caller of the method. U-
Type:
NcmMatrixAn upper triangular $d \times d$
NcmMatrix.The data is owned by the caller of the method. work-
Type:
NcmMatrixA $d \times n_b$
NcmMatrix.The data is owned by the caller of the method. chi2-
Type:
NcmVectorA
NcmVectorof length at least $n_p$.The data is owned by the caller of the method.