File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -471,6 +471,7 @@ Gates (q = qubit index; angles / probabilities are floats)
471471 u3 <q> <theta> <phi> <lam>
472472 rxx ryy rzz <a> <b> <angle>
473473 depolarize loss <q> <p> depolarize2 <a> <b> <p>
474+ leakage <q> <p0> <p1>
474475 pauli_error <q> <px> <py> <pz> correlated_loss <a> <b> <p0> <p1> <p2>
475476
476477Line editing: ←/→ move · Home/End · Backspace/Del · ↑/↓ history" ;
Original file line number Diff line number Diff line change @@ -50,6 +50,9 @@ pub fn gate_spec(name: &str) -> Option<GateSpec> {
5050 "loss" => ( Loss , 1 , 1 ) ,
5151 "pauli_error" => ( PauliError , 1 , 3 ) ,
5252 "correlated_loss" => ( CorrelatedLoss , 2 , 3 ) ,
53+ // Same shape as `r`: one qubit, two floats. Push order is q, p0, p1
54+ // (probabilities of leaking into pinned |0⟩ / |1⟩).
55+ "leakage" => ( Leakage , 1 , 2 ) ,
5356 _ => return None ,
5457 } ;
5558 Some ( GateSpec {
@@ -208,6 +211,20 @@ mod tests {
208211 ) ;
209212 }
210213
214+ #[ test]
215+ fn leakage_parses_qubit_and_two_probs ( ) {
216+ assert_eq ! (
217+ parse_command( "leakage 0 0.0 1.0" ) . unwrap( ) ,
218+ Command :: Gate {
219+ inst: CircuitInstruction :: Leakage ,
220+ qubits: vec![ 0 ] ,
221+ params: vec![ 0.0 , 1.0 ] ,
222+ }
223+ ) ;
224+ assert ! ( parse_command( "leakage 0 1.0" ) . is_err( ) ) ;
225+ assert ! ( parse_command( "leakage 0" ) . is_err( ) ) ;
226+ }
227+
211228 #[ test]
212229 fn meta_commands ( ) {
213230 assert_eq ! ( parse_command( ":q" ) . unwrap( ) , Command :: Quit ) ;
You can’t perform that action at this time.
0 commit comments