Skip to content

Commit

Permalink
Fix circular import.
Browse files Browse the repository at this point in the history
  • Loading branch information
sserita committed Apr 4, 2024
1 parent 3c2ae0b commit 71cb717
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pygsti/tools/optools.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import scipy.sparse.linalg as _spsl
import functools as _functools

from pygsti.modelmembers.operations.linearop import LinearOperator as _LinearOperator
from pygsti.tools import basistools as _bt
from pygsti.tools import jamiolkowski as _jam
from pygsti.tools import lindbladtools as _lt
Expand Down Expand Up @@ -433,6 +432,8 @@ def entanglement_fidelity(a, b, mx_basis='pp', is_tp=None, is_unitary=None):
-------
float
"""
from pygsti.modelmembers.operations.linearop import LinearOperator as _LinearOperator

# Attempt to cast to dense array. If this is already an array, the AttributeError
# will be suppressed.
if isinstance(a, _LinearOperator):
Expand Down Expand Up @@ -514,6 +515,8 @@ def average_gate_fidelity(a, b, mx_basis='pp', is_tp=None, is_unitary=None):
AGI : float
The AGI of a to b.
"""
from pygsti.modelmembers.operations.linearop import LinearOperator as _LinearOperator

# Cast to dense to ensure we can extract the shape.
if isinstance(a, _LinearOperator):
a = a.to_dense()
Expand Down Expand Up @@ -724,6 +727,8 @@ def unitarity(a, mx_basis="gm"):
-------
float
"""
from pygsti.modelmembers.operations.linearop import LinearOperator as _LinearOperator

# Cast to dense to ensure we can extract the shape.
if isinstance(a, _LinearOperator):
a = a.to_dense()
Expand Down

0 comments on commit 71cb717

Please sign in to comment.