diff options
| author | Pjotr Prins | 2025-11-23 14:09:24 +0100 |
|---|---|---|
| committer | Pjotr Prins | 2025-11-23 14:09:24 +0100 |
| commit | 8229e4e18dddae7bf570ca37767ff39726eede45 (patch) | |
| tree | 17986d394dbc3a03da9bebe6eba96119dff571dd /src/mathfunc.cpp | |
| parent | ff196955e3ca5bdd671a44f852f42323d3828be2 (diff) | |
| download | pangemma-8229e4e18dddae7bf570ca37767ff39726eede45.tar.gz | |
Diffstat (limited to 'src/mathfunc.cpp')
| -rw-r--r-- | src/mathfunc.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/mathfunc.cpp b/src/mathfunc.cpp index a1c6c29..a351509 100644 --- a/src/mathfunc.cpp +++ b/src/mathfunc.cpp @@ -494,7 +494,20 @@ void StandardizeVector(gsl_vector *y) { } // Calculate UtX (U gets transposed) -// CalcUtX transforms a genotype matrix into the eigenspace by computing U^T × X, where U contains the eigenvectors from the kinship matrix decomposition. This transformation diagonalizes the correlation structure induced by relatedness, making subsequent likelihood calculations tractable and efficient. The function overwrites its input with the transformed result, using a temporary copy to avoid data corruption. +/* +CalcUtX transforms a genotype matrix by the eigenvector matrix from the kinship matrix decomposition. +Purpose: + +Computes UtX = U^T × X, where: + + U: Eigenvector matrix from the spectral decomposition of the kinship matrix K + X: Genotype matrix (individuals × SNPs) + UtX: Transformed genotype matrix + +This transformation rotates the genotype data into the eigenspace where the kinship-induced correlations become diagonal, simplifying likelihood calculations. + +CalcUtX transforms a genotype matrix into the eigenspace by computing U^T × X, where U contains the eigenvectors from the kinship matrix decomposition. This transformation diagonalizes the correlation structure induced by relatedness, making subsequent likelihood calculations tractable and efficient. The function overwrites its input with the transformed result, using a temporary copy to avoid data corruption. +*/ void CalcUtX(const gsl_matrix *U, gsl_matrix *UtX) { gsl_matrix *X = gsl_matrix_safe_alloc(UtX->size1, UtX->size2); gsl_matrix_safe_memcpy(X, UtX); |
