Skip to content

Commit

Permalink
fix alias
Browse files Browse the repository at this point in the history
  • Loading branch information
to24toro committed Nov 2, 2023
1 parent f80d264 commit 77ca584
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions qiskit_dynamics/arraylias/alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
ArrayLike = Union[Union[DYNAMICS_NUMPY_ALIAS.registered_types()], list]


def _preferred_lib(*args, **kwargs):
def _preferred_lib(*args):
"""Given a list of args and kwargs with potentially mixed array types, determine the appropriate
library to dispatch to.
Expand All @@ -93,13 +93,12 @@ def _preferred_lib(*args, **kwargs):
Raises:
QiskitError: if none of the rules apply.
"""
args = list(args) + list(kwargs.values())
args = list(args)
if len(args) == 1:
return DYNAMICS_NUMPY_ALIAS.infer_libs(args[0])

lib0 = DYNAMICS_NUMPY_ALIAS.infer_libs(args[0])[0]
lib1 = _preferred_lib(args[1:])[0]

lib1 = _preferred_lib(*args[1:])[0]
if lib0 == "numpy" and lib1 == "numpy":
return "numpy"
elif lib0 == "jax" or lib1 == "jax":
Expand All @@ -121,5 +120,5 @@ def _numpy_multi_dispatch(*args, path, **kwargs):
Returns:
Result of evaluating the function at path on the arguments using the preferred library.
"""
lib = _preferred_lib(*args, **kwargs)
lib = _preferred_lib(*args)
return DYNAMICS_NUMPY_ALIAS(like=lib, path=path)(*args, **kwargs)

0 comments on commit 77ca584

Please sign in to comment.