Skip to content

Commit

Permalink
fullsimplify rotation operators
Browse files Browse the repository at this point in the history
  • Loading branch information
sw1sh committed Feb 15, 2024
1 parent 7ff9ab3 commit 1b68f76
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions QuantumFramework/Kernel/QuantumOperator/NamedOperators.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,23 +124,23 @@
QuantumOperator[name : "XRotation" | "YRotation" | "ZRotation" | "RX" | "RY" | "RZ", opts___] := QuantumOperator[{name, Pi / 2}, opts]

QuantumOperator[{"XRotation" | "RX", angle_, dimension : _Integer ? Positive : 2}, opts___] := QuantumOperator[
Simplify @ QuantumOperator[
FullSimplify @ QuantumOperator[
Exp[- I angle / 2 QuantumOperator[{"PauliX", dimension}]],
"Label" -> Subscript["R", "X"][angle]
],
opts
]

QuantumOperator[{"YRotation" | "RY", angle_, dimension : _Integer ? Positive : 2}, opts___] := QuantumOperator[
Simplify @ QuantumOperator[
FullSimplify @ QuantumOperator[
Exp[- I angle / 2 QuantumOperator[{"PauliY", dimension}]],
"Label" -> Subscript["R", "Y"][angle]
],
opts
]

QuantumOperator[{"ZRotation" | "RZ", angle_, dimension : _Integer ? Positive : 2}, opts___] := QuantumOperator[
Simplify @ QuantumOperator[
FullSimplify @ QuantumOperator[
Exp[- I angle / 2 QuantumOperator[{"PauliZ", dimension}]],
"Label" -> Subscript["R", "Z"][angle]
],
Expand All @@ -150,7 +150,7 @@
QuantumOperator[{"R", angle_, args__}, opts___] := Enclose @ Block[{ops = ConfirmBy[QuantumOperator[#], QuantumOperatorQ] & /@ {args}, op, orders},
op = QuantumCircuitOperator[ops]["QuantumOperator", Method -> "Schrodinger"]["Sort"];
orders = #["FullInputOrder"] & /@ ops;
Simplify @ QuantumOperator[
FullSimplify @ QuantumOperator[
Exp[- I angle / 2 op],
opts,
"Label" -> Subscript["R", op["Label"]][angle]
Expand Down

0 comments on commit 1b68f76

Please sign in to comment.