bayespecon._logdet.make_logdet_numpy_vec_fn

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

Return a vectorized numpy (rho_arr: np.ndarray) -> np.ndarray logdet evaluator.

Companion to make_logdet_numpy_fn() for batch evaluation over an array of posterior draws without a Python loop. Each supported method uses an array-native implementation.

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_numpy_fn().

rho_min : float, default -1.0

rho_max : float, default 1.0

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_arr: np.ndarray) -> np.ndarray of shape (G,) computing log|I - rho*W| (or T * log|I - rho*W| for panel models).

Return type:

callable