def _circuit_rr(theta, phi, lam, phase, simplify=True, atol=DEFAULT_ATOL): qr = QuantumRegister(1, 'qr') circuit = QuantumCircuit(qr, global_phase=phase) if not simplify or not math.isclose(theta, -np.pi, abs_tol=atol): circuit._append(RGate(theta + np.pi, np.pi / 2 - lam), [qr[0]], []) circuit._append(RGate(-np.pi, 0.5 * (phi - lam + np.pi)), [qr[0]], []) return circuit
def _circuit_rr(theta, phi, lam, simplify=True, atol=DEFAULT_ATOL): circuit = QuantumCircuit(1) if not simplify or not np.isclose(theta, -np.pi, atol=atol): circuit.append(RGate(theta + np.pi, np.pi / 2 - lam), [0]) circuit.append(RGate(-np.pi, 0.5 * (phi - lam + np.pi)), [0]) return circuit
def _circuit_rr(theta, phi, lam, phase, simplify=True, atol=DEFAULT_ATOL): qr = QuantumRegister(1, "qr") circuit = QuantumCircuit(qr, global_phase=phase) if not simplify: atol = -1.0 if abs(theta) < atol and abs(phi) < atol and abs(lam) < atol: return circuit if abs(theta - np.pi) > atol: circuit._append(RGate(theta - np.pi, _mod_2pi(np.pi / 2 - lam, atol)), [qr[0]], []) circuit._append(RGate(np.pi, _mod_2pi(0.5 * (phi - lam + np.pi), atol)), [qr[0]], []) return circuit