Skip to main content

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:

  • a Python implementation built on top of Qiskit
  • a MATLAB implementation built on top of QCLAB

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:

  1. Install QCLAB
  2. 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 2022 IEEE International Conference on Quantum Computing and Engineering (QCE), arXiv:2205.00081.

Developers - Lawrence Berkeley National Laboratory

About

FABLE Copyright (c) 2022, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.

If you have questions about your rights to use or distribute this software, please contact Berkeley Lab's Intellectual Property Office at IPO@lbl.gov.

NOTICE. This Software was developed under funding from the U.S. Department of Energy and the U.S. Government consequently retains certain rights. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, distribute copies to the public, prepare derivative works, and perform publicly and display publicly, and to permit others to do so.

Project details


Download files

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

Source Distribution

fable-circuits-0.1.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

fable_circuits-0.1.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file fable-circuits-0.1.1.tar.gz.

File metadata

  • Download URL: fable-circuits-0.1.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for fable-circuits-0.1.1.tar.gz
Algorithm Hash digest
SHA256 55d4dcd2aa0a9daa7a1a76c74b17cbdee4ed6ce5183977c0219017411c763979
MD5 b021f75e100bbb9202d0e30aa1415089
BLAKE2b-256 be036c0c242097b2f9815a3c4739a096f7ae30a3de353bed580970e26ca21f9b

See more details on using hashes here.

File details

Details for the file fable_circuits-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fable_circuits-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 459badb5f4eb5adfd584216187793fa9051b8910df342db1746b077e0f383e0e
MD5 8b563e28001bcfb4ad5a6d8c902809b1
BLAKE2b-256 6482c9e517791656f32da356d1f1c08d3de48fece44f163418abdf2d20594c75

See more details on using hashes here.

Supported by

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