Skip to main content
11 votes
Accepted

What are the differences between Qiskit's AerSimulator, QasmSimulator and StatevectorSimulator?

Deprecation Note: The StatevectorSimulator has been superseded by the AerSimulator and will be deprecated in the future. It has ...
Egretta.Thula's user avatar
9 votes
Accepted

How to run a qasm file on IBMQ device?

This is a example for loading QASM, executing and displaying the result. ...
gyu-don's user avatar
  • 324
7 votes

How to run a qasm file on IBMQ device?

The easiest way is to use the QuantumCircuit methods QuantumCircuit.from_qasm_file() or ...
Paul Nation's user avatar
  • 2,239
6 votes
Accepted

How to run a OpenQASM 3.0 file?

OpenQASM3 is in an early release stage for circulation for feedback in the quantum community. OpenQASM3 aims to be a standardized language proposal for near-term quantum computing hardware with real-...
ThomasAlexander's user avatar
6 votes
Accepted

How to get QASM code from an Amazon Braket circuit in Python?

You can get OpenQASM output from Braket circuits by using the following code: ...
Milan-aws's user avatar
5 votes

What is the source of this TranspilerError when running qasm file?

The issue is that you are transpiling for a backend with 5 qubits, but this circuit is defined over a 16 qubit register (line 3 qreg q[16];). To avoid this error ...
met927's user avatar
  • 3,251
5 votes
Accepted

How to see the QASM code corresponding to compiled Q# function?

Q# is not compiled into QASM, so that would be tricky. Q# compilation and execution process is approximately as follows: Q# code is parsed into an internal data structure representing an abstract ...
Mariia Mykhailova's user avatar
4 votes

How is $X^q$ equal to $RX(\pi q)$?

This is the matrix for $Z^t$: $$Z^t = \begin{bmatrix} 1&0\\0&(-1)^t \end{bmatrix} = \begin{bmatrix} 1&0\\0&e^{i \pi t} \end{bmatrix}$$ This is the matrix for $R_Z(\pi t)$: $$R_Z(\pi ...
Craig Gidney's user avatar
  • 37.1k
4 votes

Problem with comments and code rearranging in IBM Q web interface

You'e just experienced code transpilation. Transpilation is when source-to-source compilation takes place, as you have mentioned here. You can prevent the rearranging of the gates by using the "...
varun palakodeti's user avatar
4 votes

Where is definitive documentation for OpenQASM 2.0 and 3.0

OpenQASM 2 is defined by https://arxiv.org/abs/1707.03429 It may focus is to describe a gate-based quantum circuit. There are several examples here on what it can be done with it. There are several ...
luciano's user avatar
  • 5,763
4 votes

What are the differences in using qasm, statevector, and unitary simulators in qiskit?

They all produce different types of result. Let's go one by one: from qiskit import QuantumCircuit, Aer from qiskit.visualization import array_to_latex Unitary ...
luciano's user avatar
  • 5,763
4 votes

How to get QASM code from an Amazon Braket circuit in Python?

Amazon Braket does not have native support for converting circuits to OpenQASM 2. So besides implementing your own Python script, there's not currently a way to do this that does not involve going ...
ryanhill1's user avatar
  • 2,503
3 votes

Why running time of qasm simulator is significantly smaller in comparison with quantum machines?

A simulator executes just an algorithm on a classical hardware as Martin said. On a real quantum hardware, your circuit is calibrated before actually being executed. In addition, there are other tasks ...
NABAT's user avatar
  • 121
3 votes

Implementing U2-Gates on Cirq

From the spec, $U_2(\phi, \lambda) = U ( \frac{\pi}{2}, \phi, \lambda)$. We can use Cirq's QasmUGate. ...
Victory Omole's user avatar
3 votes

How can I use IF gate in IBM Q composer?

IF gate can be used for controlling gates based on value in classical register, i.e. measured values of qubits. Lets see at this circuit: In this case qubit $q_0$ is in state $|1\rangle$ and qubit $...
Martin Vesely's user avatar
3 votes
Accepted

How to make "random U3" in QASM?

There are many forms of QASM, so I'll answer for OpenQASM 2.0, as is currently used by IBM. Declaring a gate to be random means that it would be randomly generated at compile time. Since QASM is used ...
James Wootton's user avatar
3 votes

Construct Controlled-$G^{\dagger}$ from known Controlled-$G$

If I understand the question correctly, you're assuming that you have some gate $V$ that you've decomposed as $\prod_{i=1}^NU_i$ and you want to show that $V^\dagger$ is $\prod_{i=1}^NU_{N+1-i}^\...
DaftWullie's user avatar
  • 58.2k
3 votes

Construct Controlled-$G^{\dagger}$ from known Controlled-$G$

How is correct that new scheme of Controlled-$G^\dagger$ gate may be constructed from this known scheme of Controlled-G gate by reversing the order of used gates ($U$) and each $U$ in this scheme ...
Adrien Suau's user avatar
  • 4,947
3 votes

Is it possible to see the probabilities values of qubit ( alpha and beta) while measuring on IBM Quantum experience?

To extract the statevector with qiskit, you can do the following: ...
KAJ226's user avatar
  • 13.8k
3 votes
Accepted

Simulating OpenQASM 2.0 in Qiskit?

You can use qasm files to create a quantum circuit, two ways : via the methods from_qasm_str or from_qasm_file on a ...
Lena's user avatar
  • 2,597
3 votes

QASM Files on Jupyter Notebook

You can use QuantumCircuit.from_qasm_str() like this: ...
Egretta.Thula's user avatar
3 votes

Does Qiskit allow for QASM 3.0 code to be utilized?

OpenQASM 3 is under active developement (as in July 2022), with several working groups that are adding new features regularly. I am not aware of a timeframe, but you can ask in the ...
luciano's user avatar
  • 5,763
3 votes
Accepted

OpenQASM circuits in Stim

This isn't directly supported by qiskit or by stim, but you can try using cirq as an intermediary. I don't know how consistently this works, but it works on simple cases. ...
Craig Gidney's user avatar
  • 37.1k
3 votes
Accepted

Is there any method to parse a qasm in qiskit

Qiskit comes with a QasmParser; an OpenQasm 2.0 parser. It can be used directly as follows: ...
Egretta.Thula's user avatar
2 votes
Accepted

How is $X^q$ equal to $RX(\pi q)$?

Note that $$RX(\phi) = \begin{pmatrix} \cos(\phi/2) & -i\sin(\phi/2) \\-isin(\phi/2) & \cos(\phi/2)\end{pmatrix}$$ Then $$RX(\pi q) = \begin{pmatrix} \cos(\pi q/2) & -i\sin(\pi q/2) \\-...
nippon's user avatar
  • 1,517
2 votes

Print circuit compiled on hardware?

You need to extract the compiled qasm from a qobj object. You can create this by compiling from qiskit import compile qobj = compile(qc,backend,shots=shots) If ...
James Wootton's user avatar
2 votes
Accepted

OPENQASM: How to include my own libraries

According to the openqasm spec the include statement will insert the contents of the files with the name relative to the current working directory: https://github.com/Qiskit/openqasm/blob/master/spec/...
Matthew Treinish's user avatar
2 votes
Accepted

How can I install the 'ibmq_qasm_simulator' backend?

The ibmq_qasm_simulator is a cloud-based simulator. You need to say ...
Paul Nation's user avatar
  • 2,239
2 votes
Accepted

How to stop optimization of a circuit during transpiling in web-interface of IBM Q?

In the web based composer there is currently no way to adjust the optimization level. As a workaround, you can put a barrier before and after each gate. This will prevent them from being joined.
Paul Nation's user avatar
  • 2,239
2 votes

Subroutines on IBM Q (ERROR_RUNNING_JOB returned)

I don't know if this will help. I have tried the code and it worked: I created a new file named ccu1_circuit.qasm with the instruction written in the question. ...
Davit Khachatryan's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible