I have a circuit with different structures, now I'm trying to calculate the fidelity between those with the original one. How do I calculate the fidelity? I want also to initialize the state vector by myself. Can someone show how to compute fidelity for the below example?
For example if I have a circuit like below,
q = QuantumRegister(2)
qc = QuantumCircuit(q)
qc.cu1(3*pi/4, q[0], q[1]);
print(qc)
and different structure
q = QuantumRegister(2)
qc = QuantumCircuit(q)
qc.h(q[0]);
qc.h(q[1]);
qc.cu1(3*pi/4, q[0], q[1]);
qc.h(q[0]);
qc.h(q[1]);
print(qc)