2
$\begingroup$

I am wondering if Qiskit QasmSimulator adds noise by default or not. I am asking because I have 2 circuits:

  • circuit 1: computes cosine similarity between two vectors
  • circuit 2: computes cosine similarity between one vector and N other vectors (so the output is N cosine similarities).

So circuit 2 does have a larger number of gates than circuit 1. And theoretically, they should return the same cosine similarity values when we run both with high number of shots. However, circuit 1 is more accurate and I do not know why (I am sure that the circuits are implemented correctly and theoretically correct).

I am suspecting that this is because circuit 2 has larger number of gates than circuit 1 which will make its results contains noise, butI am running them on Qasm Simulator, without adding any noise models, which means that there is no noise to affect the larger circuit.

Any ideas why this is happening? does qiskit qasm simulator add noise by default for larger number of gates in the circuit?

$\endgroup$
6
  • 4
    $\begingroup$ Unless you add a noise model to it, then no, it doesn't have any noise. You might have used slightly off parameters that caused the circuit to give wrong result. You can use statevector simulator to check the exact simulation and check first. $\endgroup$
    – KAJ226
    Commented Jun 26, 2022 at 21:19
  • 1
    $\begingroup$ Can you show the code you're running? To my knowledge QASM simulator doesn't add noise by default, so maybe there is a problem in the code $\endgroup$ Commented Jun 27, 2022 at 9:26
  • 1
    $\begingroup$ It does not add noise but adds the usual randomness of quantum mechanics. $\endgroup$
    – Mauricio
    Commented Jun 28, 2022 at 12:47
  • 1
    $\begingroup$ @KAJ226 what is the difference between statevector simulator and qasm simulator? shouldn't they produce the same results? $\endgroup$ Commented Jun 28, 2022 at 19:50
  • 2
    $\begingroup$ statevector simulator is exactly what the name suggested... it returns the exact statevector of the circuit. Whereas qasm_simulator will return the distribution. For example, suppose you start with the state $|0\rangle$ and apply a Hadamard gate. Now, you are at the state $|\psi \rangle = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$. The statevector will return the state $\dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1\end{pmatrix}$. Whereas if you run the qasm simulator with 1 shot, you might get $|0\rangle$ or a $|1\rangle$. If you run 1000 shots, you might get back 550 results of 0s and 450 of 1's $\endgroup$
    – KAJ226
    Commented Jun 28, 2022 at 20:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.