utilities

Utility routines for the markov submodule

quantecon.markov.utilities.sa_indices(num_states, num_actions)[source]

Generate s_indices and a_indices for DiscreteDP, for the case where all the actions are feasible at every state.

Parameters:
num_statesscalar(int)

Number of states.

num_actionsscalar(int)

Number of actions.

Returns:
s_indicesndarray(int, ndim=1)

Array containing the state indices.

a_indicesndarray(int, ndim=1)

Array containing the action indices.

Examples

>>> s_indices, a_indices = qe.markov.sa_indices(4, 3)
>>> s_indices
array([0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3])
>>> a_indices
array([0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2])