def test_circular_SQRTISWAP(self): """ Circular Spin Chain Setup: compare unitary matrix for SQRTISWAP and propogator matrix of the implemented physical model. """ N = 3 qc = QubitCircuit(N) qc.add_gate("SQRTISWAP", targets=[0, 1]) U_ideal = gate_sequence_product(qc.propagators()) p = CircularSpinChain(N, correct_global_phase=True) U_list = p.run(qc) U_physical = gate_sequence_product(U_list) assert_((U_ideal - U_physical).norm() < 1e-12)
def test_circular_combination(self): """ Linear Spin Chain Setup: compare unitary matrix for ISWAP, SQRTISWAP, RX and RY gates and the propogator matrix of the implemented physical model. """ N = 3 qc = QubitCircuit(N) qc.add_gate("ISWAP", targets=[0, 1]) qc.add_gate("SQRTISWAP", targets=[0, 1]) qc.add_gate("RZ", arg_value=np.pi/2, arg_label=r"\pi/2", targets=[1]) qc.add_gate("RX", arg_value=np.pi/2, arg_label=r"\pi/2", targets=[0]) U_ideal = gate_sequence_product(qc.propagators()) p = CircularSpinChain(N, correct_global_phase=True) U_list = p.run(qc) U_physical = gate_sequence_product(U_list) assert_((U_ideal - U_physical).norm() < 1e-12)
def test_circular_combination(self): """ Linear Spin Chain Setup: compare unitary matrix for ISWAP, SQRTISWAP, RX and RY gates and the propogator matrix of the implemented physical model. """ N = 3 qc = QubitCircuit(N) qc.add_gate("ISWAP", targets=[0, 1]) qc.add_gate("SQRTISWAP", targets=[0, 1]) qc.add_gate("RZ", arg_value=np.pi / 2, arg_label=r"\pi/2", targets=[1]) qc.add_gate("RX", arg_value=np.pi / 2, arg_label=r"\pi/2", targets=[0]) U_ideal = gate_sequence_product(qc.propagators()) p = CircularSpinChain(N, correct_global_phase=True) U_list = p.run(qc) U_physical = gate_sequence_product(U_list) assert_((U_ideal - U_physical).norm() < 1e-12)