Giter Club home page Giter Club logo

qollage's Introduction

qoqo logo

qollage

Typesetting tool for the qoqo/roqoqo quantum toolkit by HQS Quantum Simulations.

This repository contains two components:

  • roqollage: the core rust library that builds on the roqoqo rust library.
  • qollage: the python interface to roqollage that uses the qoqo python interface.

This repository uses the Typst typesetting system with the quill package to create quantum circuits.

qollage

Documentation Status GitHub Workflow Status PyPI PyPI - Format Crates.io

Drawing tool for the qoqo quantum toolkit by HQS Quantum Simulations.

Qollage provides the save_circuit and draw_circuit functions that allows users to translate a qoqo circuit into a png image and either save it or display it.
These two functions will create a cache folder named .qollage containing fonts and Typst libraries in the current directory. You are free to delete it but the files will be downloaded again at the next use.
It also provides the circuit_to_typst_str that can be used to generate a string that can be copy pasted in the Typst interpreter if you want to edit the circuit further.
The latest qoqo gates might not be implemented in qollage yet. A circuit containing not supported operations can't be drawn and will result in an error.
If a gate has a string parameter it will be printed inside a typst mathematical expression and the typst symbols will be replaced.
Alphanumerical expressions will be preprocessed, if it doesn't represent any typst symbol it will be escaped by surrounding quotes.
qoqo.operations.RotateX(0, "theta") will be formatted as θ.
qoqo.operations.RotateX(0, "param") will be escaped with quotes and kept as it is.
qoqo.operations.RotateX(0, "\"param\"") will not be accepted because the extra quotes will interfere with the quotes added to escape param.
For more informations see the documentation.
Here is the list of symbols but be aware that not all of them are supported by the font used.

Example:

In a jupyter cell:

from qoqo import Circuit, operations as ops
from qollage import draw_circuit

circuit = Circuit()
circuit += ops.DefinitionBit("ro", 2, True)
circuit += ops.Hadamard(0)
circuit += ops.CNOT(0, 1)
circuit += ops.PauliX(1)
circuit += ops.RotateX(0, "theta")
circuit += ops.MeasureQubit(0, "ro", 0)
circuit += ops.MeasureQubit(1, "ro", 1)

draw_circuit(circuit)

It will output:

Example

roqollage

Crates.io GitHub Workflow Status docs.rs Crates.io

Typesetting tool for the roqoqo quantum toolkit by HQS Quantum Simulations.

roqollage provides the circuit_to_image function that allows users translate a roqoqo circuit into a DynamicImage of the circuit's representation.
Not all roqoqo operations have a corresponding Typst expression.
Circuits containing operations without a corresponding expression can not be translated.

General Notes

This software is still in the beta stage. Functions and documentation are not yet complete, can contain bugs and breaking changes can occur.

Known issue

If there are many gates that are represented by a slice the slice label might overlap or there might be some gaps between the slices.
If there is a gate represented by a slice inside a circuit used in a gate (example: PragmaLoop) the slice will go through all the qubits not only the ones used by the gate' circuit. Issues mentionned in the first line also applies here.

Contributing

We welcome contributions to the project. If you want to contribute code, please have a look at CONTRIBUTE.md for our code contribution guidelines.

qollage's People

Contributors

dberthault avatar kbarkhqs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.