Quantum Computation Language

Quantum Computation Language (QCL) is one of the first implemented quantum programming languages.[1] The most important feature of QCL is the support for user-defined operators and functions. Its syntax resembles the syntax of the C programming language and its classical data types are similar to primitive data types in C. One can combine classical code and quantum code in the same program.

The language was created before there were multi-qubit quantum computers and the only implementation of QCL uses an interpreter with a built-in classically simulated quantum computer.

QCL was created to explore programming concepts for quantum computers.[2][3][4]

The QCL library provides standard quantum operators used in quantum algorithms such as:[5]

  • Controlled-not with many target qubits,
  • Hadamard operation on many qubits,
  • Phase and controlled phase.
  • Quantum algorithms for addition, multiplication and exponentiation with binary constants (all modulus n)
  • The quantum fourier transform

Syntax

  • Data types
    • Quantum - qureg, quvoid, quconst, quscratch, qucond
    • Classical - int, real, complex, boolean, string, vector, matrix, tensor
  • Function types
    • qufunct - Pseudo-classic operators. Can only change the permutation of basis states.
    • operator - General unitary operators. Can change the amplitude.
    • procedure - Can call measure, print, and dump inside this function. This function is non-invertible.
  • Built-in functions
    • Quantum
      • qufunct - Fanout, Swap, Perm2, Perm4, Perm8, Not, CNot
      • operator - Matrix2x2, Matrix4x4, Matrix8x8, Rot, Mix, H, CPhase, SqrtNot, X, Y, Z, S, T
      • procedure - measure, dump, reset
    • Classical
      • Arithmetic - sin, cos, tan, log, sqrt, ...
      • Complex - Re, Im, conj

Examples

The basic built-in quantum data type in QCL is the qureg (quantum register). It can be interpreted as an array of qubits (quantum bits).

qureg x1[2]; // 2-qubit quantum register x1
qureg x2[2]; // 2-qubit quantum register x2
H(x1); // Hadamard operation on x1
H(x2[1]); // Hadamard operation on the first qubit of the register x2

Since the qcl interpreter uses qlib simulation library, it is possible to observe the internal state of the quantum machine during execution of the quantum program.

qcl> dump
: STATE: 4 / 32 qubits allocated, 28 / 32 qubits free
0.35355 |0> + 0.35355 |1> + 0.35355 |2> + 0.35355 |3>
+ 0.35355 |8> + 0.35355 |9> + 0.35355 |10> + 0.35355 |11>

Note that the dump operation is different from measurement, since it does not influence the state of the quantum machine and can be realized only using a simulator.

Like in modern programming languages, it is possible to define new operations which can be used to manipulate quantum data. For example:

operator diffuse (qureg q) {
  H(q);                 // Hadamard Transform
  Not(q);               // Invert q
  CPhase(pi, q);        // Rotate if q=1111..
  !Not(q);              // undo inversion
  !H(q);                // undo Hadamard Transform
}

defines inverse about the mean operator used in Grover's algorithm (it is sometimes called Grover's diffusion operator). This allows one to define algorithms on a higher level of abstraction and extend the library of functions available for programmers.

References

  1. ^ "QCL - A Programming Language for Quantum Computers". tuwien.ac.at. Retrieved 2017-07-20.
  2. ^ Ömer, Bernhard (2000-01-20). Quantum Programming in QCL (PDF) (Thesis). Institute for Theoretical Physics, Vienna University of Technology. Retrieved 2021-05-24.
  3. ^ Ömer, Bernhard (29 Apr 2003). "Classical Concepts in Quantum Programming". International Journal of Theoretical Physics. 44 (7): 943–955. arXiv:quant-ph/0211100. doi:10.1007/s10773-005-7071-x. S2CID 119373370.
  4. ^ Ömer, Bernhard (2 September 2009). "Structured Quantum Programming" (PDF). Institute for Theoretical Physics, Vienna University of Technology.
  5. ^ QCL web page

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.