Utilities

General Utilities

hydra_tod.utils collects low-level numerical routines organised into four groups:

Matrix operations

cho_compute_mat_inv() — Cholesky-based inversion of symmetric positive-definite matrices (with automatic regularisation fallback). cho_compute_mat_inv_sqrt() — returns the inverse Cholesky factor \(L^{-T}\) needed for drawing Gaussian samples.

Polynomial projections

polyn_proj — callable class that stores a time list and returns a Legendre polynomial projection matrix on demand. Used to build gain and temperature design matrices.

Log-likelihood evaluation

log_likeli() — fast \(\mathcal{O}(N^2)\) Gaussian log-likelihood for Toeplitz covariances via the Levinson algorithm. log_likeli_general()\(\mathcal{O}(N^3)\) Cholesky-based log-likelihood for arbitrary symmetric positive-definite covariances (returns -inf on failure). log_det_symmetric_toeplitz() — standalone log-determinant for Toeplitz matrices.

DFT and miscellaneous

DFT_matrix(), cov_conjugate() — transform covariances between time and frequency domains. lag_list(), overall_operator(), linear_model().

MPI Utilities

Thin wrappers around mpi4py providing package-wide MPI communicator objects (world, rank, rank0) and helpers for parallel function execution and collective operations used across the pipeline.