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
  • An IBM Quantum Error Map
  • QPU Service Connection
  • Quantum object abstraction
  • Quantum Optimization
  • Second Quantization Functions
  • Sending Queries to IBM QPUs
  • Tensor Network
  • Quantum Computation

Symbols

  • CliffordChannel
  • EinsteinSummation
  • GraphState
  • IBMJob
  • IBMJobSubmit
  • LocalComplement
  • PauliStabilizer
  • QiskitCircuit
  • 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 by the native Wolfram Language emitter (no qiskit dependency).
​
​
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]
transpiles circ to the native gate set basis, applying the qiskit transpiler options opts.
​
​
QuantumQASM
[circ,"Version"2]
gives OpenQASM 2 instead of the default OpenQASM 3.
​
​
QuantumQASM
[op]
gives the OpenQASM line for a single
QuantumOperator
op.
​
​
QuantumQASM
["qasm"]
imports an OpenQASM 2 or 3 source string and gives the corresponding
QuantumCircuitOperator
.
​
​
QuantumQASM
[
File
["file.qasm"]]
(or a bare
".qasm"
file path) imports OpenQASM from a file.
​
Details and Options
▪
circ can be a
QuantumCircuitOperator
or a
QiskitCircuit
(the value of
qco["Qiskit"]
). A single
QuantumOperator
op is also accepted and gives just that gate's OpenQASM line.
▪
QuantumQASM[
circ
,"WL"]
is an explicit synonym for the native bare-call emission, and
QuantumQASM[
op
,"Simple"]
gives the bare gate fragment (no qubit operands). These two are the dependency-free emitters that back the
QuantumCircuitOperator
"QASM"
,
QuantumOperator
"QASM"
, and
QuantumOperator
"SimpleQASM"
properties — every QASM property routes through
QuantumQASM
.
▪
Supplying a
"Provider"
or
"Backend"
option engages the hardware-provider export path: the circuit is transpiled against a real backend and serialized, including the AWS-Braket OpenQASM conversion when the provider is AWS Braket (
"Provider""AWSBraket"
).
▪
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.
▪
The bare call
QuantumQASM[
circ
]
(no arguments) uses the native Wolfram Language emitter: it needs no qiskit or Python, is unaffected by qiskit version changes, and emits a generic gate set (single-qubit gates as
U(θ,φ,λ)
, controls as
ctrl@…negctrl@…
). Supplying any argument (a native gate set, a
"Target"
, an OpenQASM
"Version"
, or any transpiler option) routes through qiskit instead, which emits standard named gates (
h
,
cx
, …) and can decompose to a hardware-native basis.
▪
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.
▪
Given an OpenQASM source string (one carrying an
OPENQASM
header) or a
File
,
QuantumQASM
runs in the reverse direction and imports the program into a
QuantumCircuitOperator
. Import is a native Wolfram Language parser with no qiskit or Python dependency, so it works on any installation and is unaffected by qiskit version changes. The
QuantumCircuitOperator
constructor accepts the same OpenQASM source or file directly (
QuantumCircuitOperator["OPENQASM 3.0; …"]
).
▪
Import covers the circuit-level subset of OpenQASM 2 and 3: the version header,
include
,
qreg
/
creg
and
qubit
/
bit
declarations, standard and parametrized gate calls, custom
gate
definitions (imported as named subcircuits), the
inv
/
pow
/
ctrl
/
negctrl
gate modifiers,
measure
(both the v2
measureqc
and v3
c=measureq
forms),
reset
,
barrier
, and
gphase
. A construct outside this subset (classical control flow,
def
,
defcal
, timing, …) returns a
Failure
that names the offending statement, never a partial circuit.
▪
Gate-argument expressions may use arithmetic with
pi
,
tau
and
euler
; any other identifier (including an attempt to smuggle in a Wolfram Language function) is refused as a
Failure
rather than evaluated.
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
"Provider"
None
a hardware provider (e.g.
"IBMQ"
,
"AWSBraket"
); engages the provider export path
"Backend"
Automatic
a specific backend to transpile against (used with
"Provider"
)
▪
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  
(19)
Basic Examples  
(4)
The OpenQASM 3 of a circuit, serialized exactly as built by the native, dependency-free emitter (single-qubit gates as
U(θ,φ,λ)
, controls as
ctrl@…negctrl@…
):
In[1]:=
QuantumQASM
QuantumCircuitOperator
[{"H"1,"CNOT"{1,2},{1},{2}}]
Out[1]=
OPENQASM 3.0;qubit[2] q;bit[2] c;U(1.5707963267948966, 0., 3.141592653589793) q[0];ctrl(1) @ negctrl(0) @ U(3.141592653589793, 0., 3.141592653589793) q[0] q[1];c[0] = measure q[0];c[1] = measure q[1];
_________________________________________________________________________________________________________________
Pass any argument to route through qiskit instead, which emits standard named gates — here the same circuit as a faithful qiskit OpenQASM 3 dump:
In[1]:=
QuantumQASM
QuantumCircuitOperator
[{"H"1,"CNOT"{1,2},{1},{2}}],"Version"3
Out[1]=
OPENQASM 3.0;include "stdgates.inc";bit[2] c;qubit[2] q;h q[0];cx q[0], q[1];c[0] = measure q[0];c[1] = measure q[1];
_________________________________________________________________________________________________________________
Transpile the same circuit to a native gate set:
In[1]:=
QuantumQASM
QuantumCircuitOperator
[{"H"1,"CNOT"{1,2},{1},{2}}],{"x","sx","rz","cz"}
Out[1]=
OPENQASM 3.0;include "stdgates.inc";bit[2] c;qubit[2] q;rz(pi/2) q[0];sx q[0];rz(pi/2) q[0];rz(pi/2) q[1];sx q[1];rz(pi) q[1];cz q[0], q[1];sx q[1];rz(pi/2) q[1];c[0] = measure q[0];c[1] = measure q[1];
_________________________________________________________________________________________________________________
Route onto a device coupling map, emitting two-qubit gates in the calibrated direction:
In[1]:=
QuantumQASM
QuantumCircuitOperator
[{"H"1,"CNOT"{1,2},{1},{2}}],{"x","sx","rz","cz"},"CouplingMap"{{1,0},{1,3},{2,0},{2,3}},"OptimizationLevel"3
Out[1]=
OPENQASM 3.0;include "stdgates.inc";bit[2] c;rz(pi/2) $0;sx $0;rz(pi/2) $0;rz(pi/2) $1;sx $1;rz(pi) $1;cz $1, $0;sx $1;rz(pi/2) $1;c[0] = measure $0;c[1] = measure $1;
Scope  
(3)

Options  
(6)


© 2026 Wolfram. All rights reserved.

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