Tutorials#
Welcome to the Qrisp tutorials! This gallery is designed to take you from a curious beginner to a proficient developer of utility-scale quantum algorithms. By shifting the focus from low-level gate gymnastics to high-level programming with QuantumVariables, Qrisp allows you to express complex logic with ease.
The tutorials are organized into four topics, each containing multiple hands-on examples that build on each other:
Foundations and first Steps: Start here to master the core syntax of Qrisp, where you will learn to replace manual circuit building with high-level variables and implement textbook algorithms like Shor’s and Grover’s.
Optimization and Numerics: Explore how to solve combinatorial optimization problems in logistics and scheduling using hybrid approaches like QAOA, QIRO, and COLD, as well as learning about our qrispy Quantum Backtracking implementation.
High-Performance Compilation and Execution with Jasp: Learn how to scale your code, while estimating your quantum resources, for the real world using the Jasp pipeline for hybrid real-time control. You will also learn about optimizing for Fault-Tolerant compilation for next-generation hardware.
Scientific Computing and Quantum Numerical Linear Algebra: Dive into high-level abstractions for quantum chemistry, physics and linear systems (HHL, CKS, QSP) using our new BlockEncoding class.
If you’re the type who learns best by breaking things (and then fixing them), you can download any of these tutorials as a Jupyter notebook. Just look for the download box on the right side of the page within each specific tutorial to grab the code and run it in your own local environment.
By the end of these tutorial, you’ll have a solid foundation of our high-level framork and be ready to tackle more complex projects. So let’s get started!
Foundations and first steps#
Kickstart your quantum programming journey here! This section is designed to familiarize you with Qrisp’s core philosophy: shifting away from low-level circuit manipulation and toward intuitive, high-level programming using QuantumVariables. You will cover the absolute essentials, starting from your very first quantum script to implementing and understanding textbook algorithms like Grover’s, Quantum Phase Estimation, and Shor’s algorithm.
Getting familiar with Qrisp
Description
You will, well, get familiar with Qrisp. After being stimulated to replace thinking with quantum cirtuits with thinking with QuantumVariables, you’ll learn to solve a quadratic equation using Grover’s algorithm and get acquainted with Quantum Phase Estimation.
Factoring integers using Shor's algorithm
Description
This tutorial will guide you through our state-of-the-art implementation of Shor’s algorithm, allowing you to factor numbers and fiddle around encrypting and decrypting hidden messages.
Optimization and Numerics#
Discover how quantum algorithms can tackle complex search and optimization problems. In this section, you will dive into solving famous computational challenges (such as the Traveling Salesman Problem and Sudoku) using a versatile suite of quantum tools. Whether you are applying Quantum Backtracking, tuning variational models with QAOA and QIRO, or exploring Counterdiabatic Driving Protocols and Monte Carlo Integration, you will learn how to optimize solutions across a variety of real-world domains.
Solving the Traveling Salesman Problem
Description
You will set up a superposition of all routes, evaluate route distance, and create a Grover’s oracle to eventually evaluate it.
Solving combinatorial optimization problems with QAOA
Description
This tutorial will break down the theory behind this promising algorithm before implementing it for the MaxCut problem, the graph coloring problem, as well as providing a new constrained mixer type letting you reduce the search space! We also include tutorials on how to solve QUBO problems and portfolio rebalancing with QAOA. Disclaimer: the tutorial might or might not involve crayons.
Quantum-Informed Recursive Optimization
Description
Learn about a variational algorithm, that aims to adjust the given problem after each round of optimization. This tutorial will show you how to apply the theory to implement the algorithm and solve a Maximal Independent Set problem with it!
Counterdiabatic Driving Protocols
Description
This tutorial explains the concept of counterdiabatic driving and solves a QUBO problem with LCD (local counterdiabatic driving) and COLD (counterdiabatic optimized local driving).
Solving Sudoku using Quantum Backtracking
Description
You will learn how to efficiently implement the Sudoku problem specific quantum oracles, and how to use the general Quantum Backtracking implementation within Qrisp.
Quantum Monte Carlo Integration
Description
This tutorial will show you how to numerically calculate integrals with Quantum Monte Carlo Integration using Iterative Quantum Amplitude Estimation.
High-Performance Compilation and Execution with Jasp#
Scale your quantum algorithms to practically relevant problem sizes by bypassing Python’s performance bottlenecks. By targeting the MLIR toolchain and QIR specification, Jasp enables high-speed compilation and seamless real-time control—allowing classical logic to execute within the quantum coherence window. This is essential for hardware-efficient protocols like Gidney’s adder, error-correcting syndrome decoding or repeat-until-success protocols like HHL.
You will explore the Jasp pipeline for hybrid real-time control, learn how to build highly performant custom optimization algorithms, and delve into Fault-Tolerant compilation to ensure your code is ready for next-generation hardware. You’ll also discover how to leverage Jasp and the BigInteger class to compile and perform resource estimations for Shor’s algorithm at 2048 bit.
Hybrid real-time algorithm control with Jasp
Description
You will learn how this new compilation pipeline accelerates quantum algorithm compilation, and allows for hybrid real-time computations.
Building a QAOA implementation in Jasp
Description
This tutorial details how to build an efficient custom QAOA implementation in Jasp using a Jasp-traceable objective function for the example of the MaxCut problem.
Fault-Tolerant compilation
Description
This tutorial delves into the realm of compiling for fault-tolerant quantum devices, exploring the specialized techniques and considerations that set this stage apart from the compilation challenges encountered in NISQ environments. At the end you will also optimize the implementation of Shor’s from the tutorial above.
Using the BigInteger to compile Shor's algorithm at 2048 bit
Description
Learn how to use the BigInteger class to avoid integer overflow in Jasp and perform resource estimation of large-scale quantum algorithms.
Scientific Computing and Quantum Numerical Linear Algebra#
Unlock the potential of quantum computers for scientific discovery and advanced mathematics. Here, you will use Qrisp’s high-level abstractions to tackle problems in quantum chemistry, while having block encodings as a programming abstraction for quantum numerical linear algebra. From simulating molecular dynamics (like the \(H_2\) molecule) to solving systems of linear equations with the HHL algorithm and preparing ground states via quantum signal processing, this track demonstrates how to bridge the gap between complex scientific theory and executable quantum code.
Simulate the dynamics of the $H_2$ molecule
Description
This tutorial will show you how to leverage Qrisp’s advanced capabilities to perform molecular simulations on quantum computers.
Quantum Linear Algebra
Description
Use block encodings as programming abstractions to perform Quantum Linear Algebra using the numpy-like interface of our BlockEncoding class.
Eigenstate filtering using quantum signal processing
Description
Explore how to prepare the ground state by applying a Gaussian filter to enhance the overlap of the prepared state with the ground state using GQSP.
Solving systems of linear equations via HHL
Description
The Harrow-Hassidim-Lloyd (HHL) quantum algorithm offers an exponential speed-up over classical methods for solving linear system problems \(Ax=b\) for certain sparse matrices \(A\). The tutorial demonstrates hybrid quantum-classical workflows using the Catalyst framework and highlights how Qrisp and Catalyst work together for implementing and compiling advanced quantum algorithms.
You’ve now explored the breadth of what’s possible when you trade gate-level surgery for high-level logic. From your first QuantumVariable to fault-tolerant resource estimation, you have the roadmap to develop utility-scale applications that once seemed out of reach.
The quantum landscape is evolving rapidly. By mastering these utorials, you’re no longer just a spectator, you’re an architect of the next generation of algorithms. So, take these concepts, experiment, and start building the future of quantum computing with intuitive, clean, and qrisy code.