Quantum Singular Value Transformation

An Interactive: adjust the matrix $A$ and the polynomial $P$ and observe each computational stage

This document realises, in a single live page, the complete four-stage pipeline of Quantum Singular Value Transformation: Singular Value Decomposition, Block Encoding, Quantum Signal Processing (including explicit phase-angle determination), and the QSVT theorem. Each stage is recomputed in real time as the user edits the input matrix or selects a different polynomial.

Specification of the Input Matrix $A$

The framework supports any real matrix of dimensions $m\times n$ with $m,n\in\{2,3\}$, covering both square and rectangular cases.

Dimensions:
$A =$

Quantitative Summary of $A$

Stage I · Singular Value Decomposition: $A = U\,\Sigma\,V^{\dagger}$

The Singular Value Decomposition expresses an arbitrary $m\times n$ matrix as the composition of an input rotation, a diagonal stretch, and an output rotation. QSVT preserves the unitary factors $U$ and $V^{\dagger}$ identically and acts only on the singular values arranged along $\Sigma$; this isolation of the non-unitary content is what makes the entire construction implementable on a quantum register.

Computational procedure (click to expand)
  1. Form the Gram matrix $M = A^{\dagger} A$, which is symmetric positive semidefinite of order $n$.
  2. Diagonalise $M$ via the cyclic Jacobi eigenvalue algorithm to obtain orthonormal eigenvectors and non-negative eigenvalues $\lambda_i$.
  3. Define the singular values $\sigma_i = \sqrt{\lambda_i}$ and assemble $V$ from the eigenvectors of $M$.
  4. Compute the columns of $U$ via $u_i = A v_i / \sigma_i$ for $\sigma_i > 0$, and complete the orthonormal basis by Gram–Schmidt where necessary.
  5. If $m < n$ the procedure is applied to $A^{\dagger}$ and the resulting factors are transposed accordingly.

Stage II · Block Encoding of $A$ within a Unitary Dilation

A non-unitary operator cannot be implemented directly on a quantum register. We therefore embed $A$, after sub-normalisation by a constant $\alpha \ge \lVert A\rVert_2$, as the upper-left block of a larger unitary operator $U_A$ acting on the system together with one or more ancillary qubits. The original matrix is recovered by projecting the ancilla onto $|0\rangle$: $$\bigl(\langle 0^{a}|\otimes I\bigr)\,U_A\,\bigl(|0^{a}\rangle\otimes I\bigr) \;=\; A/\alpha.$$ For an $m\times n$ block $B = A/\alpha$ with $\lVert B\rVert\le 1$, the canonical cosine–sine dilation is $$U_A=\begin{bmatrix} B & \sqrt{I_m - B B^{\dagger}}\\[2pt] \sqrt{I_n - B^{\dagger} B} & -B^{\dagger}\end{bmatrix}\in\mathbb{R}^{(m+n)\times(m+n)}.$$ This construction is exactly unitary whenever $\lVert B\rVert\le 1$.

Verification: the upper-left $m\times n$ block of $U_A$ literally equals $B = A/\alpha$, and direct computation confirms $U_A^{\dagger} U_A = I_{m+n}$.

Stage III · Quantum Signal Processing and the Phase Angles $\vec\phi$

Quantum Signal Processing realises a polynomial transformation of a scalar variable $x\in[-1,1]$ via an alternating sequence of two single-qubit rotations: $$U_{\vec\phi}(x)=S(\phi_0)\,W(x)\,S(\phi_1)\,W(x)\cdots W(x)\,S(\phi_d),$$ where

Signal rotation $W(x)$: encodes the parameter

W(x) = [[ x , i√(1−x²) ], [ i√(1−x²) , x ]]

$W(x) = e^{i\arccos(x)\,\sigma_x}$. The signal $x$ is the only non-tunable input; it will later play the role of a singular value $\sigma_i/\alpha$.

Phase shift $S(\phi)$: the tunable knob

S(φ) = [[ e^{iφ}, 0 ], [ 0 , e^{−iφ} ]]

$S(\phi) = e^{i\phi\sigma_z}$. The angles $\phi_0,\dots,\phi_d$ are the programmable degrees of freedom that determine which polynomial is realised.

Selection of the polynomial $P(x)$

Polynomial $P(x)$:

Selected polynomial

The dashed lines indicate the admissible bound $|P(x)|\le 1$. Green markers indicate the locations of $\sigma_i/\alpha$ for the present $A$.

Theorem (QSP)

For any real polynomial $P$ of degree $d$, parity matching $d$, and $|P(x)|\le 1$ on $[-1,1]$, there exist real phases $\vec\phi=(\phi_0,\dots,\phi_d)$ such that the upper-left entry of the alternating product equals $P(x)$.

Determining $\vec\phi$ from $P$ is a classical optimisation problem. In production codes one uses the Wilson decomposition, the algorithm of Haah (2019), or the symmetric solver of Dong–Meng–Whaley–Lin (2021). Below we use a simple gradient-descent (Adam) optimiser to find $\vec\phi$ directly from $P$, sufficient for pedagogical illustration.

Phase-Angle Computation

The optimiser minimises the empirical $L^{2}$ loss $$\mathcal{L}(\vec\phi)\;=\;\frac{1}{N}\sum_{k=1}^{N}\Bigl|\;\bigl[U_{\vec\phi}(x_k)\bigr]_{1,1}\;-\;P(x_k)\Bigr|^{2}$$ on a uniform grid $\{x_k\}\subset[-1,1]$. The optimisation is performed entirely in the browser; click the button below to (re)run it.

Verification of the QSP Identity

Having obtained $\vec\phi$, we now construct the matrix $U_{\vec\phi}(x)$ explicitly for a sample value of $x$ and check that its $(1,1)$ entry equals $P(x)$ across the entire interval.

Sample point $x$: x = 0.50

Explicit product $U_{\vec\phi}(x)$ at the chosen $x$

The boxed entry is the $(1,1)$ position; the QSP theorem asserts that this entry equals $P(x)$.

Comparison: $[U_{\vec\phi}(x)]_{1,1}$ vs. $P(x)$ across the interval

Stage IV · Quantum Singular Value Transformation

Replacing the scalar oracle $W(x)$ with the block encoding $U_A$, and replacing each $Z$-rotation with a projector-controlled phase that acts only when the ancilla register is in $|0^a\rangle$, yields the QSVT circuit. The fundamental identity satisfied by this circuit is $$\bigl(\langle 0^{a}|\otimes I\bigr)\,U_{\rm QSVT}\,\bigl(|0^{a}\rangle\otimes I\bigr) \;=\; U\,P\!\bigl(\Sigma/\alpha\bigr)\,V^{\dagger}.$$ Operationally the pipeline reduces to applying $P$ entry by entry to the diagonal of the sub-normalised singular value matrix and re-applying $U$ and $V^{\dagger}$; the same phase angles $\vec\phi$ obtained in Stage III drive the matrix-valued circuit.

Numerical Verification

Three structural invariants are checked on every refresh: orthogonality of $U$ and $V$, non-negativity of $\sigma_i$, and the unitarity of the dilation $U_A$.