Download IonQ.qs from Snapkitty/black-hole-engine: direct link, hf CLI and curl.
- Browser
- Download file 1.89 kB
-
https://huggingface.co/Snapkitty/black-hole-engine/resolve/main/IonQ.qs
- Command line
-
hf download hf://Snapkitty/black-hole-engine/IonQ.qs
-
curl -L -o IonQ.qs https://huggingface.co/Snapkitty/black-hole-engine/resolve/main/IonQ.qs
1.89 kB
| // | |
| // Copyright (c) 2026 BEL ESPRIT D ACCORD TRUST HOLDINGS INC | |
| // All rights reserved. | |
| // BlackHoleEngine/IonQ.qs | |
| // Hardware-specific: IonQ Aria (all-to-all, native MS gate) | |
| namespace BlackHoleEngine.IonQ { | |
| open Microsoft.Quantum.Intrinsic; | |
| open Microsoft.Quantum.Canon; | |
| open BlackHoleEngine.Primitives; | |
| operation IonQXX(q1 : Qubit, q2 : Qubit, theta : Double) : Unit is Adj + Ctl { | |
| Exp([PauliX, PauliX], theta, [q1, q2]); | |
| } | |
| operation IonQHaydenPreskill( | |
| qubits : Qubit[], | |
| scrambleTime : Double, | |
| couplings : Double[][], | |
| fields : Double[] | |
| ) : Unit is Adj + Ctl { | |
| let n = Length(qubits); | |
| let dt = scrambleTime / 5.0; | |
| let steps = 5; | |
| for _ in 1..steps { | |
| for i in 0..n-1 { | |
| Rz(2.0 * fields[i] * dt, qubits[i]); | |
| } | |
| for layer in GetXXLayers(n, couplings) { | |
| for (i, j) in layer { | |
| let J = couplings[i][j]; | |
| if (AbsD(J) > 1e-10) { | |
| IonQXX(qubits[i], qubits[j], 2.0 * J * dt); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| operation IonQLindbladStep( | |
| ancilla : Qubit, | |
| qubits : Qubit[], | |
| viol : ViolatingAssignment, | |
| gamma_dt : Double | |
| ) : Unit { | |
| let sqrt_gamma = Sqrt(gamma_dt); | |
| let theta = 2.0 * Arcsin(sqrt_gamma); | |
| Ry(theta, ancilla); | |
| let (va, vb, vc) = viol; | |
| if (va) { X(qubits[0]); } | |
| if (vb) { X(qubits[1]); } | |
| if (vc) { X(qubits[2]); } | |
| Controlled Z([ancilla, qubits[0], qubits[1]], qubits[2]); | |
| if (va) { X(qubits[0]); } | |
| if (vb) { X(qubits[1]); } | |
| if (vc) { X(qubits[2]); } | |
| let outcome = M(ancilla); | |
| Reset(ancilla); | |
| } | |
| } | |