CircuitOutput Module
Renders Gate arrays into OpenQASM (2.0 and 3.0), Q#, and JSON circuit formats.
Uses a CodeFragment computation expression for structured text
generation. All functions are pure — no side effects.
Types and nested modules
| Type/Module | Description |
|
Combinators for building and transforming code fragments. |
|
|
Computation expression builder for CodeFragment. |
|
|
Lines of generated code — the basic building block for all backends. |
|
|
Options controlling OpenQASM output. |
|
|
Options controlling Q# output. |
|
|
OpenQASM language version. |
Functions and values
| Function or value |
Description
|
|
Computation expression instance for building code fragments.
|
|
Defaults for OpenQASM 2.0 (Quokka-compatible).
|
|
Sensible defaults for OpenQASM 3.0 generation.
|
|
Sensible defaults for Q# generation.
|
|
|
Full Usage:
toOpenQasm opts numQubits gates
Parameters:
OpenQasmOptions
-
Formatting options including version selection.
numQubits : int
-
Number of qubits in the register declaration.
gates : Gate[]
-
Gate sequence to render.
Returns: string
|
Render a gate array to an OpenQASM program (2.0 or 3.0).
|
Full Usage:
toQSharp opts numQubits gates
Parameters:
QSharpOptions
-
Formatting options.
numQubits : int
-
Number of qubits (for documentation; the operation takes a Qubit array).
gates : Gate[]
-
Gate sequence to render.
Returns: string
|
Render a gate array to a Q# operation.
|
Full Usage:
trotterStepToOpenQasm opts step
Parameters:
OpenQasmOptions
-
Formatting options including version selection.
step : TrotterStep
-
The Trotter step to render.
Returns: string
|
Render a TrotterStep to OpenQASM (2.0 or 3.0), inferring numQubits from the gates.
|
Full Usage:
trotterStepToQSharp opts step
Parameters:
QSharpOptions
-
Formatting options.
step : TrotterStep
-
The Trotter step to render.
Returns: string
|
Render a TrotterStep to Q#, inferring numQubits from the gates.
|