jcmgray / cotengra

Hyper optimized contraction trees for large tensor networks and einsums
https://cotengra.readthedocs.io
Apache License 2.0
178 stars 32 forks source link

Possibly a bug in line 200 of hyper.py #1

Closed panzhang83 closed 4 years ago

panzhang83 commented 4 years ago

For example, if methods="greedy", after the following line, self._methods = DEFAULT_METHODS if methods is None else list(methods) self._methods would become ['g','r','e','e','d','y'] which is not expected. I think line 200 should be modified as self._methods = DEFAULT_METHODS if methods is None else [methods]

jcmgray commented 4 years ago

So the methods parameter is intentionally meant to be an iterable of str

"""
Parameters
    ----------
    methods : None or sequence[str], optional
        Which methods to use from ``list_hyper_functions()``.
"""

so you would need to supply methods=['greedy'], though it might be convenient to specially handle the case of a string supplied as a single method!

jcmgray commented 4 years ago

As of this commit you can supply single strings!