Skip to main content

Linear algebra on quantum computers using block encodings

Project description

unitaria :rainbow:

unitaria is a library for working with so called "block encodings" of matrices and vectors. These are format for performing linear algebra calculations on quantum computers. It allows constructing quantum algorithms using a simple, numpy-like syntax.

>>> import unitaria as ut
>>> import numpy as np
>>> result = ut.Identity(ut.Subspace.from_dim(2)) @ ut.ConstantVector(np.array([3, 4]))
>>> print(result.draw())
Mul
├── Identity{'subspace': Subspace("#")}
└── ConstantVector{'vec': array([3, 4])}
>>> result.toarray().real
array([3., 4.])
>>> result.normalization
np.float64(5.0)
>>> result.circuit()
Circuit(_tq_circuit=circuit: 
GlobalPhase(target=(), control=(), parameter=0.0)
Ry(target=(0,), parameter=1.854590436003224)
, n_qubits=1)

Documentation

Installation

The best way to install this library is using pip:

pip install unitaria

This installs everything needed to work with unitaria, including the simulation backend qulacs. Additional backends compatible with tequila, which is used for communcating with the backends, can also be installed, see tequila.

Python versions

unitaria requires at least Python version 3.12, and follows Numpy's deprecation policy, i.e. at least Python 3.13 will be required starting April 2027.

Versioning

Unitaria follows SemVer conventions.

Development

To install this library locally, clone this repository and run

pip install --editable .

To run the test suite you can then execute

pytest

To build the documentation, some additional dependencies are required, which can be installed using

pip install --group docs --editable .

Then navigate to the /docs folder and run

rm -r generated
make html

If you get the error locale.Error: unsupported locale setting, try adding the environment variable LC_ALL=C.UTF-8:

LC_ALL=C.UTF-8 make html

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unitaria-0.1.0.tar.gz (44.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unitaria-0.1.0-py3-none-any.whl (70.3 kB view details)

Uploaded Python 3

File details

Details for the file unitaria-0.1.0.tar.gz.

File metadata

  • Download URL: unitaria-0.1.0.tar.gz
  • Upload date:
  • Size: 44.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for unitaria-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7e8f3c6fa0dec3a3ed18e75a13c6fd7dcae4331242f8dbbe404cba679f6732bd
MD5 05ca51a1966a21a92c41c9424e16775a
BLAKE2b-256 718e550f0e128f7486b323c4c0829cfeea656aea51e58a8008d89b2ca99f918a

See more details on using hashes here.

File details

Details for the file unitaria-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: unitaria-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 70.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for unitaria-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5605d849e1b022f2ee9eaf078490e7531544cadd22eed59cd14871bc469adb9
MD5 76e04191403879bb56e57bd7b8d63cd0
BLAKE2b-256 098571dce396736e944b3e9c2732017a940f6a7c31b085ef9cb3c2bb463fc9e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page