Liking cljdoc? Tell your friends :D

org.soulspace.qclojure.application.format.qasm2

QASM 2.0 (Quantum Assembly Language) format conversion for quantum circuits.

This namespace provides functions to convert quantum circuits to and from the OpenQASM 2.0 format, which is widely used in quantum computing platforms such as IBM Qiskit and others.

Note: OpenQASM 2.0 does not natively support some advanced gate types (e.g., global gates, Rydberg gates). Such gates are either decomposed into standard gates where possible or annotated with comments indicating that they require special handling by the backend.

QASM 2.0 (Quantum Assembly Language) format conversion for quantum circuits.

This namespace provides functions to convert quantum circuits to and from
the OpenQASM 2.0 format, which is widely used in quantum computing platforms
such as IBM Qiskit and others.

Note: OpenQASM 2.0 does not natively support some advanced gate types
(e.g., global gates, Rydberg gates). Such gates are either decomposed
into standard gates where possible or annotated with comments indicating
that they require special handling by the backend.
raw docstring

circuit-to-qasmclj

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

Convert a quantum circuit to OpenQASM format.

OpenQASM is a standard quantum assembly language used by many quantum computing platforms including IBM Qiskit and others.

Parameters:

  • circuit: Quantum circuit to convert

Returns: String containing QASM code

Convert a quantum circuit to OpenQASM format.

OpenQASM is a standard quantum assembly language used by many
quantum computing platforms including IBM Qiskit and others.

Parameters:
- circuit: Quantum circuit to convert

Returns:
String containing QASM code
sourceraw docstring

collect-result-specs-from-qasmclj

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

Collect all result specifications from QASM pragma comments.

Parameters:

  • qasm-lines: Sequence of lines from QASM code

Returns: Map of result specifications

Collect all result specifications from QASM pragma comments.

Parameters:
- qasm-lines: Sequence of lines from QASM code

Returns:
Map of result specifications
sourceraw docstring

gate-to-qasm-fnclj

(gate-to-qasm-fn num-qubits)

Return a function that converts a gate to its QASM representation.

Parameters:

  • num-qubits: Total number of qubits in the circuit (for global gates)

Returns: A function that takes a gate and returns its QASM string.

Return a function that converts a gate to its QASM representation.

Parameters:
 - num-qubits: Total number of qubits in the circuit (for global gates)

Returns: A function that takes a gate and returns its QASM string.
sourceraw docstring

parse-result-pragmaclj

(parse-result-pragma pragma-line)

Parse a QClojure result pragma from QASM 2.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 2.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 code to a quantum circuit.

This function parses OpenQASM code and constructs a quantum circuit object. It supports basic gates and measurements.

Parameters:

  • qasm: String containing OpenQASM code

Returns: Quantum circuit object

Convert OpenQASM code to a quantum circuit.

This function parses OpenQASM code and constructs a quantum circuit
object. It supports basic gates and measurements.

Parameters:
- qasm: String containing OpenQASM code

Returns:
Quantum circuit object
sourceraw docstring

qasm-to-gateclj

(qasm-to-gate circuit line)

Add the gate for the line of QASM to the circuit.

Parameters:

  • circuit: Current quantum circuit
  • line: Line of QASM code

Returns: Updated quantum circuit

Add the gate for the line of QASM to the circuit.

Parameters:
  - circuit: Current quantum circuit
  - line: Line of QASM code

Returns:
Updated quantum circuit
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