Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

QuantumFramework

Tutorials

  • Getting Started
  • Quantum Object Composition

Guides

  • Wolfram Quantum Computation Framework

Tech Notes

  • Bell's Theorem: CHSH inequality
  • Circuit Diagram
  • Exploring Fundamentals of Quantum Theory
  • QPU Service Connection
  • Quantum object abstraction
  • Quantum Optimization
  • Second Quantization Functions
  • Tensor Network
  • Quantum Computation

Symbols

  • CliffordChannel
  • EinsteinSummation
  • GraphState
  • LocalComplement
  • PauliStabilizer
  • QiskitTarget
  • QuantumBasis
  • QuantumChannel
  • QuantumCircuitMultiwayGraph [EXPERIMENTAL]
  • QuantumCircuitOperator
  • QuantumDistance
  • QuantumEntangledQ
  • QuantumEntanglementMonotone
  • QuantumEvolve
  • QuantumMeasurement
  • QuantumMeasurementOperator
  • QuantumMeasurementSimulation
  • QuantumMPS [EXPERIMENTAL]
  • QuantumOperator
  • QuantumPartialTrace
  • QuantumPhaseSpaceTransform
  • QuantumQASM
  • QuantumShortcut [EXPERIMENTAL]
  • QuantumSimilarity
  • QuantumStateEstimate [EXPERIMENTAL]
  • QuantumState
  • QuantumTensorProduct
  • QuantumWignerMICTransform [EXPERIMENTAL]
  • QuantumWignerTransform [EXPERIMENTAL]
  • QuditBasis
  • QuditName
  • StabilizerFrame
  • StabilizerStateQ
Wolfram`QuantumFramework`
QuantumQASM
​
QuantumQASM
[circ]
gives the OpenQASM 3 string for the quantum circuit circ, serialized exactly as built.
​
​
QuantumQASM
[circ,{
g
1
,
g
2
,…}]
transpiles circ to the native gate set
{
g
1
,
g
2
,…}
and gives the resulting native OpenQASM.
​
​
QuantumQASM
[circ,basis,opts]
applies qiskit transpiler options opts such as
"CouplingMap"
,
"OptimizationLevel"
and
"Target"
.
​
​
QuantumQASM
[circ,"Version"2]
gives OpenQASM 2 instead of the default OpenQASM 3.
​
Details and Options
▪
circ can be a
QuantumCircuitOperator
or a
QiskitCircuit
(the value of
qco["Qiskit"]
).
▪
QuantumQASM
is faithful by default: with no native gate set and no
"Target"
,
"CouplingMap"
or other transpiler option, circ is serialized exactly as built, with no qubit routing or optimization. Supplying any native gate set, target, coupling map or transpiler option makes
QuantumQASM
transpile circ first, then serialize the result.
▪
QuantumQASM
returns an OpenQASM
String
. On any error it returns a
Failure
instead of a partial program (see Possible Issues). It has no further property or accessor calls; the device model it accepts through
"Target"
, a
QiskitTarget
object, is what carries accessors such as
["NumQubits"]
and
["OperationNames"]
(shown under Options).
▪
The native gate set is a list of qiskit standard gate names such as
{"x","sx","rz","cz"}
; it can equivalently be given through the
"BasisGates"
option. The names are defined by the installed qiskit (54 in qiskit 2.4.1, e.g.
"x"
,
"sx"
,
"rz"
,
"cz"
,
"h"
,
"cx"
,
"ecr"
,
"swap"
,
"ccx"
); this set can differ between qiskit versions, so the complete, version-correct list is qiskit's standard gate-name mapping, obtainable with
qiskit.circuit.library.get_standard_gate_name_mapping
or from qiskit's
circuit-library documentation
.
▪
Every option other than
"Version"
is forwarded to qiskit's transpiler. Option names are CamelCase and map to qiskit's snake_case parameter names (
"CouplingMap"
to
coupling_map
); the raw snake_case name is accepted too. Any current or future qiskit transpile parameter therefore works without a change to
QuantumQASM
.
▪
A
"CouplingMap"
is a list of directed pairs
{{c,t},…}
of physical qubit indices that may interact; two-qubit gates are emitted in that calibrated direction.
▪
A qiskit-free alternative is the pure-Wolfram emitter
QuantumCircuitOperator
property
"QASM"
, which emits a generic gate set;
QuantumQASM
instead routes through qiskit and can decompose to a hardware-native basis.
▪
QuantumQASM
builds the qiskit circuit through
qco["Qiskit"]
and runs the qiskit transpiler in the framework's Python session; the qiskit package is installed automatically on first use.
Option
Default value
Description
"Version"
3
the OpenQASM version to emit, 2 or 3
"BasisGates"
Automatic
the native gate set (the same as the second argument)
"CouplingMap"
Automatic
directed pairs of physical qubits that may interact
"OptimizationLevel"
Automatic
the qiskit optimization level, 0 through 3
"Target"
None
a
QiskitTarget
object or an Association device spec
▪
Any other qiskit
transpile
parameter (for example
"InitialLayout"
,
"RoutingMethod"
,
"SeedTranspiler"
) is also accepted.
▪
The string value of a method option —
"LayoutMethod"
,
"RoutingMethod"
,
"TranslationMethod"
,
"SchedulingMethod"
,
"InitMethod"
,
"OptimizationMethod"
,
"UnitarySynthesisMethod"
— is the name of a qiskit transpiler stage plugin. These names are defined by the installed qiskit, not by
QuantumQASM
, and vary by version; the authoritative list is qiskit's
transpilation defaults and configuration options
guide, and they can be enumerated from the installed qiskit through
qiskit.transpiler.preset_passmanagers.plugin.list_stage_plugins
. For the qiskit 2.4.1 bundled with the framework the values are:
Method option
qiskit 2.4.1 plugin names
"LayoutMethod"
"trivial"
,
"dense"
,
"sabre"
,
"default"
"RoutingMethod"
"basic"
,
"lookahead"
,
"sabre"
,
"none"
,
"default"
"TranslationMethod"
"translator"
,
"synthesis"
,
"default"
(plus backend-specific
"ibm_…"
variants)
"SchedulingMethod"
"asap"
,
"alap"
,
"default"
"UnitarySynthesisMethod"
"default"
,
"aqc"
,
"clifford"
,
"gridsynth"
,
"sk"
"InitMethod"
,
"OptimizationMethod"
"default"
▪
The table above is a snapshot of qiskit 2.4.1. A different qiskit version may add, rename, or remove these plugin names, so the list could differ from what is shown here — the authoritative set is always whatever the installed qiskit reports (queryable through
list_stage_plugins
), not this page.
QuantumQASM
itself does not depend on the table: it forwards whatever value you give straight to qiskit, so a value the installed qiskit does not recognize comes back as a
Failure
carrying qiskit's own message.
▪
"OptimizationLevel"
takes an integer 0 through 3;
"SeedTranspiler"
takes any integer.
​
Examples  
(16)
Basic Examples  
(1)
The OpenQASM 3 of a circuit, serialized exactly as built: Transpile the same circuit to a native gate set: Route onto a device coupling map, emitting two-qubit gates in the calibrated direction:
In[1]:=
qc=
QuantumCircuitOperator

QuantumOperator
@"Toffoli";​​qc["Diagram"]
Out[1]=
In[2]:=
QuantumQASM[qc]
Out[2]=
OPENQASM 3.0;include "stdgates.inc";qubit[3] q;ccx q[0], q[1], q[2];
In[3]:=
QuantumQASM[qc,{"x","sx","rz","cz"}]
Out[3]=
OPENQASM 3.0;include "stdgates.inc";qubit[3] q;rz(pi/2) q[2];cz q[1], q[2];sx q[2];rz(3*pi/4) q[2];sx q[2];rz(pi) q[2];cz q[0], q[2];sx q[2];rz(5*pi/4) q[2];sx q[2];rz(pi) q[2];cz q[1], q[2];rz(3*pi/4) q[1];sx q[1];rz(pi) q[1];sx q[2];rz(3*pi/4) q[2];sx q[2];rz(pi) q[2];cz q[0], q[2];cz q[0], q[1];rz(pi/4) q[0];sx q[1];rz(3*pi/4) q[1];sx q[1];rz(pi) q[1];cz q[0], q[1];sx q[1];rz(pi/2) q[1];sx q[2];rz(5*pi/4) q[2];sx q[2];rz(pi/2) q[2];
In[4]:=
QuantumQASM[qc,{"x","sx","rz","cz"},"CouplingMap"{{1,0},{1,3},{2,0},{2,3}},"OptimizationLevel"3]
Out[4]=
OPENQASM 3.0;include "stdgates.inc";rz(pi/2) $2;cz $2, $3;sx $2;rz(3*pi/4) $2;sx $2;rz(pi) $2;cz $2, $0;sx $2;rz(5*pi/4) $2;sx $2;rz(pi) $2;cz $2, $3;sx $2;rz(3*pi/4) $2;sx $2;rz(pi) $2;cz $2, $0;sx $2;rz(-pi/4) $2;sx $2;rz(pi/2) $2;rz(-pi/4) $3;cz $2, $3;sx $2;sx $3;cz $2, $3;sx $2;sx $3;cz $2, $3;cz $2, $0;rz(pi/4) $0;sx $2;rz(3*pi/4) $2;sx $2;rz(pi) $2;cz $2, $0;sx $2;rz(pi/2) $2;

© 2026 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com