bayespecon._logdet.make_logdet_numpy_fn

bayespecon._logdet.make_logdet_numpy_fn(W_sparse, eigs, method, rho_min=-1.0, rho_max=1.0, T=1, trace_estimator='hutchpp', trace_k=None)[source]

Return a pure-numpy (rho: float) -> float logdet evaluator.

Used for post-sampling log-likelihood Jacobian computation (outside any PyMC/PyTensor graph context). Mirrors make_logdet_fn() but returns a plain Python callable instead of a PyTensor expression.

Parameters:
W_sparse : scipy.sparse matrix

Row-standardised n×n spatial weights matrix.

eigs : np.ndarray, optional

Optional pre-computed real eigenvalues of W.

method : str or None

Same as make_logdet_fn(). None auto-selects via _auto_logdet_method().

rho_min : float, default -1.0

Lower bound (used for chebyshev/spline precomputation).

rho_max : float, default 1.0

Upper bound.

T : int, default 1

Panel time-period count. The returned log-determinant is multiplied by T.

trace_estimator : {"hutchinson", "hutchpp", "xtrace"}, default "hutchpp"

Stochastic trace estimator used to build the Chebyshev coefficients when an eigendecomposition is unavailable.

trace_k : int, optional

Number of probe vectors for the trace estimator. Defaults: 30 (hutchinson), 50 (hutchpp), 25 (xtrace).

Returns:

Function (rho: float) -> float computing log|I - rho*W| (or T * log|I - rho*W| for panel models).

Return type:

callable