diff --git a/packages/pygsti/construction/circuitconstruction.py b/packages/pygsti/construction/circuitconstruction.py index 8eb7590f1..f2798bdc6 100644 --- a/packages/pygsti/construction/circuitconstruction.py +++ b/packages/pygsti/construction/circuitconstruction.py @@ -472,7 +472,7 @@ def tolabel(x): return x if isinstance(x, _Lbl) else _Lbl(x) line_labels = prepStrs[0].line_labels if len(prepStrs) > 0 else 'auto' if line_labels is None or len(line_labels) == 0: line_labels = ('*',) - singleOps = [_cir.Circuit((gl,), line_labels=line_labels)**1 for gl in opLabels] # **1 adds parens to stringrep + singleOps = [_cir.Circuit((gl,), line_labels=line_labels)**1 for gl in opLabels] # **1 adds parens to stringrep ret = create_circuit_list('eStr', 'prepStr', 'prepStr+eStr', 'prepStr+g+eStr', eStr=effectStrs, prepStr=prepStrs, g=singleOps, order=['g', 'prepStr', 'eStr']) # LEXICOGRAPHICAL VS MATRIX ORDER diff --git a/packages/pygsti/tools/optools.py b/packages/pygsti/tools/optools.py index 9d7103831..e1188da8b 100644 --- a/packages/pygsti/tools/optools.py +++ b/packages/pygsti/tools/optools.py @@ -94,11 +94,12 @@ def fidelity(A, B): #if _np.array_equal(A, B): return 1.0 # HACK - some cases when A and B are perfecty equal sqrtm(A) fails... sqrtA = _hack_sqrtm(A) # _spl.sqrtm(A) - #assert(_np.linalg.norm(_np.dot(sqrtA, sqrtA) - A) < 1e-8) # test the scipy sqrtm function - sometimes fails when rank defficient + # test the scipy sqrtm function - sometimes fails when rank defficient + #assert(_np.linalg.norm(_np.dot(sqrtA, sqrtA) - A) < 1e-8) if _np.linalg.norm(_np.dot(sqrtA, sqrtA) - A) > 1e-8: evals = _np.linalg.eigvals(A) - _warning.warn(("sqrtm(A) failure when computing fidelity - beware result. " - "Maybe due to rank defficiency - eigenvalues of A are: %s") % evals) + _warnings.warn(("sqrtm(A) failure when computing fidelity - beware result. " + "Maybe due to rank defficiency - eigenvalues of A are: %s") % evals) F = (_mt.trace(_hack_sqrtm(_np.dot(sqrtA, _np.dot(B, sqrtA)))).real)**2 # Tr( sqrt{ sqrt(A) * B * sqrt(A) } )^2 return float(F)