question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

composite gates do not have definition when qasm()'d

See original GitHub issue

Information

  • Qiskit Terra version: master
  • Python version: 3.7

What is the current behavior?

from qiskit import QuantumCircuit, QuantumRegister

rinv_q = QuantumRegister(1, name='q')
rinv_gate = QuantumCircuit(rinv_q, name='rinv')
rinv_gate.sdg(rinv_q)
rinv_gate.h(rinv_q)
rinv_gate.sdg(rinv_q)
rinv_gate.h(rinv_q)
rinv = rinv_gate.to_instruction() 

qr = QuantumRegister(1, name='qr') 
circuit = QuantumCircuit(qr, name='circuit') 
circuit.append(rinv, [qr[0]])

print(circuit.qasm())
OPENQASM 2.0;
include "qelib1.inc";
qreg qr[1];
rinv qr[0];

What is the expected behavior?

OPENQASM 2.0;
include "qelib1.inc";
gate rinv q {sdg q; h q; sdg q; h q; }    #  <--- the definition of rinv
qreg qr[1];
rinv qr[0];

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
1ucian0commented, Jan 10, 2020

Which part is not supported?

The QASM specification does not allow classical bits as arguments. I think. Check out if you can parse them back.

I will open a PR, but will not be able to until Jan 21st, as I am unavailable until then.

Great! We can wait until then… no worries.

0reactions
ajavadiacommented, Jan 24, 2020

A related issue that has been open for a year: https://github.com/Qiskit/qiskit-terra/issues/1566

It is the inverse of this issue. Seems there is an open PR for it but does fully work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source code for qiskit.circuit.quantumcircuit
Raises: CircuitError: if the circuit name, if given, is not valid. ... The custom pulse definition of a given gate is of the...
Read more >
Compiler Passes — OpenQL documentation
A compiler pass is not something defined in OpenQL. ... The circuit generated might also have different angles, though not different gates, and...
Read more >
oitg.circuits API - Oxford Ion Trap Quantum Computing group
Composite pulse implementations for replacing gates with sequences that are logically equivalent, but have different behaviour under imperfections.
Read more >
Construct circuits in the SDK - Amazon Braket
Quantum gates and circuits are defined in the braket.circuits class of the ... From the SDK, you can instantiate a new circuit object...
Read more >
Yao.jl: Extensible, Efficient Framework for Quantum Algo - arXiv
ing [8, 9] have had small scale demonstrations in ... nents are typically, but not limited to, neural ... representation of quantum gates...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found