egttools.utils

This python module contains some utility functions to find saddle points and plot gradients in 2 player, 2 strategy games.

Functions

calculate_nb_unique_combinations

Calculates the number of unique combinations given the required number of elements of each group, which should be given in List format in the slots_per_bin parameter.

calculate_spectral_gap

Compute the spectral gap of a Markov chain transition matrix.

calculate_stationary_distribution

Calculates the stationary distribution of a Markov chain from its transition matrix.

calculate_stationary_distribution_non_hermitian

Calculates the stationary distribution of a Markov chain using a Schur decomposition.

combine

Outputs a generator that will generate an ordered list with the possible combinations of values with length.

eigvals

Compute eigenvalues from an ordinary or generalized eigenvalue problem.

find_saddle_type_and_gradient_direction

Finds whether a saddle point is stable or not.

get_payoff_function

Returns a function which gives the payoff of strategy i against strategy j.

issparse

Is x either sparse array or sparse matrix type?

schur

Compute Schur decomposition of a matrix.

sp_identity

Identity matrix in sparse format.

sparse_eigs

Find k eigenvalues and eigenvectors of the square matrix A.

spsolve

Solve the sparse linear system Ax=b, where b may be a vector or a matrix.

transform_graph_to_dict_of_lists

transform_payoffs_to_pairwise

This function transform a payoff matrix in full format to a pairwise format.

warn

Issue a warning, or maybe ignore it or raise an exception.

Classes

AbstractGame

Base class for all game-theoretic models in EGTtools.

Graph

Base class for undirected graphs.

csc_matrix

Compressed Sparse Column matrix.

csr_matrix

Compressed Sparse Row matrix.

sparray

This class provides a base class for all sparse array and matrix classes.

spmatrix

This class provides a base class for all sparse matrix classes.

Exceptions

MatrixRankWarning

Warning for exactly singular matrices.