list_to_dict_list

  • full name: tenpy.tools.misc.list_to_dict_list

  • parent module: tenpy.tools.misc

  • type: function

tenpy.tools.misc.list_to_dict_list(l)[source]

Given a list l of objects, construct a lookup table.

This function will handle duplicate entries in l.

Parameters:

l (iterable of iterable of immutable) – A list of objects that can be converted to tuples to be used as keys for a dictionary.

Returns:

lookup – A dictionary with (key, value) pairs (key):[i1,i2,...] where i1, i2, ... are the indices where key is found in l: i.e. key == tuple(l[i1]) == tuple(l[i2]) == ...

Return type:

dict