Fast Approximate Block Encoding Circuits
Project description
Fast Approximate BLock Encodings (FABLE)
FABLE can synthesize quantum circuits for approximate block-encodings of matrices. A block-encoding is the embedding of a matrix in the leading block of of a larger unitary matrix.
FABLE is a quantum representation for dense, unstructured matrices. The gate complexity of FABLE circuits scales linear in the number of matrix elements, which is optimal for the unstructured case. FABLE includes a circuit compression algorithm that can significantly reduce the gate complexity and works particularly well if there is certain structure available in the matrix to be block encoded.
We provide two reference implementations of the FABLE algorithm:
Qiskit - Python Implementation
FABLE can be installed from PyPI as follows:
pip install fable-circuits
After installation, it can be loaded and used as follows:
from fable import fable
import numpy as np
from qiskit import Aer
simulator = Aer.get_backend("unitary_simulator")
# generate a random matrix and block encode it
n = 3
N = 2**n
A = np.random.randn(N, N)
circ, alpha = fable(A, 0)
result = simulator.run(circ).result()
unitary = result.get_unitary(circ)
np.linalg.norm(alpha * N * unitary.data[0:N, 0:N] - A)/np.linalg.norm(A)
QCLAB - MATLAB Implementation
In order to run the MATLAB implementation of FABLE:
- Install QCLAB
- Clone FABLE and add
fable-qclab
directory to your MATLAB path.
After installation, FABLE can be run for a target matrix A
as either:
logging = true ;
[circuit, OA, alpha, info] = fable( A, 'cutoff', 1e-4, logging ) ;
[circuit, OA, alpha, info] = fable( A, 'percentage', 80, logging ) ;
The first option ('cutoff'
) ignores coefficients smaller than 1e-4
in absolute value, the second option
('percentage'
) applies an 80% compression and only retains the 20% largest coefficients. The 'percentage'
and logging
options are only available in the MATLAB version of FABLE.
Reference
Cite the following reference for FABLE:
FABLE: Fast Approximate Quantum Circuits for Block-Encodings, Daan Camps, Roel Van Beeumen, 2022.
Developers - Lawrence Berkeley National Laboratory
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
File details
Details for the file fable-circuits-0.1.tar.gz
.
File metadata
- Download URL: fable-circuits-0.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6620ec9c629463d1b8e377527f9e85f430df3dcfa06faba9b87f4ab59861030 |
|
MD5 | 9ae185ce8aac25fc264a728d5d546bb9 |
|
BLAKE2b-256 | 2848b66ccf70dd488af98ae5ffd295cca292451ca00948d993e85045d808b73d |
File details
Details for the file fable_circuits-0.1-py3-none-any.whl
.
File metadata
- Download URL: fable_circuits-0.1-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 563ee320ebb3e5d4707ecae863878b9b0d7a5c3c9854b8b52eecab003755e33d |
|
MD5 | 473f09ab6cc8d3cfde6ef928bdcc02cf |
|
BLAKE2b-256 | 900a1642cd774715e97bd45b7cf1bb9e24bbb33cb002fbd5e623a9792737d398 |