Compute LD matrix using GCTA-style formula matching the DENTIST binary.
Source:R/RcppExports.R
compute_LD_gcta_cpp.RdThis function computes pairwise Pearson correlations from a genotype matrix using the exact same formula and floating-point operation order as the original DENTIST C++ binary (calcLDFromBfile_gcta in bfileOperations.cpp). Key differences from R's crossprod-based approach: 1. Accumulates integer-valued sums sequentially (exact intermediate values) 2. Handles per-pair missing data with GCTA correction formula 3. Divides by nKeptSample (trimmed to multiple of 4), not nrow(X)