// // Copyright (c) 2026 BEL ESPRIT D ACCORD TRUST HOLDINGS INC // All rights reserved. // BlackHoleEngine/IBM.qs // Hardware-specific: IBM Heron (heavy-hex, CX-based) namespace BlackHoleEngine.IBM { open Microsoft.Quantum.Intrinsic; open Microsoft.Quantum.Canon; open BlackHoleEngine.Primitives; operation IBMXX( qubits : Qubit[], i : Int, j : Int, theta : Double, couplingMap : (Int, Int)[] ) : Unit is Adj + Ctl { let path = ShortestPath(couplingMap, i, j); for idx in 0..Length(path)-2 { SWAP(qubits[path[idx]], qubits[path[idx+1]]); } let adj_i = path[Length(path)-2]; let adj_j = path[Length(path)-1]; CNOT(qubits[adj_i], qubits[adj_j]); Rz(2.0 * theta, qubits[adj_j]); CNOT(qubits[adj_i], qubits[adj_j]); for idx in Length(path)-2..-1..0 { SWAP(qubits[path[idx]], qubits[path[idx+1]]); } } operation IBMHaydenPreskill( qubits : Qubit[], scrambleTime : Double, couplings : Double[][], fields : Double[], couplingMap : (Int, Int)[] ) : Unit is Adj + Ctl { let n = Length(qubits); let dt = scrambleTime / 10.0; let steps = 10; 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) { IBMXX(qubits, i, j, 2.0 * J * dt, couplingMap); } } } } } function ShortestPath(couplingMap : (Int, Int)[], src : Int, dst : Int) : Int[] { // BFS on coupling graph (placeholder - use Qiskit routing in production) return [src, dst]; } }