Utility functions for generating arrays of states in domains
from_iter(state_iter) -> array
Returns array of all states from the state iterator ‘state_iter’.
from_iter(state_mapping) -> state_array, value_array
‘state_mapping’ is assumed to be a mapping keyed by states.
Returns pair of arrays (‘state_array’, ‘value_array’), where the i-th state in ‘state_array’ is the key associated with the i-th element in ‘value_array’.
This function is intended to ease the construction of state arrays with corresponding value arrays from a state mapping. If a value array is not required, simply use from_iter on the state mapping instead.
from_rect(shape [, slices [, origin]]) -> array
Returns array of states in rectangular domain of shape ‘shape’.
Works similarly to cmepy.util.indices_ext, except all dimensions of the array following the first have been flattened.
See cmepy.util.indices_ext for a discussion of the optional arguments.
to_iter(state_array) -> iter
Returns iterator over all states in the state array ‘state_array’.