bayespecon._logdet.make_flow_separable_logdet¶
-
bayespecon._logdet.make_flow_separable_logdet(W_sparse, n, method=
None, rho_min=-1.0, rho_max=1.0, cheb_order=20, trace_estimator='hutchpp', trace_k=None)[source]¶ Pre-compute logdet data for separable flow models and return a logdet callable.
For the separable constraint \(\rho_w = -\rho_d \rho_o\) the full system log-determinant factors exactly as
\[\log|L_o \otimes L_d| = n\,\log|I_n - \rho_d W| + n\,\log|I_n - \rho_o W|\]This function pre-computes the required data once at model initialisation and returns a closure that evaluates the expression as a symbolic
pytensorscalar, suitable forpm.Potential.- Parameters:¶
- W_sparse : array-like or scipy.sparse matrix¶
Row-standardised \(n \times n\) spatial weights matrix.
- n : int¶
Number of spatial units.
- method=
None¶ "eigenvalue"— exact O(n) per-step evaluation after O(n³) eigendecomposition. Exact for any rho."chebyshev"— near-minimax Chebyshev polynomial; O(m) per step after O(n³) or O(R·n·m) precomputation viachebyshev(). Coefficients use exact eigenvalues whennis small, otherwise a stochastic trace estimator selected bytrace_estimator.- rho_min : float, default -1.0¶
Lower bound of the rho domain (
"chebyshev"only).- rho_max : float, default 1.0¶
Upper bound of the rho domain (
"chebyshev"only).- cheb_order : int, default 20¶
Chebyshev polynomial order (
"chebyshev"only).- trace_estimator : {"hutchinson", "hutchpp", "xtrace"}, default "hutchpp"¶
Stochastic trace estimator used to build Chebyshev coefficients when an eigendecomposition is unavailable.
- trace_k : int, optional¶
Number of probe vectors for the trace estimator.
- Returns:¶
Function
fn(rho_d, rho_o) -> pt.TensorVariableevaluating \(n\,f(\rho_d) + n\,f(\rho_o)\) where \(f(\rho) = \log|I_n - \rho W|\).- Return type:¶
callable