Conversation
| "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.", |
There was a problem hiding this comment.
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.
| "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.", |
There was a problem hiding this comment.
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.
--->
Starting from a concrete two‑qubit Hamiltonian H expressed as a sum of Pauli strings, it uses an LCU construction to build a block‑encoding unitary and verifies the implementation by execution on a statevector simulator.
A statevector simulator a...results with exact classical evolution.
---> REMOVE
More keypoints
\n- Uses Classiq's open-library quantum functions gqsp and qsvt_lcu to build efficient algorithms, and Classiq's QSP application for obtaining all the classical pre-processing data such as qsp angles and polynomial coefficients.
| @@ -1,8 +1,8 @@ | |||
| { | |||
| "friendly_name": "Shor's Algorithm Modular Exponentiation", | |||
There was a problem hiding this comment.
Maybe it is time to change this to Shor's Algorithm
| "friendly_name": "Shor's Algorithm Modular Exponentiation", | ||
| "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.", |
There was a problem hiding this comment.
the notebook constructs a flexible QPE routine that repeatedly applies modular multiplication by a constant, implemented with Classiq’s modular arithmetic functions ---> the notebook utilizes a flexible QPE on modular multiplication, implemented with Classiq’s modular arithmetic functions.
phase-register ---> phase variable
| { | ||
| "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.", |
There was a problem hiding this comment.
using full matrix exponentiation ---> using classical matrix exponentiation and unitary gate decomposition
| { | ||
| "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.", |
There was a problem hiding this comment.
phase-register qubits ---> phase qubits
an exact exponentiation via `unitary(elements=exp(i 2π M_new)) ---> an exact classical matrix exponentiation followed by a unitary gate decomposition
| "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.", |
There was a problem hiding this comment.
maps it to a qubit operator --> maps it to a qubit operator H
block encodes H/s ---> block encodes H up to a scaling factor
phase-register size ---> phase variable size
| { | ||
| "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.", |
There was a problem hiding this comment.
illustrating how experimental noise and finite sampling affect the estimate --->
illustrating how finite sampling affect the estimate
| "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.", |
There was a problem hiding this comment.
circuit‑level --> high-level
PR Description
Add detailed description for some of the notebooks to support the library extension effort