-
Notifications
You must be signed in to change notification settings - Fork 874
Example notebook descriptions #1457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| { | ||
| "friendly_name": "Quantum Counting", | ||
| "description": "Quantum Counting Using the Iterative Quantum Amplitude Estimation Algorithm", | ||
| "vertical_tags": [], | ||
| "description": "This notebook applies amplitude estimation and quantum counting to determine how many inputs satisfy a given Boolean condition. It begins with a small arithmetic example, where two 2‑bit unsigned integers a and b must satisfy (a + b) ≤ 2, yielding six valid assignments out of 16 possibilities. The notebook first shows how standard Quantum Phase Estimation (QPE) can be built on top of Grover’s operator to recover the underlying success amplitude and thus infer the number of solutions.\\n\\nThe core of the notebook is an implementation of the Iterative Quantum Amplitude Estimation (IQAE) algorithm, which avoids QPE and instead adapts the number of Grover iterations across rounds based on previous measurement statistics. A dedicated state‑preparation routine prepares a uniform superposition over inputs and flags “good” states in an indicator qubit, which IQAE then queries and updates until the desired accuracy and confidence level are reached. Finally, the notebook compares the QPE‑based and IQAE‑based estimates of the number of satisfying assignments and prints the IQAE iteration history (Grover powers and outcome counts).\\n\\nKey points:\\n- Defines a concrete counting problem and encodes it as an oracle over small integer registers.\\n- Builds a Grover operator and uses QPE as a baseline amplitude‑estimation method.\\n- Implements Iterative Quantum Amplitude Estimation via Classiq’s `IQAE` class with user‑set error and confidence.\\n- Extracts the estimated number of solutions and reports the statistical accuracy and iteration data.", | ||
| "level": [], | ||
| "problem_domain_tags": [], | ||
| "qmod_type": [], | ||
| "level": [] | ||
| "vertical_tags": [] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| { | ||
| "friendly_name": "Hamiltonian Simulation With Block Encoding", | ||
| "description": "Hamiltonian Simulation with Quantum Signal Processing and Qubitization", | ||
| "vertical_tags": [], | ||
| "description": "This notebook demonstrates state‑of‑the‑art Hamiltonian simulation techniques based on block encoding and polynomial transformations of operators. Starting from a concrete two‑qubit Hamiltonian expressed as a sum of Pauli strings, it uses an LCU construction to build a block‑encoding unitary and verifies that this encoding reproduces H|ψ⟩ up to a known scaling factor. A statevector simulator and custom post‑processing are set up to project onto the successful block subspace and compare quantum results with exact classical evolution.\\n\\nThe notebook then implements three Hamiltonian simulation strategies—GQSP, QSVT, and Chebyshev‑LCU (Qubitization)—all derived from the Jacobi–Anger expansion and Chebyshev polynomial approximations of e^{-iHt}. For each method it computes classical signal‑processing angles or coefficients, builds the corresponding quantum circuits using Classiq’s open‑library functions, runs the simulations, and compares the final state to the exact time evolution. Finally, it summarizes resource trade‑offs (qubit count, CX depth, classical preprocessing time, and effective scaling factors) and provides technical notes on block encoding, LCU, walk operators, and generalizations.\\n\\nKey points:\\n- Constructs and verifies a block‑encoding of a Pauli‑sum Hamiltonian via LCU.\\n- Explains Jacobi–Anger–based polynomial approximations for time evolution and how they set circuit degree.\\n- Implements Hamiltonian simulation using GQSP, QSVT, and a Chebyshev‑LCU walk‑operator approach.\\n- Uses statevector post‑selection and overlap metrics to validate each method against classical evolution.\\n- Compares methods in terms of qubit overhead, CX counts, scaling factors, and preprocessing cost.", | ||
|
||
| "level": [], | ||
| "problem_domain_tags": [], | ||
| "qmod_type": [], | ||
| "level": [] | ||
| "vertical_tags": [] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| { | ||
| "friendly_name": "Shor's Algorithm Modular Exponentiation", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it is time to change this to Shor's Algorithm |
||
| "description": "Full Integer factorization using Shor's Algorithm and Modular Exponentiation", | ||
| "vertical_tags": ["cyber"], | ||
| "description": "This notebook presents a full implementation of Shor’s quantum algorithm for integer factorization, from problem statement through quantum period finding and classical post‑processing. It begins with an overview of how factoring reduces to order‑finding for modular exponentiation, and how that order can be extracted via Quantum Phase Estimation (QPE). The notebook then defines classical helpers for picking random coprimes, computing continued fractions, and verifying factors from the recovered period.\\n\\nOn the quantum side, the notebook constructs a flexible QPE routine that repeatedly applies modular multiplication by a constant, implemented with Classiq’s modular arithmetic functions. It demonstrates the algorithm on a concrete example (factoring 21) by building the period‑finding circuit, executing it, and using continued fractions to infer the order. Finally, it validates that the recovered factors multiply back to the original integer and includes technical notes that derive the relevant eigenstates, eigenphases, and QPE precision requirements.\\n\\nKey points:\\n- Explains the factoring problem, Shor’s reduction to period finding, and the role of QPE.\\n- Implements a parameterized `period_finding` quantum function using modular multiplication in place.\\n- Uses continued fractions to process the measured QPE phases into an integer order r.\\n- Derives the nontrivial factors of N from r and checks correctness on an explicit example.\\n- Includes detailed theoretical appendices on eigenstates of modular multiplication and phase‑register sizing.", | ||
|
||
| "level": ["advanced"], | ||
| "problem_domain_tags": [], | ||
| "qmod_type": ["algorithms"], | ||
| "level": ["advanced"] | ||
| "vertical_tags": ["cyber"] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "friendly_name": "HHL", | ||
| "description": "Solving linear system of equations using HHL algorithm", | ||
| "description": "This notebook implements the Harrow–Hassidim–Lloyd (HHL) algorithm for solving linear systems A x = b and compares quantum results with a classical solution. It begins with a small 4×4 Hermitian matrix A and a normalized right‑hand side vector b, checks that A’s eigenvalues lie in (0, 1), and prints their high‑precision binary expansions. The matrix is converted into a Pauli‑sum Hamiltonian, setting up the unitary U = e^{i 2π A} required by QPE.\\n\\nA modular HHL quantum subroutine is then built: it prepares |b⟩ in a “memory” register, runs flexible QPE to encode eigenphases into an “estimator” register, applies a controlled rotation on an indicator qubit implementing the λ⁻¹ map via an amplitude table, and finally uncomputes the phases with QPE†. Post‑processing routines post‑select on successful indicator and estimator outcomes, reconstruct the solution amplitudes, remove the global phase, and compare the resulting |x⟩ to the classical A⁻¹b via fidelity and component‑wise plots. The notebook provides two implementations of the time‑evolution unitary: an exact one using full matrix exponentiation and an approximate one based on first‑order Suzuki–Trotter product formulas with tunable repetition depth.\\n\\nKey points:\\n- Reviews the HHL algorithm steps, including QPE, eigenvalue inversion, and post‑selection.\\n- Encodes a small Hermitian system into a Pauli‑operator Hamiltonian and constructs U = e^{i 2π A}.\\n- Implements a reusable `hhl` Qmod function parameterized by a powered‑unitary evolution routine.\\n- Demonstrates exact vs. Suzuki–Trotter‑based Hamiltonian simulation within the same HHL framework.\\n- Includes utilities to post‑select, remove global phase, compute fidelity, and visualize classical vs quantum solutions.", | ||
|
||
| "level": ["advanced", "demos"], | ||
| "problem_domain_tags": ["machine learning", "linear equation"], | ||
| "qmod_type": ["algorithms"], | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "friendly_name": "Quantum Phase Estimation", | ||
| "description": "Quantum Phase Estimation for Evaluating Matrix Eigenvalues", | ||
| "description": "This notebook presents a generic use of Quantum Phase Estimation (QPE) to approximate eigenvalues of a small Hermitian matrix. It starts from a 4×4 real symmetric example matrix, constructs a Pauli‑operator representation of the corresponding Hamiltonian, and explains why rescaling is required so that eigenvalues fall into the phase range [−1/2, 1/2). Utility functions estimate an overall normalization factor, normalize the Hamiltonian, and compute how many phase‑register qubits are needed to achieve a user‑specified energy resolution.\\n\\nAn initial state is prepared either as a random vector or an eigenvector, and QPE is built using Classiq’s `qpe_flexible` routine with two alternative powered‑unitary implementations: an exact exponentiation via `unitary(elements=exp(i 2π M_new))` and an approximate Suzuki–Trotter product formula with power‑dependent repetition counts. The notebook executes both quantum programs, converts sampled phases back to energy estimates using the stored normalization, and compares them to the true eigenvalues of the original matrix. It also visualizes the resulting energy histograms with overlays showing classical eigenvalues and resolution bands.\\n\\nKey points:\\n- Describes normalization and precision budgeting for QPE on generic Hermitian matrices.\\n- Implements QPE with an exact unitary and with a first‑order Suzuki–Trotter approximation.\\n- Shows how to translate measured phases into approximate eigenvalues and account for resolution error.\\n- Plots quantum energy distributions against classical eigenvalues for side‑by‑side comparison.", | ||
|
||
| "level": ["demos"], | ||
| "problem_domain_tags": ["chemistry"], | ||
| "qmod_type": ["algorithms"], | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| { | ||
| "friendly_name": "Qpe For Molecule With Qubitization", | ||
| "description": "Qubitization based Quantum Phase Estimation (QPE) for Solving Molecular Energies", | ||
| "vertical_tags": [], | ||
| "description": "This notebook implements a quantum phase estimation (QPE) scheme tailored to qubitized Hamiltonians in quantum chemistry. Starting from a simple H₂ molecular geometry and a chosen basis, it uses OpenFermion and PySCF to build a fermionic Hamiltonian, maps it to a qubit operator, and computes the exact ground‑state energy for reference. The qubit Hamiltonian is then normalized and block‑encoded using an LCU‑style construction based on a Gray‑code multiplexed Pauli implementation, yielding a unitary whose top‑left block encodes H/s.\\n\\nWith the block encoding in hand, the notebook defines a Szegedy‑type walk operator W and shows how its eigenphases relate nonlinearly to the Hamiltonian’s eigenvalues. It first demonstrates a “naive” QPE directly on W, post‑processes the measured walk eigenphases into energy estimates, and compares them to the classical FCI reference. It then builds an optimized QPE circuit specialized to the walk operator that significantly reduces circuit depth while preserving energy accuracy, and analyzes the expected phase‑to‑energy error given the phase‑register size.\\n\\nKey points:\\n- Constructs a small molecular Hamiltonian and an exact classical ground‑state energy benchmark.\\n- Builds a block‑encoding using Gray‑code multiplexed rotations and amplitude‑encoded coefficients.\\n- Defines and uses a walk operator whose spectrum encodes the Hamiltonian eigenvalues via arccos.\\n- Implements both naive and walk‑optimized QPE circuits and compares their depth and accuracy.\\n- Provides post‑processing utilities for mapping measured phases back to physical energy values.", | ||
|
||
| "level": [], | ||
| "problem_domain_tags": ["chemistry"], | ||
| "qmod_type": [], | ||
| "level": [] | ||
| "vertical_tags": [] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "friendly_name": "Swap Test", | ||
| "description": "Swap Test", | ||
| "description": "This notebook demonstrates the swap test, a quantum routine for estimating the overlap between two quantum states. It explains the mathematical relation between the probability of measuring the test qubit in state |0⟩ and the squared inner product |⟨ψ₁|ψ₂⟩|². The notebook prepares two random 3‑qubit states on a simulator, implements the swap test using Classiq’s high‑level Qmod functions, and executes the resulting circuit many times to obtain accurate statistics.\\n\\nAfter running the circuit, the notebook compares the overlap extracted from the swap‑test measurement outcomes with the exact classical overlap computed from the state vectors. It then validates the result within a user‑defined relative tolerance, illustrating how experimental noise and finite sampling affect the estimate.\\n\\nKey points:\\n- Introduces the theory of the swap test and its circuit structure (Hadamard, controlled‑SWAPs, Hadamard).\\n- Shows how to prepare arbitrary amplitudes on registers using `prepare_amplitudes`.\\n- Uses Classiq’s modeling, synthesis, and execution workflow to build and run the swap‑test circuit.\\n- Includes a numerical comparison between quantum‑estimated and classically computed overlaps.", | ||
|
||
| "level": ["basic"], | ||
| "problem_domain_tags": [], | ||
| "qmod_type": ["function"], | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| { | ||
| "friendly_name": "Grover", | ||
| "description": "Grover's Search Algorithm", | ||
| "vertical_tags": [], | ||
| "description": "This notebook develops Grover’s unstructured search algorithm and applies it to both 3‑SAT and graph Max‑Cut style problems. It reviews the structure of Grover’s iteration as a composition of an oracle U_f and a diffusion operator U_s that jointly amplify amplitudes on marked states, and explains how the required number of repetitions scales like O(√(N/k)). A reusable classical post‑processing routine repeatedly executes a Grover circuit with increasing iteration counts until a marked state appears with probability above a chosen threshold.\\n\\nThe first set of examples encodes small and larger 3‑SAT formulas as Boolean predicates, converts them into phase oracles using Classiq’s `phase_oracle`, and constructs Grover search circuits over a few Boolean variables. After running the algorithm, the notebook prints truth tables, measurement histograms, and highlights the satisfying assignments whose amplitudes have been amplified. A second example recasts a Max‑Cut‑style threshold problem as an oracle that marks cuts with at least a target number of crossing edges, then applies the same Grover‑and‑post‑selection pattern to find high‑quality cuts.\\n\\nKey points:\\n- Provides an intuitive and circuit‑level description of Grover’s operator and repetition schedule.\\n- Implements generic utilities to run Grover with increasing powers until success criteria are met.\\n- Encodes 3‑SAT instances and graph‑cut predicates as phase oracles using high‑level Qmod constructs.\\n- Shows how Grover can be repurposed from exact search to threshold‑based optimization searches.", | ||
|
||
| "level": [], | ||
| "problem_domain_tags": [], | ||
| "qmod_type": [], | ||
| "level": [] | ||
| "vertical_tags": [] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| { | ||
| "friendly_name": "QAOA", | ||
| "description": "Quantum Approximate Optimization Algorithm", | ||
| "vertical_tags": [], | ||
| "description": "This notebook implements the Quantum Approximate Optimization Algorithm for two representative combinatorial problems: Max‑Cut on a five‑node graph and a small knapsack instance. It starts with an accessible explanation of the QAOA ansatz as alternating “cost” and “mixer” layers applied to an initial uniform superposition, and relates the finite‑depth circuit to discretized adiabatic evolution. For Max‑Cut, the notebook defines a normalized, negative cost function over bitstrings, constructs the corresponding phase‑separation circuit, and applies layerwise RX mixers.\\n\\nUsing Classiq’s modeling and execution tools, the notebook builds a parameterized QAOA circuit, sets up a classical COBYLA optimization loop, and iteratively refines the 2p parameters (gammas and betas) by repeatedly estimating the quantum cost. It then samples the optimized circuit, prints the most probable cuts along with their costs, and visualizes the graph with node colors indicating the best partitions. In the knapsack section, the notebook augments QAOA with a digital constraint check: an objective phase is applied only when a predicate qubit indicates the weight constraint is satisfied, avoiding hand‑tuned penalty terms.\\n\\nKey points:\\n- Explains the QAOA framework and its connection to adiabatic optimization.\\n- Implements modular cost and mixer layers and composes them into a multi‑layer ansatz.\\n- Uses a classical optimizer to tune QAOA parameters based on sampled quantum costs.\\n- Demonstrates Max‑Cut and knapsack instances, printing and plotting high‑quality solutions.\\n- Includes technical notes on adiabatic theorem conditions and the Trotterization viewpoint of QAOA.", | ||
| "level": [], | ||
| "problem_domain_tags": [], | ||
| "qmod_type": [], | ||
| "level": [] | ||
| "vertical_tags": [] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This notebook applies amplitude estimation and quantum counting -->
This notebook applies quantum counting
...how standard Quantum Phase Estimation (QPE) can be built on top of Grover’s operator to recover... -->
how standard Amplitude Estimation, a Quantum Phase Estimation (QPE) applied on Grover’s operator, can be built to recover...
Defines a concrete counting problem and encodes it as an oracle over small integer registers -->
Employs Classiq's arithmetic to easily define an oracle for marking the good states.