The Platform¶
The Ket project is structurally organized into three highly integrated components:
Ket The Python module serving as the frontend interface. It provides an expressive, user-facing syntax that seamlessly embeds quantum instructions within Python code.
Libket: The platform’s core runtime library. Developed in Rust for maximum performance, it is responsible for orchestrating the quantum process, managing opaque qubit references, and dynamically compiling the quantum circuits.
KBW: The platform’s default backend simulator. It features both sparse and dense simulation modes, allowing programmers to optimize memory usage and execution speed based on the circuit’s structure. The sparse mode stores only non-zero probability amplitudes, making it highly efficient for algorithms that explore a limited subset of the Hilbert space, such as the QAOA ansatz [3], though it has limited multithreading capabilities. Conversely, the dense mode acts as a multicore state-vector simulator that computes the entire amplitude vector, maximizing parallel processing.
Both Libket and KBW are written in Rust and are exposed to the Python package via a C foreign language interface (FFI). Because the platform is under active development, neither the Rust nor the C APIs are strictly stable, and they may undergo changes between minor releases. However, the frontend Python module is designed to provide a stable, expressive, and user-friendly interface for the programmer.
This guide is based on Ket version 0.9.2.3. Ket can be easily installed using the Python package manager via pip install ket-lang. The platform supports Linux, macOS, and Windows, offering compiled binaries for x86_64 and Apple Silicon.