Skip to main content

QFrame package for quantum calculations

QFrame is a Python library layered over Eclipse Qrisp, which enables you to search for solutions to equations of the form $g(x, y, z)=(x_t, y_t, z_t)$.

The library provides operations to define the function of interest $g(x, y, z)$ and then applies the partial oracle search algorithm to find the solution values $x_s, y_s, z_s$ that satisfy $g(x_s, y_s, z_s)=(x_t, y_t, z_t)$ for the given target values $x_t, y_t, z_t$.

QFrame forms part of an ongoing research project into exponentially fast quantum algorithms and is currently in a very early stage of development with limited functionality. The set of function and operations provided in the 0.0.x release are only capable of defining functions $g(\cdot)$ that are classically reversible, so that no quantum advantage is demonstrated. The next phase of research will attempt to extend QFrame's functionality to cover non-trivial functions that are difficult to invert.

Using the QFrame library

The qframe.QFrameUInt type provides an abstract representation of the qubit registers and QFrame provides a limited set of functions and operations for combining QFrameUInt instances.

The following operations and functions are provided by QFrame:

  • $\mathrel{+}=$ operation—defines in-place addition modulo $2^w$, where $w$ is the bit-width of the QFrameUInt arguments. The following cases are supported:

    • Given QFrameUInt instances $x$ and $y$, the operation $x \mathrel{+}= y$ implements $P\ket{x}\ket{y} = \ket{x+y}\ket{y}$.
    • Given a QFrameUInt instance $x$ and an integer constant $c$, the operation $x \mathrel{+}= c$ implements $\ket{x}\mapsto\ket{x+c}$.
    • Given a QFrameUInt instance $x$ and a temporary function $t(y)$, such that $V\ket{y} = \ket{t(y)}$, the operation $x \mathrel{+}= t(y)$ implements $V^\dagger PV \ket{x}\ket{y} = \ket{x + t(y)}\ket{y}$.
  • qframe.maj(a, b, c)—defines the majority function $Maj(a, b, c)$, where $a$, $b$, and $c$ are $w$-bit registers. The maj(a, b, c) function is a temporary function, in the sense that it does not permanently change the values of registers $a$, $b$, and $c$. It is intended to be used on the right-hand side of a $\mathrel{+}=$ expression.

  • qframe.ch(a, b, c)—defines the choose function $Ch(a, b, c)$, where $a$, $b$, and $c$ are $w$-bit registers. The ch(a, b, c) function is a temporary function, in the sense that it does not permanently change the values of registers $a$, $b$, and $c$. It is intended to be used on the right-hand side of a $\mathrel{+}=$ expression.

  • qframe.Rotr class—can be used to define shift operator instances. For example, r = qframe.Rotr(4, [0, 1], shr_list=[3]) defines a 4-bit wide shift operator of type $\mu=(0,1)(3)$. The r.shift_inline(x) method can then be invoked to apply the shift function to register $x$. If you need to add the result of a shift operation to another register in a $\mathrel{+}=$ expression, you should invoke r.shift(x), which acts as a temporary function (leaving register $x$ unchanged after the addition operation).

This utility provides all of the operations and functions you would need to implement the SHA-256 algorithm. After defining an algorithm with QFrame, the QFrameSession object provides access to the following generated methods:

  • QFrameSession.calculate(input_args)—implements the classical function $g(\cdot)$, taking the given input_arg values for the registers and returning the values of the registers after calculating $g(\cdot)$.

  • QFrameSession.apply_oracle_gate(target_dict)—generates the circuit of the oracle function, where the relevant target values are specified by the target_dict argument.

  • QFrameSession.apply_recip_oracle_gate()—generates the circuit for the reciprocal oracle function, $R[f(\cdot)]$.

  • QFrameSession.partial_oracle_iteration(target_dict)—generates complete code for the partial oracle algorithm (except for the initialization of the qubit registers).

Examples

A set of working examples are available from the following GitHub repository:

https://github.com/bradan-quantum/qframe-examples

Running unit tests

Use hatchling to run unit tests (based on pytest):

hatch test

To see the output from print statements while running the tests, enter:

hatch test --capture=no

Metadata

Release files for qframe 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qframe 0.0.7
File Size Uploaded
qframe-0.0.7.tar.gz 18.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qframe 0.0.7
File Interpreter ABI Platform
qframe-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 40.7 kB

Release files / qframe-0.0.7.tar.gz

Download URL qframe-0.0.7.tar.gz
Size 18.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e30a2d523e12f6af03b2f5dcc2715ce092e49205c784b6362333500bc4f88057
BLAKE2b-256 checksum
How to use checksums
2818c705db356ce393558d06340d339298436e1ad915b8e076a3dc915df39dd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.

Transparency log

Release files / qframe-0.0.7-py3-none-any.whl

Download URL qframe-0.0.7-py3-none-any.whl
Size 22.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28dc8b6f016a5a5f06a4f3405a1343af4a23cae6dc88470e88095c0143d5afc8
BLAKE2b-256 checksum
How to use checksums
00f0de736963c129dd18c149f1ddf4c8ce3df25d85b69f88f12687e95b889855
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.5

2 release files

0.0.3

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page