egttools.calculate_expected_state_indicators_precomputed

calculate_expected_state_indicators_precomputed()

Fast path: E[f_k] = sum_s sd(s) * indicator_values(s, k) using a precomputed matrix.

The caller evaluates all indicators on all population states upfront and stores the results in indicator_values (shape: nb_states × nb_indicators). The computation reduces to a sparse-dense dot product per column — no Python callbacks, GIL fully released.

Parameters:
  • stationary_distribution (scipy.sparse.csr_matrix) – Sparse stationary distribution over population states.

  • indicator_values (numpy.ndarray) – Dense matrix of shape (nb_states, nb_indicators). Row s must contain the values of all indicators evaluated on the population state for index s.

Returns:

Vector of length nb_indicators.

Return type:

numpy.ndarray