Block Encoding with Matrix Access Oracles
Overview
Block Encoding with Matrix Access Oracles
This PennyLane demo explains how to block encode a non-unitary matrix, embedding it as a sub-block of a larger unitary so that algorithms such as quantum phase estimation and the quantum singular value transformation can act on it even though quantum computers only perform unitary evolutions. It focuses on the matrix access oracle framework, in which a Hadamard transform, an oracle U_A that encodes matrix entries into an ancilla amplitude, and an oracle U_B that handles indexing combine to place the target matrix in the top-left block of the circuit unitary. The tutorial first builds the Fast Approximate BLock Encodings (FABLE) method of Camps and Van Beeumen, which replaces multi-controlled rotations with a sequence of single Ry rotations and CNOTs using a transformation of the matrix elements, and shows that small rotation angles can be pruned and redundant CNOTs cancelled to compress the circuit without losing accuracy for structured matrices. It then presents a second construction for sparse matrices following Camps, Lin, Van Beeumen, and Yang, encoding only the non-zero entries and implementing U_B with left and right shift operators. Both circuits are verified by comparing the encoded block against the original matrix. Block encoding is a foundational primitive underlying much of modern quantum algorithm design.
Run it
pip install -r requirements.txt
python demo.py
Source and license
Imported from demonstrations_v2/tutorial_block_encoding/demo.py in PennyLaneAI/demos at c52c0abeb5122218aa96b38eea848864cce7323f, under the Apache License 2.0. Original authors: Xanadu and the PennyLane community. The upstream LICENSE is included alongside this example.
This entry was created automatically from publicly available records. QCR links to public sources and only stores repository content where the license permits redistribution.
Versions
Cite all versions? Use the base QCR ID to always reference the latest version of this entry.
Join the Discussion
Comments (0)
No comments yet. Be the first to share your thoughts!