דלג לתוכן הראשי

מבוא ל-OpenQASM

OpenQASM (שפת הרכבה קוונטית פתוחה), ממשק תכנות עצמאי-מכונה התואם ל-QPUs של IBM®, היא שפת תכנות ציווי לתיאור Circuits קוונטיים. OpenQASM משתמשת במודל ה-Circuit הקוונטי כדי לבטא תוכניות קוונטיות כרצפים מסודרים של פעולות עם פרמטרים (כגון Gates, מדידות ואיפוסים) ומחשוב קלאסי בזמן אמת. בנוסף לאלגוריתמים קוונטיים, OpenQASM יכולה לתאר Circuits המיועדים לאפיון, אימות או דיבאג של מעבדים קוונטיים.

ככל שצרכי פיתוח ה-QPU התפתחו, רשימת התכונות של OpenQASM התרחבה בתגובה; הגרסה העדכנית ביותר, OpenQASM 3, כוללת הרחבות כולל שליטת זרימה feed-forward קלאסית, מגדירי Gate, ומימושי פולסים.

OpenQASM היא הבחירה עבור מגוון קהלים בשל רב-גוניותה. המבוא למאמר OpenQASM 31 נותן דוגמאות:

"Although OpenQASM is not a high-level language, many users would like to write simple quantum circuits by hand using an expressive domain-specific language. Researchers who study circuit compiling need high-level information recorded in the intermediate representations to inform the optimization and synthesis algorithms. Experimentalists prefer the convenience of writing circuits at a relatively high level but often need to manually modify timing or pulse-level gate descriptions at various points in the circuit. Hardware engineers who design the classical controllers and waveform generators prefer languages that are practical to compile given the hardware constraints and make explicit circuit structure that the controllers can take advantage of."

OpenQASM היא פורמט ה-interchange הנפוץ בין כלי תוכנה קוונטיים עצמאיים. עבור מפתחים המעדיפים כלי אחד לבניית Circuit, כלי אחר ל-transpilation, וכן הלאה, OpenQASM היא ה-lingua franca המשמשת כגשר ביניהם.

The Qiskit SDK provides ways to convert between OpenQASM and the QuantumCircuit class (see OpenQASM 2 and Qiskit and OpenQASM 3 and Qiskit for instructions).

For more information, view the OpenQASM live specification.

דוגמת קוד OpenQASM: מצב cat


OPENQASM 3;
include "stdgates.inc";

const n = 3; // number of qubits
qubit[n] q; // a register 'q' of n qubits
bit[n] c; // a register 'c' of n classical bits

h q[0]; // Hadamard
for k in [0:n-1] {
cnot q[k], q[k+1]; // Controlled-NOT from control qubit q[k] to target qubit q[k+1]
}

c = measure q; // measure quantum register

השלבים הבאים

Recommendations

Footnotes

  1. Andrew W. Cross et al. "OpenQASM 3: A broader and deeper quantum assembly language," ACM Transactions on Quantum Computing, Volume 3, Issue 3 (2022). https://doi.org/10.48550/arXiv.2104.14722