-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e729bf
commit c64c8c1
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
features: | ||
- | | ||
The :mod:`qiskit.qasm3` package now contains a built-in, Rust-based parser for reading OpenQASM | ||
3 programs into :class:`.QuantumCircuit`\ s, found at :func:`qiskit.qasm3.load_experimental` and | ||
:func:`~.qasm3.loads_experimental`. These are typically several times faster than the existing, | ||
pure Python :func:`~.qasm3.load` and :func:`~.qasm3.loads` functions, which additionally require | ||
``qiskit-qasm3-import`` to be installed. | ||
For example, we can create a 20,000-instruction entangling :class:`.QuantumCircuit`:: | ||
import numpy as np | ||
import qiskit.qasm3 | ||
from qiskit.circuit.library import RealAmplitudes | ||
qc = RealAmplitudes(100, reps=100, flatten=True) | ||
qc = qc.assign_parameters(np.random.rand(qc.num_parameters)) | ||
oq3 = qiskit.qasm3.dumps(qc) | ||
The old :func:`.qasm3.loads` took about 7.3s to load the resulting OpenQASM 3 program, whereas | ||
:func:`.qasm3.loads_experimental` took under 300ms on a consumer Macbook Pro (i7, 2020)–a speedup | ||
of 25x! | ||
The supported feature set of the experimental parser is very limited in this preview version, | ||
but this will expand as both the Qiskit side and `the native Rust-based parser | ||
<https://github.com/Qiskit/openqasm3_parser>`__ improve. | ||
One of our main goals with this new parser, alongside the huge speed improvements, is to provide | ||
top-quality error diagnostics. As with other parts of the parser, these are a work in progress, | ||
but you'll start to see much higher quality error messages displayed when parsing invalid | ||
OpenQASM 3 programs with the experimental parser. |