  Approximating the recent phylogeny of $N$ phased haplotypes at a set of
variants along the genome is a core problem in modern population genomics and
central to performing genome-wide screens for association, selection,
introgression, and other signals. The Li & Stephens (LS) model provides a
simple yet powerful hidden Markov model for inferring the recent ancestry at a
given variant, represented as an $N \times N$ distance matrix based on
posterior decodings. However, existing posterior decoding implementations for
the LS model cannot scale to modern datasets with tens or hundreds of thousands
of genomes. This work focuses on providing a high-performance engine to compute
the LS model, enabling users to rapidly develop a range of variant-specific
ancestral inference pipelines on top, exposed via an easy to use package,
kalis, in the statistical programming language R. kalis exploits both
multi-core parallelism and modern CPU vector instruction sets to enable scaling
to problem sizes that would previously have been prohibitively slow to work
with. The resulting distance matrices enable local ancestry, selection, and
association studies in modern large scale genomic datasets.
