Repository: rigetti/qcs-sdk-rust (language: python)

Issue:
Update RZ ISA to match pyQuil
Implement the same changes as https://github.com/rigetti/pyquil/issues/1432 / https://github.com/rigetti/pyquil/pull/1433


Discussion / hints:

Fix patch:
diff --git a/qcs/src/qpu/quilc/isa/qubit.rs b/qcs/src/qpu/quilc/isa/qubit.rs
index 6a9cd2e4e..0b2511912 100644
--- a/qcs/src/qpu/quilc/isa/qubit.rs
+++ b/qcs/src/qpu/quilc/isa/qubit.rs
@@ -61,7 +61,7 @@ impl Qubit {
         let benchmarks = Benchmarks::try_from(benchmarks)?;
         let operators = match op_name {
             "RX" => rx_gates(self.id, benchmarks.frb_sim_1q)?,
-            "RZ" => rz_gates(self.id, benchmarks.frb_sim_1q)?,
+            "RZ" => rz_gates(self.id),
             "MEASURE" => measure(self.id, characteristics),
             "WILDCARD" => wildcard(self.id),
             "I" | "RESET" => vec![],
@@ -244,17 +244,14 @@ mod describe_rx_gates {
     }
 }
 
-fn rz_gates(node_id: i32, frb_sim_1q: &Operation) -> Result<Vec<Operator>> {
-    let fidelity = fidelity(frb_sim_1q, node_id)
-        .wrap_err_with(|| format!("While adding RZ gate to Qubit {}", node_id))?;
-
-    Ok(vec![Operator::Gate {
+fn rz_gates(node_id: i32) -> Vec<Operator> {
+    vec![Operator::Gate {
         operator: "RZ",
         parameters: Parameters::Underscore,
-        fidelity,
+        fidelity: PERFECT_FIDELITY,
         duration: PERFECT_DURATION,
         arguments: Arguments::Int(node_id),
-    }])
+    }]
 }
 
 #[cfg(test)]
@@ -294,11 +291,11 @@ mod describe_rz_gates {
                 node_ids: vec![0, 1],
             }],
         };
-        let gates = rz_gates(node_id, &frb_sim_1q).expect("Failed to create RZ gates");
+        let gates = rz_gates(node_id);
         let expected = vec![Operator::Gate {
             arguments: Arguments::Int(1),
             duration: 0.01,
-            fidelity: 0.9968326091766357,
+            fidelity: 1.0,
             operator: "RZ",
             parameters: Parameters::Underscore,
         }];


Test patch:
diff --git a/qcs/tests/compiler-isa-Aspen-8.json b/qcs/tests/compiler-isa-Aspen-8.json
index 217770d92..6f88437a8 100644
--- a/qcs/tests/compiler-isa-Aspen-8.json
+++ b/qcs/tests/compiler-isa-Aspen-8.json
@@ -67,7 +67,7 @@
             0
           ],
           "duration": 0.01,
-          "fidelity": 0.989821537688075,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -160,7 +160,7 @@
             1
           ],
           "duration": 0.01,
-          "fidelity": 0.996832638579018,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -258,7 +258,7 @@
             11
           ],
           "duration": 0.01,
-          "fidelity": 0.989117848440883,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -351,7 +351,7 @@
             12
           ],
           "duration": 0.01,
-          "fidelity": 0.982010065085791,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -444,7 +444,7 @@
             13
           ],
           "duration": 0.01,
-          "fidelity": 0.994323758479715,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -537,7 +537,7 @@
             14
           ],
           "duration": 0.01,
-          "fidelity": 0.991983796298027,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -630,7 +630,7 @@
             15
           ],
           "duration": 0.01,
-          "fidelity": 0.989822943596874,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -723,7 +723,7 @@
             16
           ],
           "duration": 0.01,
-          "fidelity": 0.988256589534012,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -816,7 +816,7 @@
             17
           ],
           "duration": 0.01,
-          "fidelity": 0.994091587106797,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -909,7 +909,7 @@
             2
           ],
           "duration": 0.01,
-          "fidelity": 0.927538230166735,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -1002,7 +1002,7 @@
             20
           ],
           "duration": 0.01,
-          "fidelity": 0.991288110944387,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -1095,7 +1095,7 @@
             21
           ],
           "duration": 0.01,
-          "fidelity": 0.992884053396768,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -1188,7 +1188,7 @@
             22
           ],
           "duration": 0.01,
-          "fidelity": 0.979355596748001,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -1281,7 +1281,7 @@
             23
           ],
           "duration": 0.01,
-          "fidelity": 0.992797468887461,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -1374,7 +1374,7 @@
             24
           ],
           "duration": 0.01,
-          "fidelity": 0.988868971757648,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -1467,7 +1467,7 @@
             25
           ],
           "duration": 0.01,
-          "fidelity": 0.998004517863263,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -1560,7 +1560,7 @@
             26
           ],
           "duration": 0.01,
-          "fidelity": 0.992046520987421,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -1653,7 +1653,7 @@
             27
           ],
           "duration": 0.01,
-          "fidelity": 0.998533591062586,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -1746,7 +1746,7 @@
             3
           ],
           "duration": 0.01,
-          "fidelity": 0.995159653742827,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -1839,7 +1839,7 @@
             30
           ],
           "duration": 0.01,
-          "fidelity": 0.983897042282644,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -1937,7 +1937,7 @@
             32
           ],
           "duration": 0.01,
-          "fidelity": 0.998120225824461,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -2030,7 +2030,7 @@
             33
           ],
           "duration": 0.01,
-          "fidelity": 0.997635034524841,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -2123,7 +2123,7 @@
             34
           ],
           "duration": 0.01,
-          "fidelity": 0.996864438593304,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -2216,7 +2216,7 @@
             35
           ],
           "duration": 0.01,
-          "fidelity": 0.997937749157514,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -2309,7 +2309,7 @@
             36
           ],
           "duration": 0.01,
-          "fidelity": 0.990523139563343,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -2402,7 +2402,7 @@
             37
           ],
           "duration": 0.01,
-          "fidelity": 0.999999385622736,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -2495,7 +2495,7 @@
             4
           ],
           "duration": 0.01,
-          "fidelity": 0.990387707932765,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -2588,7 +2588,7 @@
             5
           ],
           "duration": 0.01,
-          "fidelity": 0.996065286885264,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -2681,7 +2681,7 @@
             6
           ],
           "duration": 0.01,
-          "fidelity": 0.993098695450792,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [
@@ -2774,7 +2774,7 @@
             7
           ],
           "duration": 0.01,
-          "fidelity": 0.993901137706895,
+          "fidelity": 1.0,
           "operator": "RZ",
           "operator_type": "gate",
           "parameters": [