Skip to content

PsiQ/workbench-quantum-katas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

The Quantum Katas are a collection of self-paced tutorials and programming problems to help you learn fault-tolerant quantum computing and PsiQDK programming.

Prerequisites

To use the Quantum Katas, you need to install PsiQuantum Quantum Development Kit, the Python toolkit for developing fault-tolerant quantum algorithms. You can find the complete installation guide and requirements in PsiQDK documentation.

You'll also need to install scipy for several of the advanced katas.

pip install psiqdk scipy

User workflow

Each kata is a Jupyter Notebook that includes the theory on one topic, interspersed with demos and programming problems designed to help you practice and internalize this topic.

You can run demos to see the results of their execution and modify them to check your understanding of how the outputs will change. Demos don't affect the verification of programming problems solutions, though you can use functions defined in demos as part of your solution if you want to.

Each programming problem offers the problem description, followed by a Python code cell which provides the signature of the function you need to implement. Your goal is to fill the blank (marked with ...) with Python code that solves the problem.

You can define helper functions outside the given function if you need to. You shouldn't modify the signature of the given function in a way that would make it impossible to call it with the original signature, for example, by adding required arguments.

Once you have written the code, you can verify it by executing the code cell. The @problem decorator will call the test that covers this problem and show you the results.

If you can't come up with a solution on your own, you can look up the explained solutions in the workbook file in the same folder - a Jupyter Notebook that includes theoretical explanations of the solutions and any details of code implementations that might not be obvious for a first-time user, as well as Python code cells with reference solutions to each problem.

Learning path

Single-qubit systems

Multi-qubit systems

Quantum oracles and simple oracle algorithms

  • Quantum oracles. Learn to implement classical functions as equivalent quantum oracles.
  • Marking oracles. Practice implementing marking oracles for a variety of classical functions.
  • Deutsch algorithm. Learn Deutsch algorithm - the simplest algorithm relying on quantum oracles.
  • Deutsch–Jozsa algorithm. Learn about Bernstein–Vazirani and Deutsch–Jozsa algorithms.

Grover's search algorithm

Building up to Shor's algorithm

Quantum chemistry

Miscellaneous

Developer workflow

To add a new problem to the kata, for example, a problem called "Oracle 123" in the Marking Oracles kata, you need to:

  1. Add the problem description and function template to the main notebook (MarkingOracles.ipynb). The function name should match the problem title and follow the naming patterns and signature style of previous problems in the kata (oracle_123).
  2. Add the solution description and code cell with the "reference solution" to the workbook (Workbook_MarkingOracles.ipynb). The reference solution should have the same name as the function in the main notebook (oracle_123). Notice that the workbooks don't use the @problem decorator; to run the test on the reference solution, you need to copy it to the main notebook or use pytest.
  3. Add the test to the Python file with the testing harness (test_MarkingOracles.py). The test should have the same name as the function in the main notebook with a prefix test_ (test_oracle_123). It should take the solution function as the argument with the reference solution as the default value (see examples of existing tests for the syntax). The actual solution will be provided to the test via the @problem decorator; the default value is used for testing all reference solutions via pytest.
  4. Verify that the empty function template fails the test and the reference solution passes it. You can do that by copying the reference solution from the workbook to the main notebook by hand and executing the code cell. Alternatively, you can test all reference solutions at once using pytest. To do this, you need to install the package importnb (pip install importnb) and run pytest in the kata folder. If this package is not installed, pytest will skip testing, since this package is used to import the reference solutions from the workbook.

Getting help and contributing

At this point, the Quantum Katas project is in open development, but there is no easy way for us to accept major external contributions. We are working towards bringing it into full open source mode.

In the meantime, we welcome bug reports and discussions! Please file an issue to report a bug, or start a discussion to ask a question or discuss a topic.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors