egttools.numerical.numerical_.PairwiseComparisonTransitionOperator¶
- class PairwiseComparisonTransitionOperator¶
Bases:
pybind11_objectMatrix-free transition operator for the pairwise comparison process.
Computes matrix-vector products
y = P x,y = P^T x, andy = (I - P^T) xwithout ever assembling the transition matrix P. Designed for iterative eigensolvers (scipy.sparse.linalg, petsc4py) and as the basis for future MPI-distributed computation.The stationary distribution π satisfies
P^T π = π. Useapply_transposeor wrap this object withegttools.numerical.linear_operator.make_transition_operatorto obtain ascipy.sparse.linalg.LinearOperator.Construct the matrix-free transition operator.
- Parameters:
population_size (int) – Number of individuals Z (must be >= 2).
game (egttools.games.AbstractGame) – Game object defining strategy fitnesses.
beta (float) – Intensity of selection (Fermi parameter, >= 0).
mu (float) – Mutation probability per step (in [0, 1]).
Methods
Compute y = P x in-place.
Compute y = (I - P^T) x in-place.
Compute y = P^T x in-place.
Compute the stationary distribution via power iteration (pure C++).
Attributes
Intensity of selection β.
Mutation probability μ.
Number of strategies k.
Population size Z.
Total number of simplex states C(Z+k-1, k-1).
- __init__()¶
Construct the matrix-free transition operator.
- Parameters:
population_size (int) – Number of individuals Z (must be >= 2).
game (egttools.games.AbstractGame) – Game object defining strategy fitnesses.
beta (float) – Intensity of selection (Fermi parameter, >= 0).
mu (float) – Mutation probability per step (in [0, 1]).
- __new__(**kwargs)¶
- apply()¶
Compute y = P x in-place.
- Parameters:
x (numpy.ndarray) – Input vector of length
size.y (numpy.ndarray) – Output vector of length
size; zeroed and overwritten.
- apply_residual()¶
Compute y = (I - P^T) x in-place.
Useful for iterative linear solvers: find π such that (I - P^T) π = 0.
- Parameters:
x (numpy.ndarray) – Input vector of length
size.y (numpy.ndarray) – Output vector of length
size; overwritten.
- apply_transpose()¶
Compute y = P^T x in-place.
The stationary distribution π satisfies P^T π = π, so this is the primary operation for iterative eigensolver use.
- Parameters:
x (numpy.ndarray) – Input vector of length
size.y (numpy.ndarray) – Output vector of length
size; zeroed and overwritten.
- compute_stationary_distribution()¶
Compute the stationary distribution via power iteration (pure C++).
Iterates π ← P^T π / ‖P^T π‖₁ until L1 convergence or max_iter is reached. Runs entirely in C++ with no Python callbacks — much faster than wrapping the operator in a
scipy.sparse.linalg.LinearOperatorfor large state spaces.- Parameters:
- Returns:
Normalised stationary distribution of length
size.- Return type:
- Raises:
RuntimeError – If convergence is not reached within max_iter iterations.
- __annotations__ = {}¶
- property beta¶
Intensity of selection β.
- property mu¶
Mutation probability μ.
- property nb_strategies¶
Number of strategies k.
- property population_size¶
Population size Z.
- property size¶
Total number of simplex states C(Z+k-1, k-1).