Ket Programming Guide

It has long been known theoretically that quantum computers have the potential to solve certain problems faster than classical computers, and this reality is steadily moving closer to practical application. While it remains unclear exactly when today’s quantum computers will achieve a definitive advantage in solving real-world problems, the path toward this future is well-established [1].

Quantum computing is an emerging paradigm for data processing that relies on the fundamental principles of quantum mechanics. This new paradigm introduces superposition and entanglement, powerful new tools for software development, while also imposing strict physical constraints, such as the impossibility of copying an unknown quantum state and the destructive nature of quantum measurement. These unique characteristics drive the need for specialized quantum programming tools.

Ket [2] is an open-source quantum programming platform that provides the necessary functions and types to enable quantum programming natively in Python. The platform is built around the gate-based quantum computing model, where data is stored in qubits and the program is expressed as a quantum circuit.

This paper serves as a programming guide for the Ket platform, demonstrating how to develop quantum applications and explore the nuances of quantum software development. A priori knowledge of quantum computing and Python programming is expected from the reader. Exhaustive details, such as comprehensive lists of available gates and optional parameters, can be found in the Ket API documentation; we recommend consulting the official documentation as supplementary material.

The remainder of this guide is organized as follows:

  • The Platform outlines the architecture of the Ket platform.

  • Quantum Process explains the management of the quantum process.

  • Quantum Gates details the application of quantum gates, encompassing controlled operations, higher-order gate composition, and inverse operations.

  • Quantum Measurement discusses measurement strategies, expectation value calculations, and state extraction for retrieving classical information from quantum circuits.

  • Hamiltonian Construction provides a comprehensive guide to Hamiltonian construction.

  • Examples: MaxCut consolidates the presented concepts through a practical tutorial implementing QAOA, VQE, and FALQON for the Max-Cut problem.

  • Final Remarks concludes the guide with final remarks and an outlook on future developments.