Utility Functions for CGE Models#

unpack_equation_strings(equations, coords)

Helper function to unpack equations names with <dim:i> tags to a long list of equations.

ensure_input_is_sequence(x)

Convert non-sequence inputs into a singleton list.

infer_object_shape_from_coords(obj, coords)

Infer the shape of a CGE Model object from a provided coordinate dictionary.

make_flat_array_return_mask(x, all_objects, ...)

flat_array_to_variable_dict(x, objects, coords)

Convert a flat array to a dictionary of variables and parameters.

variable_dict_to_flat_array(d, ...)

Convert a dictionary of variables and parameters to a single long vector.

flat_mask_from_param_names(param_dict, names)

Optimization Wrapper#