-
Notifications
You must be signed in to change notification settings - Fork 0
Tutorial 03 Non Unitary Computing
Linear Combination of Unitaries (LCU) implementation for non-unitary operations.
This tutorial demonstrates how to represent and manipulate non-unitary operations using Linear Combination of Unitaries (LCU) decomposition. You'll learn to implement a
Location: nonunitary_quantum_computing/
Notebook: lcu_2x2.ipynb
Framework: Classiq
Difficulty: 🟡 Intermediate
Estimated Time: 2-3 hours
By completing this tutorial, you will be able to:
- Understand LCU decomposition for non-unitary operators
- Implement SELECT and PREPARE operators for LCU
- Decompose matrices into Pauli terms for quantum implementation
- Apply non-unitary operations using quantum circuits
- Recognize applications of LCU in quantum algorithms
-
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
- 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
- Recommended: Tutorial 00 (QFT) or Tutorial 02 (Quantum Walk)
- Builds on: Quantum circuit design skills
- Advanced technique: Used in research applications
LCU is a technique for implementing non-unitary operations using quantum circuits. The key idea is to decompose a non-unitary operator
where
To implement LCU, we need two operators:
-
PREPARE Operator: Prepares a superposition state based on coefficients
$\alpha_i$ -
SELECT Operator: Applies the appropriate unitary
$U_i$ based on the control state
The overall operation is:
where
For this tutorial, the
-
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.
For this tutorial, the non-unitary operator is:
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$
The implementation consists of:
-
Pauli Decomposition: Determine coefficients
$\alpha_i$ through Pauli decomposition - PREPARE Operator: Prepare superposition state based on coefficients
- SELECT Operator: Apply appropriate unitary based on control state
-
State Preparation: Prepare the state
$|\psi\rangle$ to be operated on - Application: Apply LCU controllers to the state
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
- Decompose Matrix: Perform Pauli decomposition to find coefficients
- Design PREPARE: Create operator to prepare control state
- Design SELECT: Create operator to apply unitaries conditionally
- Combine: Implement full LCU circuit
- Test: Apply to test states and verify results
The notebook uses Classiq to:
- Define quantum functions for LCU components
- Synthesize optimized quantum circuits
- Execute and analyze non-unitary operations
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 classiqcd nonunitary_quantum_computingjupyter notebook lcu_2x2.ipynbOr in JupyterLab:
jupyter lab lcu_2x2.ipynb- Review the theory - Understand LCU decomposition
- Examine the decomposition - See how the matrix is decomposed into Pauli terms
- Study the implementation - Understand PREPARE and SELECT operators
- Run the LCU circuit - Execute and observe results
- Analyze measurements - Verify non-unitary operation application
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.qmodin the current directory
-
Quantum Model File (Optional):
-
lcu-2x2.qmod- Quantum model file (generated if thewrite_qmodcell is executed)
-
-
Measurement Results:
- Results showing application of non-unitary operator
- Verification that the operation behaves as expected
- Comparison with expected outcomes
-
Understanding:
- How non-unitary operations can be implemented quantumly
- LCU decomposition technique
- SELECT and PREPARE operator design
- 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
Solution:
- Ensure Classiq is installed:
pip install classiq - Check Classiq version compatibility
- Some features may require API authentication (see Classiq documentation)
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
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
Solution:
- Understand what non-unitary operations should do
- Compare results with expected behavior
- Review measurement statistics
- Verify that the operation is applied correctly
- LCU Decomposition: Original papers on Linear Combination of Unitaries
- Non-Unitary Quantum Computing: Research on non-unitary operations
- See Academic Resources for related papers
- Tutorial 00 - Quantum Fourier Transform: Foundational quantum algorithms
- Tutorial 02 - Quantum Walk: Quantum circuit design experience
- Tutorial 05 - Coupled Harmonic Oscillators: Advanced quantum algorithms
- Classiq Documentation - Framework reference
- LCU Wikipedia - General overview
- Quantum Algorithm Zoo - Algorithm references
- General LCU for larger matrices
- Optimizing LCU implementations
- Applications in quantum simulation
- Error analysis for LCU
- Mohammadreza Khellat - Primary author and maintainer
For questions or contributions, see the Contributing Guide.
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