I can successfully implement the U gate (single qubit) on qiskit, but when I am trying for the identity operation it is not showing any differences with the ideal one .
If you use from qiskit.providers.aer.noise import NoiseModel to add noise in your U gate operation. Then it won't behave like an ideal gate, https://qiskit.org/documentation/tutorials/simulators/4_custom_gate_noise.html here you can get more information.
It depend what you mean by "noisy"! Here are 2 methods to implement a noisy indentity gate that will likely not experience the same type of noise.
You can implement the identity operation by... doing nothing. When doing nothing, qubits will experience decoherence, and so you end up applying a "noisy identity gate".
from qiskit import QuantumCircuit idle_identity = QuantumCircuit(1) # Take a delay that is a multiple of 16 dt, it will prevent some issues. idle_identity.delay(300 * 16, 0) print(idle_identity.draw()) # ┌─────────────────┐ # q_0: ┤ Delay(4800[dt]) ├ # └─────────────────┘
Using cancelling sequences of gates
If you want another type of noise, you might want to use sequences of gates that simplify to the identity. In this case you will have to either add barriers between each gate or use
optimization_level=0 to prevent the transpiler simplifying the sequence.
from qiskit import QuantumCircuit cancelling_gates_identity = QuantumCircuit(1) cancelling_gates_identity.x(0) cancelling_gates_identity.barrier() cancelling_gates_identity.x(0) print(cancelling_gates_identity.draw()) # ┌───┐ ░ ┌───┐ # q_0: ┤ X ├─░─┤ X ├ # └───┘ ░ └───┘
If you want more noise, just increase the number of gates.