fn gpfa_precision(
c: &[f64],
r_diag: &[f64],
k_all: &[Vec<f64>],
n_neurons: usize,
n_bins: usize,
n_latents: usize,
) -> (Vec<f64>, f64)Expand description
Assemble the posterior precision M = blkdiag(K_j⁻¹) + AᵀR⁻¹A (row-major,
n_state × n_state with n_state = n_latents · n_bins) and the GP prior
log-determinant log|K|.
AᵀR⁻¹A has the Kronecker form δ_{s,t} (CᵀR⁻¹C)[j,k], so it adds the constant
(CᵀR⁻¹C)[j,k] along the time-diagonal of each (j, k) block. Each GP kernel
carries a 1e-6 jitter so the regularised kernel is the model kernel everywhere
(E-step and likelihood stay mutually consistent), and is Cholesky-factored once
to yield both its inverse block and its log-determinant.