qbraid_algorithms.qtran

Quantum Algorithm Translation and QASM Generation

Quantum Translation Framework (QTRAN)

This module provides a comprehensive framework for quantum algorithm translation and QASM code generation. QTRAN enables systematic construction of quantum circuits through high-level abstractions, automated gate library management, and optimized QASM subroutine generation for quantum algorithms. The framework supports modular circuit design, gate library composition, and cross-platform quantum code generation, facilitating rapid development and deployment of quantum algorithms across different quantum hardware platforms.

FORMULATION

Circuit Construction: QTRAN provides builders for systematic quantum circuit assembly:

Gate Library Framework: Organize quantum operations into reusable libraries:

\(\mathcal{L} = \{G_1, G_2, \ldots, G_n\}\)

where each gate \(G_i\) represents a quantum operation with associated parameters.

Circuit Builder Pattern: Construct circuits through compositional operations:

\(C = B(G_1 \circ G_2 \circ \ldots \circ G_n)\)

where \(B\) is the builder function and \(\circ\) denotes gate composition.

QASM Generation: Transform high-level circuit descriptions to executable QASM:

\(\text{QASM} = T(C, \mathcal{P})\)

where \(T\) is the translation function and \(\mathcal{P}\) are platform parameters.

Key Components:

  • FileBuilder: Manages QASM file structure and includes

  • GateBuilder: Constructs individual quantum gates with parameters

  • QasmBuilder: Assembles complete QASM programs from components

  • IncludeBuilder: Handles library imports and dependencies

  • GateLibrary: Provides extensible gate operation collections

  • std_gates: Standard quantum gate implementations

Abstraction Levels: Supports multiple abstraction levels from low-level gate operations to high-level algorithm subroutines, enabling both fine-grained control and rapid prototyping.

Classes

FileBuilder()

Base class for all OpenQASM code builders.

GateBuilder()

Specialized builder for generating gate definition files.

QasmBuilder(qubits[, clbits, version])

Complete OpenQASM circuit builder for quantum programs.

IncludeBuilder()

Builder for generating OpenQASM include files.

GateLibrary(gate_import, gate_ref, ...[, ...])

BASE GATE LIBRARY

std_gates(*args, **kwargs)

STANDARD GATES LIBRARY