Skip to content

Tutorial 03 Non Unitary Computing

Mohammadreza Khellat edited this page Dec 16, 2025 · 1 revision

Tutorial 03: Non-Unitary Quantum Computing (LCU)

Linear Combination of Unitaries (LCU) implementation for non-unitary operations.


Overview

This tutorial demonstrates how to represent and manipulate non-unitary operations using Linear Combination of Unitaries (LCU) decomposition. You'll learn to implement a $2 \times 2$ non-unitary matrix using SELECT and PREPARE operators, enabling quantum circuits to perform non-unitary operations.

Location: nonunitary_quantum_computing/
Notebook: lcu_2x2.ipynb
Framework: Classiq
Difficulty: 🟡 Intermediate
Estimated Time: 2-3 hours


Learning Objectives

By completing this tutorial, you will be able to:

  1. Understand LCU decomposition for non-unitary operators
  2. Implement SELECT and PREPARE operators for LCU
  3. Decompose matrices into Pauli terms for quantum implementation
  4. Apply non-unitary operations using quantum circuits
  5. Recognize applications of LCU in quantum algorithms

Prerequisites

Required Knowledge

  • Quantum Circuits:

    • Quantum gates and operations
    • Controlled operations
    • Quantum state manipulation
  • Linear Algebra:

    • Matrix operations
    • Pauli matrices ($I, X, Y, Z$)
    • Matrix decomposition
  • Quantum Computing Concepts:

    • Unitary vs non-unitary operations
    • Quantum measurement
    • Expectation values

Recommended Background

  • Tutorial 00 or 02: Quantum circuit design experience
  • Classiq Framework: Familiarity with Classiq (helpful but tutorial is self-contained)
  • Advanced Quantum Algorithms: Understanding of quantum algorithm design

Prior Tutorials

  • Recommended: Tutorial 00 (QFT) or Tutorial 02 (Quantum Walk)
  • Builds on: Quantum circuit design skills
  • Advanced technique: Used in research applications

Theory

Linear Combination of Unitaries (LCU)

LCU is a technique for implementing non-unitary operations using quantum circuits. The key idea is to decompose a non-unitary operator $A$ as:

$$A = \sum_i \alpha_i U_i$$

where $U_i$ are unitary operators and $\alpha_i$ are complex coefficients.

SELECT and PREPARE Operators

To implement LCU, we need two operators:

  1. PREPARE Operator: Prepares a superposition state based on coefficients $\alpha_i$
  2. SELECT Operator: Applies the appropriate unitary $U_i$ based on the control state

The overall operation is:

$$\langle 0| \text{PREPARE}^{\dagger} \cdot \text{SELECT} \cdot \text{PREPARE} |0\rangle = \hat{U} |\psi\rangle$$

where $\hat{U}$ represents the quantum circuit implementing the non-unitary operation.

Pauli Decomposition

For this tutorial, the $2 \times 2$ non-unitary matrix is decomposed into Pauli terms:

  • Pauli Matrices:

    • $I = \begin{pmatrix} 1 & 0 \ 0 & 1 \end{pmatrix}$ (Identity)
    • $X = \begin{pmatrix} 0 & 1 \ 1 & 0 \end{pmatrix}$ (Bit flip)
    • $Y = \begin{pmatrix} 0 & -i \ i & 0 \end{pmatrix}$
    • $Z = \begin{pmatrix} 1 & 0 \ 0 & -1 \end{pmatrix}$ (Phase flip)
  • Decomposition: The non-unitary matrix is expressed as a linear combination of Pauli matrices.

Example: $2 \times 2$ Non-Unitary Matrix

For this tutorial, the non-unitary operator is:

$$\hat{U} = 0.5\hat{I} + 0.5\hat{Z}$$

This means:

  • Apply $\hat{I}$ (identity) when controller qubit is in state $|0\rangle$
  • Apply $\hat{Z}$ (phase flip) when controller qubit is in state $|1\rangle$

Implementation

High-Level Approach

The implementation consists of:

  1. Pauli Decomposition: Determine coefficients $\alpha_i$ through Pauli decomposition
  2. PREPARE Operator: Prepare superposition state based on coefficients
  3. SELECT Operator: Apply appropriate unitary based on control state
  4. State Preparation: Prepare the state $|\psi\rangle$ to be operated on
  5. Application: Apply LCU controllers to the state

Key Components

LCU Controllers

The function lcu_controllers(controller: QNum, psi: QNum) implements:

  • Controller Qubit: Determines which unitary to apply
  • Target State: The state $|\psi\rangle$ to be operated on
  • Conditional Application: Applies $\hat{I}$ or $\hat{Z}$ based on controller state

Implementation Steps

  1. Decompose Matrix: Perform Pauli decomposition to find coefficients
  2. Design PREPARE: Create operator to prepare control state
  3. Design SELECT: Create operator to apply unitaries conditionally
  4. Combine: Implement full LCU circuit
  5. Test: Apply to test states and verify results

Software Architecture

The notebook uses Classiq to:

  • Define quantum functions for LCU components
  • Synthesize optimized quantum circuits
  • Execute and analyze non-unitary operations

Software Requirements

The following Python packages are required:

  • numpy - Numerical operations
  • classiq - Quantum circuit design and synthesis

Installation:

All packages are included in the top-level requirements.txt. If you have set up the base environment as described in the main README, no additional installation is needed.

# If not already installed
pip install numpy classiq

Running the Tutorial

Step 1: Navigate to the Tutorial Directory

cd nonunitary_quantum_computing

Step 2: Open the Notebook

jupyter notebook lcu_2x2.ipynb

Or in JupyterLab:

jupyter lab lcu_2x2.ipynb

Step 3: Execute the Notebook

  1. Review the theory - Understand LCU decomposition
  2. Examine the decomposition - See how the matrix is decomposed into Pauli terms
  3. Study the implementation - Understand PREPARE and SELECT operators
  4. Run the LCU circuit - Execute and observe results
  5. Analyze measurements - Verify non-unitary operation application

Step 4: Generate Quantum Model (Optional)

If you want to save the quantum circuit as a model file:

  • Execute the cell containing write_qmod(quantum_model, "lcu-2x2")
  • This will generate lcu-2x2.qmod in the current directory

Expected Results

Outputs

  1. Quantum Model File (Optional):

    • lcu-2x2.qmod - Quantum model file (generated if the write_qmod cell is executed)
  2. Measurement Results:

    • Results showing application of non-unitary operator
    • Verification that the operation behaves as expected
    • Comparison with expected outcomes
  3. Understanding:

    • How non-unitary operations can be implemented quantumly
    • LCU decomposition technique
    • SELECT and PREPARE operator design

Key Takeaways

  • Non-unitary operations can be implemented using LCU
  • Pauli decomposition is a key technique for LCU
  • SELECT and PREPARE operators enable LCU implementation
  • LCU is important for many advanced quantum algorithms

Troubleshooting

Issue: Classiq Import Errors

Solution:

  • Ensure Classiq is installed: pip install classiq
  • Check Classiq version compatibility
  • Some features may require API authentication (see Classiq documentation)

Issue: Understanding LCU Decomposition

Solution:

  • Review linear algebra concepts (matrix decomposition)
  • Study Pauli matrices and their properties
  • Review the theory section carefully
  • See Theory and Background for mathematical foundations

Issue: Circuit Complexity

Solution:

  • Start with understanding the $2 \times 2$ example
  • Review each component (PREPARE, SELECT) separately
  • Check Classiq documentation for optimization options
  • Break down the implementation step by step

Issue: Results Interpretation

Solution:

  • Understand what non-unitary operations should do
  • Compare results with expected behavior
  • Review measurement statistics
  • Verify that the operation is applied correctly

Further Reading

Related Papers

  • LCU Decomposition: Original papers on Linear Combination of Unitaries
  • Non-Unitary Quantum Computing: Research on non-unitary operations
  • See Academic Resources for related papers

Related Tutorials

  • Tutorial 00 - Quantum Fourier Transform: Foundational quantum algorithms
  • Tutorial 02 - Quantum Walk: Quantum circuit design experience
  • Tutorial 05 - Coupled Harmonic Oscillators: Advanced quantum algorithms

External Resources

Advanced Topics

  • General LCU for larger matrices
  • Optimizing LCU implementations
  • Applications in quantum simulation
  • Error analysis for LCU

Contributors

  • Mohammadreza Khellat - Primary author and maintainer

For questions or contributions, see the Contributing Guide.


Summary

This tutorial demonstrates non-unitary quantum computing using LCU. You've learned:

✅ How to decompose non-unitary operators using LCU
✅ How to implement SELECT and PREPARE operators
✅ How to apply non-unitary operations using quantum circuits
✅ Pauli decomposition techniques for quantum implementation

Next Steps:

  • Explore LCU for larger matrices
  • Try Tutorial 05 for advanced quantum simulation
  • Review Theory and Background for deeper understanding
  • Research applications of LCU in quantum algorithms

Return to: Tutorial Catalog | Home

Clone this wiki locally