egttools.numerical.numerical_

The numerical module contains optimized functions and classes to simulate evolutionary dynamics in large populations. This module is written in C++.

Functions

calculate_expected_group_success

Calculate the expected group success eta_G under the stationary distribution.

calculate_expected_indicator

Calculate E[f] = sum_s sd(s) * sum_g P(g|s) * f(g) for an arbitrary indicator f.

calculate_expected_indicators

Calculate E[f_k] for multiple indicator functions in a single pass.

calculate_expected_indicators_precomputed

Compute expected indicators from a precomputed indicator matrix (pure C++, GIL released).

calculate_expected_payoff

Calculate the expected payoff averaged over the stationary distribution.

calculate_expected_state_indicator

Calculate E[f] = sum_s sd(s) * f(s) for a single state-level indicator.

calculate_expected_state_indicators

Calculate E[f_k] = sum_s sd(s) * f_k(s) for multiple state-level indicators in one pass.

calculate_expected_state_indicators_precomputed

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

calculate_hypergeometric_expected_value

Compute E[f | state] = sum_g P(g | state) * f(g) for a single population state.

calculate_hypergeometric_fitness

Compute the fitness of a focal player (not included in strategies) via hypergeometric sampling.

calculate_nb_states

Calculate the number of possible states in a discrete simplex.

calculate_state

Convert a discrete population configuration into a unique index.

calculate_strategies_distribution

Calculate the average frequency of each strategy given a stationary distribution.

is_arpack_enabled

Check if EGTtools was compiled with ARPACK eigensolver support.

is_blas_lapack_enabled

Check if EGTtools was compiled with BLAS/LAPACK acceleration.

is_boost_enabled

Check if EGTtools was compiled with Boost support.

is_openmp_enabled

Check if EGTtools was compiled with OpenMP support.

is_petsc_enabled

Check if EGTtools was compiled with PETSc/SLEPc MPI eigensolver support.

precompute_group_to_state_indicator_matrix

Build a state-level indicator matrix from group-level callables.

replicator_equation

Compute the replicator dynamics gradient for a two-player matrix game.

replicator_equation_n_player

Compute the replicator dynamics gradient for an N-player game defined by a payoff table.

sample_simplex

Convert a state index into a group composition vector.

sample_simplex_directly

Sample a discrete population state uniformly at random from the simplex.

sample_unit_simplex

Sample a point uniformly at random from the unit simplex.

vectorized_replicator_equation

Vectorized computation of the replicator dynamics for three-strategy two-player games.

vectorized_replicator_equation_n_player

Vectorized computation of the replicator dynamics for three-strategy N-player games.

Classes

GeneralPopulationEvolver

Evolver for a general population structure.

MLSGarcia

Multi-level selection following Garcia & van den Bergh (2011).

MLSTraulsen

Multi-level selection following Traulsen & Nowak (2006).

PairwiseComparison

Analytical pairwise-comparison process for finite populations.

PairwiseComparisonNumerical

Numerical solver for evolutionary dynamics under the pairwise comparison rule.

PairwiseComparisonTransitionOperator

Matrix-free transition operator for the pairwise comparison process.