Skip to content

Commit

Permalink
fixed some mistakes in the changelog and improved the sudoku tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
positr0nium committed Feb 16, 2024
1 parent facd54c commit a6e710a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
18 changes: 9 additions & 9 deletions documentation/source/general/changelog/0.4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The latest update of Qrisp is (once again) the biggest (so far)! We integrated a
Shor's Algorithm and modular arithmetic
---------------------------------------

With 0.4 we integrated the infrastructure to facility the implementation and compilation of Shor's algorithm. Most notably:
With 0.4 we integrated the infrastructure to facilitate the implementation and compilation of Shor's algorithm. Most notably:

* The :ref:`QuantumModulus` quantum type, which allows you to utilize modular arithmetic in your algorithms with a minimal amount of knowledge of the `underlying circuits <https://arxiv.org/abs/1801.01081>`_.
* Furthermore, we implemented the :meth:`qcla <qrisp.qcla>` introduced by `Wang et al <https://arxiv.org/abs/2304.02921>`_. The previously mentioned arithmetic can be adapted to use this adder (or any other adder for that matter!).
Expand All @@ -26,7 +26,7 @@ As we found out, implementations of Shor's algorithm that are able to return a Q
.. image:: 04_shor_plot.svg

This demonstrates how powerful the Qrisp version is compared to other compilers/implementations. The presented values for the are averaged over several choices of $a$ per $N$. T-depth and T-count are computed under the (extremely optimistic) assumption that parametrized phase gates can be executed in unit time and unit cost. Without this assumption the Qrisp implementation brings a speed-up of almost 3 orders of magnitude!
This demonstrates how powerful the Qrisp version is compared to other compilers/implementations. The presented values are averaged over several choices of $a$ per $N$. T-depth and T-count are computed under the (extremely optimistic) assumption that parametrized phase gates can be executed in unit time and unit cost. Without this assumption the Qrisp implementation brings a speed-up of almost 3 orders of magnitude!


Compiler upgrades
Expand All @@ -37,7 +37,7 @@ The :meth:`compile <qrisp.QuantumSession.compile>` function received two importa
* Due to another topological ordering step, this function can now reduce the depth in many cases by a significant portion with minimal classical performance overhead.
* It is now possible to specify the time each gate takes to optimize the overall run time in a physical execution of the quantum circuit. Read more about this feature :ref:`here <gate_speed_aware_comp>`. This especially enables compilation for fault tolerant backends, as they are expected to be bottlenecked by T-gates.

This plot highlights how the Qrisp compiler evolved compared to the last version (and it's competitors). It shows the circuit depth (as acquired with :meth:`depth <qrisp.QuantumCircuit.depth>`) for the QAOA algorithm applied to a MaxCut problem. We benchmarked the code that is available as tutorial.
This plot highlights how the Qrisp compiler evolved compared to the last version (and its competitors). It shows the circuit depth (as acquired with :meth:`depth <qrisp.QuantumCircuit.depth>`) for the QAOA algorithm applied to a MaxCut problem. We benchmarked the code that is available as tutorial.

.. image:: 04_compiler_plot.svg

Expand All @@ -50,25 +50,25 @@ Algorithmic primitives
We added the following algorithmic primitives to the Qrisp repertoire:

* :meth:`amplitude_amplification <qrisp.amplitude_amplification>` is an algorithm, which allows you to boost the probability of measuring your desired solution.
* :meth:`QAE <qrisp.QAE>` gives you an estimate of the amplitude of a certain sub-space without having to perform a possibly exponential amount of measurements.
* :meth:`QAE <qrisp.QAE>` gives you an estimate of the probability of measuring your desired solution.
* The ``gidney`` and ``jones`` methods for compiling :meth:`mcx <qrisp.mcx>` gates with optimal T-depth in a fault-tolerant setting.
* The :meth:`gidney_adder <qrisp.gidney_adder>` as documented `here <https://arxiv.org/abs/1709.06648>`_.

QUBO optimization
-----------------

QUBO is short for Quadratic Uncostrained Binary Optimization and a problem type, which captures a `large class of optimization problems <https://arxiv.org/abs/1302.5843>`_. QUBO instances can now be :ref:`solved within the QAOA module <QUBOQAOA>`.
QUBO is short for Quadratic Unconstrained Binary Optimization and a problem type, which captures a `large class of optimization problems <https://arxiv.org/abs/1302.5843>`_. QUBO instances can now be :ref:`solved within the QAOA module <QUBOQAOA>`.

Simulator
---------

The Qrisp simulator received multiple powerfull performance upgrades such as a much faster sparse matrix multiplication algorithm and better statevector factoring. These upgrades facility the simulation of extremely large circuits (in some cases, we observed >200 qubits)!
The Qrisp simulator received multiple powerful performance upgrades such as a much faster sparse matrix multiplication algorithm and better statevector factoring. These upgrades facilitate the simulation of extremely large circuits (in some cases, we observed >200 qubits)!


Network interface
-----------------

For remote backend queries, Qrisp now uses the network inteface developed in the `SequenC project <https://sequenc.de/>`_. This project aims to build a uniform, open-source quantum cloud infrastructure. Note that specific backend vendors like IBMQuantum can still be called via :ref:`VirtualBackends <VirtualBackend>`.
For remote backend queries, Qrisp now uses the network interface developed in the `SequenC project <https://sequenc.de/>`_. This project aims to build a uniform, open-source quantum cloud infrastructure. Note that specific backend vendors like IBMQuantum can still be called via :ref:`VirtualBackends <VirtualBackend>`.

Docker Container
----------------
Expand All @@ -90,9 +90,9 @@ Bug-fixes
---------

* Fixed a bug that caused false results in some simulations containing a Y-gate.
* Fixed a bug that prevented proper QFT cancelation within the :meth:`compile <qrisp.QuantumSession.compile>` method in some cases.
* Fixed a bug that prevented proper QFT cancellation within the :meth:`compile <qrisp.QuantumSession.compile>` method in some cases.
* Fixed a bug that prevented proper verification of correct automatic uncomputation in some cases.
* Fixed a bug that caused false determination of the unitary of controlled gates with a non-trivial control state.
* Fixed a bug that caused problems during circuit visualisation on some platforms.
* Fixed a bug that caused the simulation progressbar to not vanish after the simulation concluded.
* Fixed a bug that caused the simulation progress bar to not vanish after the simulation concluded.
* Fixed a bug that introduced an extra phase in the compilation of dirty-ancillae supported ``balauca`` MCX gates.
15 changes: 15 additions & 0 deletions documentation/source/general/tutorial/Sudoku.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Solving Sudoku using Quantum Backtracking
=========================================
.. _sudoku:

This tutorial is the practical hands on-part of `this paper <https://arxiv.org/abs/2402.10060>`_.

Sudoku
------

Expand All @@ -13,6 +15,16 @@ Sudoku puzzles come in various difficulty levels, ranging from easy to extremely

Over the years, Sudoku has evolved into a beloved pastime for enthusiasts of all ages, offering a stimulating mental exercise that promotes concentration, critical thinking, and problem-solving skills. Whether played casually in newspapers, puzzle books, or digital platforms, Sudoku continues to captivate individuals worldwide with its timeless appeal.

In our case, we will be working with 4x4 Sudoku mostly because we want to keep the results still simulable. A 9x9 or even 16x16 implementation would of course however equally well.

|
.. image:: ./sudoku.png
:width: 400
:alt: Sudoku
:align: center


Backtracking
------------

Expand Down Expand Up @@ -105,6 +117,8 @@ for the algorithm to function properly:
* Both functions must delete/uncompute all temporarily created QuantumVariables.
* ``accept`` and ``reject`` must never return ``True`` on the same node.

More details for the Qrisp interface to quantum backtracking (including visualisation features) kann be found :ref:`here <QuantumBacktrackingTree>`.

Quantum backtracking for solving a Sudoku puzzle
------------------------------------------------

Expand Down Expand Up @@ -741,6 +755,7 @@ Note that, in order to achieve a speed-up in practical scenarios, it is necessar

sol = tree.find_solution(precision = 3)
print(sol[::-1][1:])
# Yields [1, 1, 2]

With this, we can find the solution for Sudoku problems with up to 3 empty fields with the statevector simulator on our local computer. For instances with more empty fields, we can still find the solution with a matrix product state simulator that can be employd with the ``measurement_kwargs`` keyword.

Expand Down
Binary file added documentation/source/general/tutorial/sudoku.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a6e710a

Please sign in to comment.