Liking cljdoc? Tell your friends :D

org.soulspace.qclojure.application.format.qasm3

OpenQASM 3.0 conversion functions for quantum circuits with enhanced result types.

This namespace provides conversion between quantum circuit data structures and OpenQASM 3.0 format strings. QASM 3.0 is the latest version of the OpenQASM quantum assembly language with improved syntax, features, and comprehensive support for result extraction including measurements, expectation values, variance, probability, and observables.

Supported QASM 3.0 result extensions:

  • Basic measurements (c[i] = measure q[i])
  • Observable expectation values (#pragma result expectation)
  • Observable variance (#pragma result variance)
  • Probability distributions (#pragma result probability)
  • Amplitude extraction for specific states (#pragma result amplitude)
  • Sample-based measurements with shot specification (#pragma result sample)

Note: State vector and density matrix extraction are simulation-only and not included in hardware-compatible QASM output.

OpenQASM 3.0 conversion functions for quantum circuits with enhanced result types.

This namespace provides conversion between quantum circuit data structures
and OpenQASM 3.0 format strings. QASM 3.0 is the latest version of the
OpenQASM quantum assembly language with improved syntax, features, and
comprehensive support for result extraction including measurements,
expectation values, variance, probability, and observables.

Supported QASM 3.0 result extensions:
- Basic measurements (c[i] = measure q[i])
- Observable expectation values (#pragma result expectation)
- Observable variance (#pragma result variance)
- Probability distributions (#pragma result probability)
- Amplitude extraction for specific states (#pragma result amplitude)
- Sample-based measurements with shot specification (#pragma result sample)

Note: State vector and density matrix extraction are simulation-only
and not included in hardware-compatible QASM output.
raw docstring

circuit-to-qasmclj

(circuit-to-qasm circuit)
(circuit-to-qasm circuit result-specs)

Convert a quantum circuit to OpenQASM 3.0 format with result type support.

OpenQASM 3.0 is the latest version of the quantum assembly language standard with improved syntax, built-in gates, and better type system support. Enhanced with QClojure result extraction pragmas for comprehensive quantum result types including measurements, expectation values, variance, probability distributions, and observables.

Parameters:

  • circuit: Quantum circuit to convert
  • result-specs: (optional) Map specifying result extraction requirements

Returns: String containing QASM 3.0 code with result pragmas

Convert a quantum circuit to OpenQASM 3.0 format with result type support.

OpenQASM 3.0 is the latest version of the quantum assembly language standard
with improved syntax, built-in gates, and better type system support.
Enhanced with QClojure result extraction pragmas for comprehensive
quantum result types including measurements, expectation values, variance,
probability distributions, and observables.

Parameters:
- circuit: Quantum circuit to convert
- result-specs: (optional) Map specifying result extraction requirements

Returns:
String containing QASM 3.0 code with result pragmas
sourceraw docstring

collect-result-specs-from-qasmclj

(collect-result-specs-from-qasm qasm-lines)

Collect all result specifications from QASM pragma comments.

Collect all result specifications from QASM pragma comments.
sourceraw docstring

observable-to-qasm-commentclj

(observable-to-qasm-comment observable)

Convert an observable to a QASM comment for documentation. QASM 3.0 doesn't have native observable syntax yet, so we use comments.

Convert an observable to a QASM comment for documentation.
QASM 3.0 doesn't have native observable syntax yet, so we use comments.
sourceraw docstring

parse-result-pragmaclj

(parse-result-pragma pragma-line)

Parse a QClojure result pragma from QASM 3.0 comment.

Example pragmas: #pragma qclojure result measurement shots=1000 qubits=0,1 #pragma qclojure result expectation observable=pauli-z target=0 #pragma qclojure result variance observable=pauli-x target=1

Parse a QClojure result pragma from QASM 3.0 comment.

Example pragmas:
#pragma qclojure result measurement shots=1000 qubits=0,1
#pragma qclojure result expectation observable=pauli-z target=0
#pragma qclojure result variance observable=pauli-x target=1
sourceraw docstring

qasm-to-circuitclj

(qasm-to-circuit qasm)

Convert OpenQASM 3.0 code to a quantum circuit with result specifications.

This function parses OpenQASM 3.0 code and constructs a quantum circuit object. It supports the basic gates and measurements defined in QASM 3.0, plus QClojure result extraction pragmas.

Parameters:

  • qasm: String containing OpenQASM 3.0 code

Returns: Map with :circuit (quantum circuit object) and :result-specs (parsed result specifications)

Convert OpenQASM 3.0 code to a quantum circuit with result specifications.

This function parses OpenQASM 3.0 code and constructs a quantum circuit
object. It supports the basic gates and measurements defined in QASM 3.0,
plus QClojure result extraction pragmas.

Parameters:
- qasm: String containing OpenQASM 3.0 code

Returns:
Map with :circuit (quantum circuit object) and :result-specs (parsed result specifications)
sourceraw docstring

result-specs-to-qasm-pragmasclj

(result-specs-to-qasm-pragmas result-specs)

Convert result specifications to QASM 3.0 pragma comments. These provide metadata about what results should be extracted.

Convert result specifications to QASM 3.0 pragma comments.
These provide metadata about what results should be extracted.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close