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)
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e8f3c6fa0dec3a3ed18e75a13c6fd7dcae4331242f8dbbe404cba679f6732bd
|
|
| MD5 |
05ca51a1966a21a92c41c9424e16775a
|
|
| BLAKE2b-256 |
718e550f0e128f7486b323c4c0829cfeea656aea51e58a8008d89b2ca99f918a
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5605d849e1b022f2ee9eaf078490e7531544cadd22eed59cd14871bc469adb9
|
|
| MD5 |
76e04191403879bb56e57bd7b8d63cd0
|
|
| BLAKE2b-256 |
098571dce396736e944b3e9c2732017a940f6a7c31b085ef9cb3c2bb463fc9e2
|