bayespecon.logdet.logdet_eigenvalue

bayespecon.logdet.logdet_eigenvalue(rho, eigs)[source]

Eigenvalue-based log|I - rho*W|.

Pre-compute eigs = np.linalg.eigvals(W).real once; each evaluation costs O(n) and is exactly differentiable by pytensor autodiff.

Parameters:
rho : pytensor scalar

Spatial parameter (rho or lambda).

eigs : np.ndarray

Real parts of W’s eigenvalues, shape (n,).

Returns:

Symbolic log-determinant.

Return type:

pytensor.tensor.TensorVariable

Notes

Stability requires |rho| < 1 / max(|eigs|); for row-standardised W this is |rho| < 1. When 1 - rho * eig_i is numerically zero (rho exactly at the stability boundary) the unguarded log would return -inf. The argument is therefore clamped at a small floor (1e-300) before taking log; this keeps NUTS gradients finite and produces a very large negative penalty rather than a hard NaN. Callers should still constrain rho away from 1 / eig_max via the prior bounds.