Skip to content

Commit

Permalink
bugfixes in earlier changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyjmurray committed Sep 28, 2024
1 parent 82e8bc0 commit bde0e5d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pygsti/baseobjs/basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ def cast(cls, arg, dim=None, sparse=None, classical_name='cl'):
if isinstance(arg, str):
if isinstance(dim, _StateSpace):
return cls.cast_from_name_and_statespace(arg, dim, sparse, classical_name)
return cls.cast_from_name_and_dims(arg, dim, sparse, classical_name)
if isinstance(arg, None) or (hasattr(arg,'__len__') and len(arg) == 0):
return cls.cast_from_name_and_dims(arg, dim, sparse)
if (arg is None) or (hasattr(arg,'__len__') and len(arg) == 0):
return ExplicitBasis([], [], "*Empty*", "Empty (0-element) basis", False, sparse)
# ^ The original implementation would return this value under two conditions.
# Either arg was None, or isinstance(arg,(tuple,list,ndarray)) and len(arg) == 0.
Expand Down

0 comments on commit bde0e5d

Please sign in to comment.