Skip to main content

Questions tagged [qasm]

Quantum assembly language (QASM) called OpenQASM is used to implement experiments with low depth quantum circuits. OpenQASM represents universal physical circuits over the CNOT plus SU(2) basis with straight-line code that includes measurement, reset, fast feedback, and gate subroutines. The simple text language can be written by hand or by higher level tools and may be executed on the IBM Q Experience. (arXiv:1707.03429)

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

Allowed statements inside a `SubroutineDefintion` for openqasm

I am currently building a semantic analyser for the openqasm3 specificcation. While referring to the openqasm specification I could only find that QubitDeclarations ...
Harshit Gupta's user avatar
1 vote
1 answer
64 views

Parametric circuits and QASM3 in Qiskit v1.1.0

I am currently exploring Qiskit v1.1.0 and its handling of QASM3. The following snippet demonstrates the creation of a parametric circuit and the generation of its corresponding QASM3 code. ...
user3116936's user avatar
-1 votes
1 answer
28 views

I'm getting an error while printing qc.qasm()

I'm getting this error. Need help.
InnocentLlama's user avatar
0 votes
3 answers
239 views

How to implement multi controlled X gates in Qasm

I wanted to know the easiest way to implement a large multi controlled x gate using Qasm and not Qiskit, if it's possible
beginnerCoder7's user avatar
2 votes
0 answers
26 views

VQE on Qiskit: getting counts per Hamiltonian term

Consider a VQE calculation (using the QASM backend and on Qiskit) that involves a qubit Hamiltonian with, say, 5 terms. Is there a way for us to get the counts for each of the Hamiltonian terms that ...
srinivasa prasannaa's user avatar
1 vote
0 answers
35 views

How to represent the gates and the quibit states in the 'Hello Quantum' iOS game in IBM Quantum Learning graphical simulator

The Hello Quantum ios game developed by IBM has the X, Z, H and CZ gates manipulating a 2 qubit array (im not sure if array is the right word?). I want to know how I can represent the qubit states in ...
chickenj0's user avatar
6 votes
1 answer
169 views

Are there tools I can use to test OpenQASM 3 circuits?

I recently added a to_qasm method to stim. An issue I'm having is how to test that the outputs are correct. I can test OpenQASM 2 outputs by giving the output to ...
Craig Gidney's user avatar
  • 40.8k
1 vote
1 answer
93 views

Limited qubit number available in Aer Statevector simulator

I tried to run a calculation of 37 qubits with a Statevector simulator on Qiskit. The following is a demo code. ...
Marxmas's user avatar
  • 117
1 vote
1 answer
243 views

If Statement OpenQasm 2.0

in the documentation for OpenQasm 2.0 it says one can use an if statement like so: if(c_reg==int) Quantum Operation. However, I would like to execute the following: ...
Sam's user avatar
  • 31
1 vote
1 answer
90 views

New QASM2ParseError for old circuit on IBM composer

A while ago I wrote an example of quantum teleportation circuit in the IBM Composer which ran fine as of three days ago. Yesterday, however, when I try to run the circuit, I get the following error: ...
Lachlan Belcher's user avatar
2 votes
2 answers
397 views

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

As an example, consider the following Circuit defined by using the Python amazon-braket-sdk: ...
SimoneGasperini's user avatar
3 votes
2 answers
2k views

Convert from QASM code to Qiskit Code

I'm looking for something that performs a conversion such as qiskit.circuit.QuantumCircuit.qasm, but for qasm code. In other words, a means to convert qasm code to ...
Loqi's user avatar
  • 31
1 vote
2 answers
477 views

Is there any method to parse a qasm in qiskit

I'd want to parse the qasm file for analyze the quantum gate consisting its qasm file. However, Qiskit provides the attribute of the quantum circuit, ...
Sanghyeon Lee's user avatar
1 vote
2 answers
179 views

How to simplify sequence of gates in QASM file?

I would like to know if there is a functionality in qiskit to simplify a sequence of gates in a QASM file. For example, say we have a sequence of two expensive (in fault-tolerant context) gates $TT$. ...
MonteNero's user avatar
  • 3,181
1 vote
2 answers
422 views

Conversion error: from a QISKIT circuit to a QASM string and back

I created a circuit in qiskit and then converted it into a QASM string. When I try to make a circuit out of the QASM string I get the error: ...
MonteNero's user avatar
  • 3,181
3 votes
1 answer
301 views

OpenQASM circuits in Stim

I would like to run circuits saved as OpenQASM circuits in Stim. Does anyone know how to import these circuits from OpenQASM to Stim? Many thanks.
user206444's user avatar
4 votes
0 answers
35 views

How does it work QasmSimulator with the option "density matrix"?

I am making some simulations on IBM Quantum Lab and as backend I tried to use QasmSimulator(method = "density_matrix") in order to simulate noise. I wanted to know how this method works in ...
Natale Matranga's user avatar
3 votes
1 answer
243 views

I would like to use Open QASM 3 what if any backends can I use to?

From my limited understanding Azure Quantum and IBM Qiskit backends do not support OpenQASM 3. However, Amazon Braket does support a subset of Open QASM 3 (proof). What is the best way/backend to test ...
EXA_Q's user avatar
  • 31
4 votes
1 answer
286 views

Does Qiskit allow for QASM 3.0 code to be utilized?

I am interested in using QASM 3.0 after reading it's documentation and seeing it's examples 1. However, I see that in IBM Quantum Experience QASM 3.0 is not supported yet. Is there any way I can run ...
Ryan's user avatar
  • 41
2 votes
3 answers
1k views

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

From my understanding statevector is a more simplistic using vector space, qasm is supposed to introduce noise like running it on an actual quantum computer. What types of problems would you use one ...
Jeremy's user avatar
  • 47
2 votes
0 answers
351 views

Does Qasm Simulator add noise by default?

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 ...
Yousef Zook's user avatar
1 vote
0 answers
74 views

How to perform lattice surgery with initial state $|0\rangle+|1\rangle$, with qasm?

I am trying to perform a lattice surgery. Initial state is $|0\rangle+|1\rangle$ and when I perform a smooth merge and split, I think I get $|00\rangle+|11\rangle$ but it doesn't work. Is there ...
kaluza19's user avatar
9 votes
1 answer
5k views

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

In Qiskit, we can see the names of available simulators with the command Aer.backends(). These include: ...
user3886914's user avatar
6 votes
1 answer
2k views

Where is definitive documentation for OpenQASM 2.0 and 3.0

I have gotten conflicting information about OpenQASM; some sources point to version 3 while others say 3 is not ready. I want to refer to a document that will tell me what instructions actually work ...
Anna Naden's user avatar
3 votes
1 answer
313 views

Qiskit does not interpret qasm string as 3.0?

I am trying to get my first openqasm3.0 program and I am getting error messages that I cannot interpret. Here is my program: ...
Anna Naden's user avatar
2 votes
1 answer
312 views

How to convert code from QISKIT to QuEST using QASM

I have been working on this project which requires a lot of qubits. Originally we have made the whole project in QISKIT as we have been using it for a long time. But the maximum number of qubits that ...
Parmeet Singh EP 066's user avatar
1 vote
1 answer
212 views

QASM Files on Jupyter Notebook

Is it possible to run qasm files on jupyter notebook (like with the qasm_simulator)? I downloaded one code file and I would like to play around with it on jupyter notebook.
Berni89's user avatar
  • 19
1 vote
0 answers
185 views

How can I get the results from simulating noise models?

I'm trying to run some simulations of my quantum circuits using qasm simulator. I first tried to import the noise data from a quantum device and then use that information on qasm. Here's part of my ...
ZR-'s user avatar
  • 2,408
1 vote
2 answers
122 views

Are we using the real-time error information in simulating noise on qasm?

I'm trying to run some quantum circuits on qasm simulator using the noise information from IBM Q quantum device: ...
ZR-'s user avatar
  • 2,408
3 votes
1 answer
1k views

Simulating OpenQASM 2.0 in Qiskit?

I'm just getting started with OpenQASM, but I'm feeling a bit confused. Is there a way to run the .qasm file I've written in Qiskit (i.e. in Python), or is OpenQasm ...
stare100's user avatar
0 votes
1 answer
216 views

How to build and visualize circuit from matrix?

In paper Efficient quantum algorithm for solving travelling salesman problem: An IBM quantum experience, the authors use gate $U_j$ and its decomposition $$ U_j = \begin{pmatrix} \mathrm{e}^{ia} &...
Pritam Sinha's user avatar
1 vote
1 answer
71 views

Use of Data loaders or State Initialization Circuits

I have recently started working on qiskit and I am struggling to use qc.initialize API in any practical or useful application. I have read at multiple places that ...
Manu's user avatar
  • 503
2 votes
1 answer
213 views

Is it true that QasmSimulator is much slower than StatevectorSimulator, or am I doing something wrong?

I'm trying to calculate the expectation value of some operator for a state that comes out of a quantum circuit using Qiskit. I was initially using ...
A. Jahin's user avatar
  • 264
3 votes
1 answer
355 views

IF statement in OpenQASM2.0 on IBM Quantum Experience -- error

I have written the following toy .qasm file, which has some adaptive measurements: ...
fcrp's user avatar
  • 166
3 votes
1 answer
429 views

Is there a way to within a quantum circuit work out if a qubit is in a superposition or not?

Preferably using the gates found in QASM/Qiskit and the qubit stays in the superposition and no measurement is made, i.e. the output of if it is in a superposition or not is a binary answer in another ...
Tom's user avatar
  • 45
1 vote
1 answer
508 views

How to import circuit libraries into qiskit

Im trying to put the QFT circuit in my qiskit circuit but im having trouble: ...
dude's user avatar
  • 37
3 votes
1 answer
202 views

Why does running my circuit on Quantum Hardware produce such unexpected results?

I am using Jupyter Notebook with Qiskit. I have created a program that can add two 3-bit numbers together. When I simulate this program on a qasm_simulator it works as expected and I can add any two 3-...
John's user avatar
  • 107
2 votes
3 answers
1k views

How to read QASM files for parametrized circuits (in QISKIT)? both from_qasm_file() and from_qasm_str() fail

I am trying to work with parametrized circuits in QISKIT. I can simply create parameterized circuits, bind value(s) to parameter(s), and execute/run all instances (after binding values for parameters) ...
Ramin's user avatar
  • 21
2 votes
3 answers
375 views

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

Is it possible to see what are the values of $\alpha$ (probability of being in state zero) and $\beta$ (probability of being in state one) while running on IBM Quantum simulator (we can call it state ...
User1086's user avatar
3 votes
3 answers
259 views

Quantum Error Correction implementation in Qiskit, OpenQASM or other languages based on Python

Where can we find example(s) of implementation code in a programming language of Quantum Error Correction, whether with the standard method of measurement or the automatic method without measurement (...
Bertrand Mercier's user avatar
2 votes
1 answer
139 views

Is it possible to modify pulse schedules in QASM?

Is it possible to modify a pulse schedule of a circuit compiled using QASM? I know this is possible using OpenPulse, but it seems none of the IBM backends support OpenPulse. So is it possible to do ...
user14536's user avatar
1 vote
0 answers
58 views

Why do I get the error 'IBMQManagedResultDataNotAvailable'?

I'm trying to use IBMQ job manager to submit a list of quantum circuits (300 of them in total) to 'ibmq_16_melbourne'. This is what the job status looks like on IBM Quantum Experience: I don't know ...
ZR-'s user avatar
  • 2,408
1 vote
1 answer
185 views

Is there a faster way to get 'a list of' result from 'a list of inputs'?

I had a question about obtaining the probability of a certain state from the histogram, still using this example, suppose there's a variable in my quantum circuit, it's values are stored in an 'np....
ZR-'s user avatar
  • 2,408
5 votes
1 answer
1k views

How to run a OpenQASM 3.0 file?

When uploading a QASM-file with ÒPENQASM 3.0; as first line, the code editor on quantum-computing.ibm.com will throw an error. However the qiskit Python library ...
Illuminatio2718's user avatar
0 votes
1 answer
150 views

Odd behavior with Qiskit Pauli operators

I was creating a simple implementation of the Hadamard test when I came across the following, what seems like, strange behavior. Consider the following snippet, which is part of the computating the ...
dylan7's user avatar
  • 334
0 votes
1 answer
542 views

Qiskit implementation for MPS

Now, I'm implementing Matrix product state method with QasmSimulation in Qiskit. following code The problem arise when I set number of qubits. When running it with 27qubits is very fast but, for 24, ...
김동민's user avatar
  • 947
2 votes
1 answer
184 views

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

I ran a 3-qubit measurement circuit on QASM simulator as well as on IBM Q Melbourne, Santiago and Vigo machines. The running time on the simulator is in few milliseconds (400-800) while in the case of ...
parth's user avatar
  • 305
1 vote
0 answers
71 views

What causes the random variations in the probabilities with respect to the theoretical values, in IBM and QASM simulators?

When I measure 2 and 3 qubits after putting H gate on all of them, there is a variation in probabilities of results in comparison with theoretical values (25% and 12.5%, respectively). This occurs on ...
parth's user avatar
  • 305
0 votes
2 answers
1k views

How to plot histogram using statevector simulator?

I'm trying to run my quantum circuit and plot the simulation result (counts) using the statevector simulator (to avoid 'shot noise'). However, instead of a 2-d histogram, the examples on Qiskit ...
ZR-'s user avatar
  • 2,408
4 votes
1 answer
1k views

Is there any way we get the state vector/density matrix of a noisy simulation in qiskit?

In Qiskit we can't use noise models in the 'state vector_simulator' or the 'unitary simulator', hence making it impossible to compute fidelity of the output of the noisy circuit and the noiseless ...
Pingal Pratyush Nath's user avatar