⚡ High Performance
Leverages sparse matrix structures for fast computations, enabled by LinearSolve.jl and SelectedInversion.jl.
Clean syntax, fast computations. Powered by the Julia ecosystem.
A Gaussian Markov Random Field (GMRF) is a Gaussian distribution whose precision matrix — the inverse of the covariance — is sparse.
Sparsity in the precision is a modelling statement. A zero in entry
This brings nice computational benefits. The covariance matrix of such a distribution is usually completely dense, so working with it directly costs
The difficulty has always been that the interesting priors are awkward to write down in precision form. One answer for spatial problems is the SPDE approach: state the model as a stochastic partial differential equation, discretize it with finite elements, and obtain a GMRF that approximates it. Getting started walks through both a hand-written precision matrix and an SPDE-derived one.
Install the package:
using Pkg
Pkg.add("GaussianMarkovRandomFields")
using GaussianMarkovRandomFieldsLatte.jl is a probabilistic programming language for latent Gaussian models, built by the same author on top of this package. It provides INLA, TMB-style Laplace approximations and HMC-Laplace behind a concise model syntax. If you want a complete inference workflow rather than the components to build one, start there; this package is what it uses underneath.
Questions, bug reports and feature requests all belong in the issue tracker. Please open an issue rather than emailing the maintainer, so that answers stay searchable for everyone.
The contribution guidelines describe what to include in an issue, how to contribute code, and what to expect regarding response times and project scope.
If you use GaussianMarkovRandomFields.jl in your research, please cite it via its Zenodo archive. That DOI always resolves to the latest release, and the Zenodo page offers BibTeX and other export formats as well as per-version DOIs.
@software{weiland_gmrf_jl,
author = {Weiland, Tim},
title = {{GaussianMarkovRandomFields.jl}},
publisher = {Zenodo},
year = {2025},
doi = {10.5281/zenodo.18088214},
url = {https://doi.org/10.5281/zenodo.18088214}
}