bayespecon.logdet.flow_logdet_pytensor

bayespecon.logdet.flow_logdet_pytensor(rho_d, rho_o, rho_w, poly_a, poly_b, poly_c, poly_coeffs, miter_a, miter_b, miter_c, miter_coeffs, miter, titer=800)[source]

Differentiable PyTensor log-determinant for the flow SAR model.

Evaluates

\[\log|I_N - \rho_d W_d - \rho_o W_o - \rho_w W_w|\]

as a fully differentiable PyTensor expression suitable for use as pm.Potential("jacobian", flow_logdet_pytensor(...)).

The computation has two parts:

  1. Polynomial part (orders 1 to miter): vectorised sum over precomputed (a, b, c, coeff) triples — no Python loop at evaluation time.

  2. Geometric tail (orders miter+1 to titer): closed-form sum using the upper-bound approximation \(\text{tr}(W_F^k) \approx s^{k-m} \cdot \text{tr}(W_F^m)\) where \(s = \rho_d + \rho_o + \rho_w\) is the spectral-radius bound for row-stochastic W, following fodet1.m lines 60–70.

Parameters:
rho_d

PyTensor scalar variables for the three spatial parameters.

rho_o

PyTensor scalar variables for the three spatial parameters.

rho_w

PyTensor scalar variables for the three spatial parameters.

poly_a

Precomputed exponent arrays and coefficients for the polynomial part, from _flow_logdet_poly_coeffs().

poly_b

Precomputed exponent arrays and coefficients for the polynomial part, from _flow_logdet_poly_coeffs().

poly_c

Precomputed exponent arrays and coefficients for the polynomial part, from _flow_logdet_poly_coeffs().

poly_coeffs

Precomputed exponent arrays and coefficients for the polynomial part, from _flow_logdet_poly_coeffs().

miter_a

Exponents and trace-product weights for the highest-order polynomial terms (k = miter), used to compute tr(W_F^miter) symbolically for the geometric tail.

miter_b

Exponents and trace-product weights for the highest-order polynomial terms (k = miter), used to compute tr(W_F^miter) symbolically for the geometric tail.

miter_c

Exponents and trace-product weights for the highest-order polynomial terms (k = miter), used to compute tr(W_F^miter) symbolically for the geometric tail.

miter_coeffs

Exponents and trace-product weights for the highest-order polynomial terms (k = miter), used to compute tr(W_F^miter) symbolically for the geometric tail.

miter : int

Highest polynomial order included in the exact series.

titer : int, default=800

Highest order included in the geometric tail approximation.

Returns:

Scalar log-determinant expression.

Return type:

pytensor.tensor.TensorVariable