Skip to content

Commit

Permalink
patched SimplifyPaulis error msg
Browse files Browse the repository at this point in the history
which previously correctly displayed the error message, but returned Null instead of $Failed
  • Loading branch information
TysonRayJones committed Apr 4, 2024
1 parent 7d2afa1 commit 27e70b6
Show file tree
Hide file tree
Showing 3 changed files with 229 additions and 188 deletions.
6 changes: 3 additions & 3 deletions Link/QuESTlink.m
Original file line number Diff line number Diff line change
Expand Up @@ -2213,16 +2213,16 @@ The probability of the forced measurement outcome (as if it were hypothetically
uneval,
(* otherwise this is an unrecognised Pauli sub-expression *)
True,
(* raise Message (without $Failed because Message causes immediate abort) *)
Message[SimplifyPaulis::error,
"Input contained the following sub-expression of Pauli operators which could not be simplified: " <>
ToString @ StandardForm @ uneval];
$Failed]]
ToString @ StandardForm @ uneval]]]

SimplifyPaulis[expr_] :=
Enclose[
(* immediately abort upon unrecognised sub-expression *)
ConfirmQuiet @ innerSimplifyPaulis @ expr,
ReleaseHold @ # @ "HeldMessageCall" & ]
(ReleaseHold @ # @ "HeldMessageCall"; $Failed) & ]

SimplifyPaulis[__] := invalidArgError[SimplifyPaulis]

Expand Down
Loading

0 comments on commit 27e70b6

Please sign in to comment.