-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request
Description
Running the following snippet of code (to explore the interplay between doing local gates, vs. global gates and inverting a subset). However, even with to_native_gateset=False the transformer still cuts out the identity qubits. And, I have to write the identity as a PhXZ gate otherwise there is an error.
sqrt_Y = cirq.PhasedXZGate(axis_phase_exponent=0.5,x_exponent=0.5,z_exponent=0)
sqrt_Y_dag = cirq.PhasedXZGate(axis_phase_exponent=0.5,x_exponent=-0.5,z_exponent=0)
identity = cirq.PhasedXZGate(axis_phase_exponent=0.0,x_exponent=0.0,z_exponent=0)
qubits = cirq.LineQubit.range(8)
fidelity_local = []
fidelity_global = []
for k in range(1,8):
circuit_global = cirq.Circuit.from_moments(
cirq.Moment([identity.on(q) for q in qubits]),
cirq.Moment([sqrt_Y.on(q) for q in qubits]),
cirq.Moment([sqrt_Y_dag.on(q) for q in qubits[k::]]))
circuit_local = cirq.Circuit.from_moments(
cirq.Moment([identity.on(q) for q in qubits]),
cirq.Moment([sqrt_Y.on(q) for q in qubits[0:k]]))
noisy_circuit_local = transform_circuit(circuit_local, model=model,to_native_gateset=False)
noisy_circuit_global = transform_circuit(circuit_global, model=model,to_native_gateset=False)
# Simulate noisy circuits
clean = simulator_dm.simulate(circuit_local).final_density_matrix
noisy = simulator_dm.simulate(noisy_circuit_local).final_density_matrix
fidelity_local.append(np.trace(clean @ noisy).real)
clean = simulator_dm.simulate(circuit_global).final_density_matrix
noisy = simulator_dm.simulate(noisy_circuit_global).final_density_matrix
fidelity_global.append(np.trace(clean @ noisy).real)
plt.plot(fidelity_local,label='Local')
plt.plot(fidelity_global,label='Global')
plt.legend()
plt.show()Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request