Skip to content

Commit

Permalink
patched SimplifyPaulis
Browse files Browse the repository at this point in the history
Same-target Pauli multiplication XZ and ZX had an erroneous -1 coefficient, since the elements of the Levi-Civita tensor were not correctly computed
  • Loading branch information
TysonRayJones committed Mar 29, 2024
1 parent 489af1b commit 93b180d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Link/QuESTlink.m
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ CheckCircuitSchedule returns False if the (possibly symbolic) times cannot possi
\[Bullet] \"HighlightPathTo\" -> pauliString (or a list of Pauli strings) highlights all edges ultimately contributing to the coefficient of the specified final pauliString(s). Symbolically weighted sums of Pauli strings are also accepted, in which case all edges to all non-orthogonal Pauli strings are highlighted.
\[Bullet] \"CombineStrings\" -> False disables combining incident Pauli strings so that the result is an (likely significantly larger) acyclic tree.
\[Bullet] \"PauliStringForm\" sets the vertex label format to one of \"String\", \"Hidden\" (these are the defaults depending on graph size), \"Index\", \"Kronecker\", or \"Subscript\". See ?GetPauliStringReformatted.
\[Bullet] \"ShowCoefficients\" -> True or False explicit shows or hides the PTMap coefficient associated with each edge. The default is Automatic which auto-hides edge labels if there are too many.
\[Bullet] \"ShowCoefficients\" -> True or False explicitly shows or hides the PTMap coefficient associated with each edge. The default is Automatic which auto-hides edge labels if there are too many.
\[Bullet] \"EdgeDegreeStyles\" specifies the style of edges from nodes of increasing outdegree. See ?DrawPauliTransferMap.
\[Bullet] \"CacheMaps\" controls the automatic caching of generated PTMaps. See ?ApplyPauliTransferMap.
\[Bullet] AssertValidChannels -> False disables the simplification of symbolic Pauli string coefficients, only noticeable when \"ShowCoefficients\"->True. See ?AssertValidChannels.
Expand Down Expand Up @@ -2126,9 +2126,13 @@ The probability of the forced measurement outcome (as if it were hypothetically
(* move scalars to their own element (to clean pauli pattern) *)
ncm[r1___, (f:Except[Subscript[xyzi, _]]) (a:Subscript[xyzi, _]) , r2___] :> ncm[f,r1,a,r2],
(* map same-qubit adjacent (closest) pauli matrices to their product *)
ncm[r1___, Subscript[(a:xyz), q_],r2:Shortest[___],Subscript[(b:xyz), q_], r3___] :>
If[a === b, ncm[r1,r2,r3,Subscript[Id,q]], With[{c = First @ Complement[List@@xyz, {a,b}]},
ncm[r1, I If[Sort[{a,b}]==={a,b},1,-1] Subscript[c, q], r2, r3]]],
ncm[r1___, Subscript[(a:xyz), q_], r2:Shortest[___],Subscript[(b:xyz), q_], r3___] :>
If[a === b,
(* XX = YY = ZZ = Id *)
ncm[r1,r2,r3,Subscript[Id,q]],
(* AB = (+-) i C *)
With[{c = First @ Complement[List@@xyz, {a,b}]},
ncm[r1, I Signature@{a,b,c} Subscript[c, q], r2, r3]]],
(* remove superfluous Id's when multiplying onto other paulis on any qubits *)
ncm[r1___, Subscript[Id, _], r2___, b:Subscript[xyzi, _], r3___] :>
ncm[r1, r2, b, r3],
Expand Down

0 comments on commit 93b180d

Please sign in to comment.