Argsort¶
Sorts a list of generator objects based on their yielded values. |
argsort_gen¶
- mrmustard.utils.argsort.argsort_gen(generators)[source]¶
Sorts a list of generator objects based on their yielded values.
This function takes a list of generator objects, each yielding a sequence of numbers. It sorts the generators based on their first yielded values. If multiple generators yield the same first value, the function recursively sorts them based on their next yielded values. The result is a list of indices that would sort the original list of generators.
Parameters: gen_list (list): A list of generator objects, each yielding a sequence of numbers.
Returns: list: A list of indices that would sort the original list of generators.
- Parameters:
generators (list[Generator[float, None, None]])
- Return type:
list[int]
code/utils/argsort
Download Python script
Download Notebook
View on GitHub