Skip to main content
Create your own
Lesson illustration

Block-Encoding Sparse Hamiltonians

Hello! Welcome to our next lesson on recent advances in quantum computing.

Introduction

In our previous lesson, we explored the Linear Combination of Unitaries (LCU) lemma. We saw that it provides a powerful, abstract framework for implementing an operator by block-encoding it into a larger unitary matrix. This method relies on the existence of two oracles, UPrep and USelect, but we didn't delve into how one might construct the full block-encoding unitary for a given non-unitary matrix .

Today, we bridge that gap. We will move from the abstract concept to the concrete engineering of a quantum circuit. Our focus will be on the learning outcome: Construct a block-encoding circuit for a simple sparse Hamiltonian.

This is a crucial skill, as many problems in physics, chemistry, and optimization involve sparse Hamiltonians. We will learn a general recipe for this construction and see how the structure of the matrix dictates the structure of the quantum circuit. Specifically, we will cover:

  1. A general theorem for block-encoding any -sparse matrix.
  2. The decomposition of the block-encoding circuit into two primary components: an oracle for the matrix's sparsity structure (Oc) and an oracle for its numerical values (OA).
  3. A detailed construction of these oracles for a second-quantized Hamiltonian, a context that should be familiar from your background in physics.

This lesson builds directly on our understanding of block-encoding from LCU and sets the stage for our next topic, Quantum Signal Processing, which uses these block-encoding circuits as a fundamental building block.

1. The General Recipe for Block-Encoding Sparse Matrices

The core idea behind block-encoding a sparse matrix is to create a unitary circuit that can, in superposition, perform two tasks: (1) locate the non-zero elements of the matrix, and (2) embed their values into the amplitudes of an ancilla qubit.

A general and elegant method for achieving this is laid out in the following theorem.

explicit quantum circuits for block encodings of certain ...

Let's begin with the general strategy for block-encoding sparse matrices. The paper 'explicit quantum circuits for block encodings of certain ...' by Lin and Tong provides a clear theorem and circuit diagram for this.

Please read Section 4, 'Efficient quantum circuits for block encodings of s-sparse matrices', focusing on Theorem 4.1 and its proof (pages 6-7). Pay attention to the definitions of the oracles Oc (Eq. 4.2) and OA (Eq. 4.3), and the overall circuit structure in Fig. 5.

Let's summarize the key components from the reading. For an -sparse matrix (where we assume for simplicity), we can construct a block encoding for using a circuit with ancilla qubits. The circuit, shown in the paper's Figure 5, relies on two oracles:

  • Oc (Oracle for Columns/Structure): This unitary encodes the sparsity pattern of the matrix. It takes a column index and an integer and computes the row index of the -th non-zero entry in column .

    The function is a classical function that describes the locations of the non-zero entries.

  • OA (Oracle for Amplitudes/Values): This unitary encodes the value of the matrix element into the state of a single ancilla qubit, typically via a controlled rotation.

    Note that for this to be a valid unitary operation, the matrix must be scaled such that all its elements have a magnitude less than or equal to 1.

The full block-encoding unitary is then constructed by sandwiching these oracles between diffusion operators (which are just layers of Hadamard gates on the ancilla register used for ):

The operators create a uniform superposition over all possible non-zero indices , the oracles act on this superposition, and the final interferes the paths to yield the desired matrix element in the final measurement.

2. Constructing the Oracles for a Sparse Hamiltonian

The general recipe is powerful, but its efficiency depends entirely on our ability to construct efficient circuits for Oc and OA. Let's see how this is done for a physically motivated example: a second-quantized pairing Hamiltonian.

Your background in physics and theoretical modeling will be helpful here. We'll be working with creation () and annihilation () operators acting on a Fock space, where basis states are represented by bitstrings indicating the occupation of single-particle states.

An Efficient Quantum Circuit for Block Encoding a Pairing ...

Now, let's apply this recipe to a second-quantized pairing Hamiltonian. The paper 'An Efficient Quantum Circuit for Block Encoding a Pairing ...' provides an excellent, detailed construction. It uses slightly different notation (OC and OH instead of Oc and OA), but the underlying principle is identical.

Please read Section 4, 'Block encoding circuit' (pages 6-13). Pay close attention to: Section 4.1: How the action of creation/annihilation operators defines the sparsity structure c(j, l) as a conditional bit-swap, and how this is implemented in the OC circuit (Fig. 5). Section 4.2: How the OH circuit uses controlled rotations to encode the matrix element values (Fig. 8 & 9). Section 4.3: How these components are assembled into the complete block-encoding circuit (Fig. 10) and the verification in Eq. (37).

Let's distill the core construction logic from the paper.

The Structure Oracle (OC)

The Hamiltonian is a sum of terms like . In the Fock basis (represented by bitstrings), the operator has a very specific action:

  • It gives a non-zero result only if it acts on a basis state where single-particle state is occupied () and state is unoccupied ().
  • When this condition is met, the resulting state, , is the state where the occupations have been swapped: state becomes unoccupied and state becomes occupied.

This gives us a direct prescription for the function , where now indexes the pair . The function is simply a conditional SWAP of the bits at positions and in the bitstring representation of state .

As shown in Figure 6 of the paper, the OC circuit implements this logic using multi-controlled SWAP gates. The controls check two things simultaneously:

  1. The ancilla qubits are in the state corresponding to the term .
  2. The main register qubits for the state satisfy the occupation condition ( and ).

The Value Oracle (OH)

The OH oracle's job is to encode the coefficient associated with the term . This is done using a controlled rotation.

  • The circuit applies a rotation to a fresh ancilla qubit.
  • The rotation is controlled by the ancilla qubits that select the term .
  • The angle is chosen such that the rotation produces the desired amplitude, e.g., if the matrix is appropriately scaled.

Figure 8 in the paper shows exactly this: a multi-controlled gate where the controls are on the "selection qubits" that encode .

The Complete Circuit

As shown in the figure above (Fig. 10 from the paper), the full circuit assembles these pieces in the order prescribed by the general theorem: Ds, then OH (which is OA), then OC, and finally Ds again. The paper's verification in Eq. (37) confirms that the top-left block of this unitary is indeed , just as we expect.

A Note on Hermitian Block Encodings

The construction we just studied produces a valid block encoding, but the resulting unitary matrix is not, in general, Hermitian, even if the original matrix was. For some applications, like quantum walks or certain versions of QSP, it is advantageous to have a Hermitian block encoding.

This requires a slightly different, more symmetric circuit structure, as detailed in Section 8 of the paper "explicit quantum circuits for block encodings of certain..." (4e0ad). This alternative construction involves applying Oc, then a SWAP gate, then O, which guarantees the final unitary is Hermitian. This is an important variation to be aware of, demonstrating that there can be multiple ways to block-encode a matrix, each with different properties.

Conclusion

In this lesson, we have moved from the abstract definition of block-encoding to a concrete, constructive procedure for sparse matrices, particularly for physically motivated Hamiltonians.

Key Takeaways:

  • Any -sparse matrix can be block-encoded using a circuit built from two oracles: Oc for the sparsity structure and OA for the element values.
  • For second-quantized Hamiltonians, the Oc oracle can be implemented with controlled-SWAP gates that mimic the action of creation/annihilation operators on the Fock basis.
  • The OA oracle is typically implemented with multi-controlled rotation gates that encode the Hamiltonian's coefficients into quantum amplitudes.
  • The complexity and feasibility of block-encoding a matrix are determined by the complexity of constructing these oracles, which is directly related to the matrix's structure.

Preview of the Next Lesson

We now have a powerful tool in our arsenal: a method to construct a unitary circuit that "contains" a Hamiltonian . But how do we use to perform a task like simulation, i.e., to implement ?

Our next lesson, Analyze the principles of Quantum Signal Processing (QSP) for applying polynomial transformations to a block-encoded matrix, will answer this question. We will see how a clever sequence of single-qubit rotations applied to an ancilla qubit can transform into a block encoding of any polynomial of , providing a highly efficient and precise path to Hamiltonian simulation and other advanced algorithms.

Can't find a good explanation? Sign up and we'll make it for you

Sign up