lcu

Apply a weighted sum of unitaries to a quantum state via PREPARE and SELECT circuits.

30|2|Updated Apr 16, 2026
One-click install
npx skills add https://github.com/unitarylab/quantum-skills --skill lcu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lcu
Source: https://github.com/unitarylab/quantum-skills/tree/main/algorithms/linear-systems/lcu
Command: npx skills add https://github.com/unitarylab/quantum-skills --skill lcu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires numpy, and includes scripts (resource) components.

What problem does it solve?

Efficiently apply a weighted sum of unitaries to a quantum state by constructing a PREPARE circuit on an ancilla register and using a SELECT operator, enabling access to non-unitary operations through probabilistic post-selection.

Core Features & Use Cases

  • Encodes weights alpha_j into ancilla amplitudes via a state-preparation tree and Ry/McRy gates.
  • Implements the SELECT operator as a multiplexed application of U_j conditioned on ancilla basis states.
  • Acts as a building block for quantum linear solvers, Hamiltonian simulation, and subroutines like QSP/QSVT.

Quick Start

Initialize alphas and unitaries, then run the LCU algorithm to apply the weighted sum of unitaries to your system.

Frequently Asked Questions about lcu

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I apply a weighted sum of unitaries to a quantum state?

To apply a weighted sum of unitaries to a quantum state, you use the LCU method. It encodes weights into an ancilla register via a PREPARE circuit and applies operators conditionally using a SELECT workflow to realize the operation.

What is the PREPARE SELECT UNPREPARE workflow in quantum linear solvers?

The PREPARE SELECT UNPREPARE workflow is an LCU technique for quantum linear solvers. PREPARE encodes coefficients into an ancilla register, SELECT multiplexes unitary applications, and UNPREPARE disentangles the ancilla to enable non-unitary operations via post-selection.

How do I implement amplitude encoding for quantum algorithms using an ancilla register?

You implement amplitude encoding by constructing a state-preparation tree on an ancilla register using Ry and McRy gates. This encodes specified weights into ancilla amplitudes for subsequent controlled multiplexed unitary applications.

Can I use LCU for Hamiltonian simulation and QSVT subroutines?

Yes, LCU works for Hamiltonian simulation and QSVT subroutines. By applying a weighted sum of unitaries through controlled multiplexed applications, it serves as a foundational building block across common quantum software stacks.

Do I need controlled unitaries and normalization for quantum linear-system solving?

Yes, quantum linear-system solving with LCU requires controlled unitaries, a properly sized ancilla register, and a normalization factor equal to the sum of your weights. These ensure amplitude encoding and post-selection function correctly.

What are the limitations of using LCU for non-unitary operations in quantum circuits?

The primary limitation of LCU for non-unitary operations is reliance on probabilistic post-selection. You must successfully disentangle the ancilla register and measure the correct state, which introduces inherent success probability and potential overhead.