Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"2. An encoder block, which is a variational quantum ansatz with input port of size $n$ and output ports of size $m$ and $n-m$.\n",
"3. A swap test block between the $n-m$ trash output of the encoder and new $n-m$ zero registers.\n",
"\n",
"We train the network such that the test qubit of the swap test is at state |0⟩ with probability 1.\n",
"We train the network such that the test qubit of the swap test is at state $|0\\rangle$ with probability 1.\n",
"![Screenshot 2025-07-02 at 23.22.05.png](attachment:639bca1b-0f13-4994-983d-b4f995942861.png)\n",
"<center>\n",
"<figcaption align = \"middle\"> Quantum autoencoder layout: uncoded data of size 4 transforms into two outputs, a coded register of size 2 and trash outputs of size 2 at state $|00\\rangle$\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@
"source": [
"Monte Carlo integration refers to estimating expectation values of a function $f(x)$, where $x$ is a random variable drawn from some known distribution $p$:\n",
"\n",
"\\begin{equation}\n",
"$$\n",
"\\tag{1}\n",
"E_{p}(x) = \\int f(x)p(x) dx.\n",
"\\end{equation}\n",
"$$\n",
"Such evaluations appear in the context of option pricing or credit risk analysis.\n",
"\n",
"The basic idea of QMCI assumes that we have a quantum function $A$, which, for a given $f$ and $p$, loads the following state of $n+1$ qubits:\n",
"\\begin{align}\n",
"$$\n",
"\\begin{aligned}\n",
"\\tag{2}\n",
"A|0\\rangle_n|0\\rangle = \\sum^{2^n-1}_{i=0} \\sqrt{f_i} \\sqrt{p_i}|i\\rangle_n|1\\rangle + \\sum^{2^n-1}_{i=0} \\sqrt{1-f_i} \\sqrt{p_i}|i\\rangle_n|0\\rangle = \\sqrt{a}|\\psi_1\\rangle+\\sqrt{1-a}|\\psi_0\\rangle,\n",
"\\end{align}\n",
"\\end{aligned}\n",
"$$\n",
"where it is understood that the first $2^n$ states represent a discretized space of $x$, and that $0\\leq f(x)\\leq 1$.\n",
"Then, by applying the amplitude estimation (AE) algorithm for the \"good-state\" $|\\psi_1 \\rangle$, we can estimate its amplitude:\n",
"$$\n",
Expand Down Expand Up @@ -360,10 +362,10 @@
"Here we apply a basic AE algorithm that is based on QPE. The idea behind this algorithm is the following:\n",
"\n",
"The state $A|0\\rangle_n|0\\rangle$ is spanned by two eigenvectors of our Grover operator $Q$, with the two corresponding eigenvalues\n",
"\\begin{equation}\n",
"$$\n",
"\\tag{5}\n",
"\\lambda_{\\pm}=\\exp\\left(\\pm i2\\pi \\theta \\right), \\qquad \\sin^2 \\left(\\pi \\theta\\right)\\equiv a.\n",
"\\end{equation}\n",
"$$\n",
"Therefore, if we apply a QPE on $A|0\\rangle_n|0\\rangle$, we have these two eigenvalues encoded in the QPE register. However, both give the value of $a$, so there is no ambiguity."
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@
"id": "6",
"metadata": {},
"source": [
"\\begin{equation}\n",
"$$\n",
"H_{full} = \\sum_{j} h_j H_j,\n",
"\\end{equation}"
"$$"
]
},
{
Expand All @@ -107,17 +107,17 @@
"source": [
"Now that the problem is stated, a possible solution is the Suzuki-Trotter decomposition, also known as Trotterization. Simply put, this method involves 'breaking' the evolution operator into the evolution operators of its components. In the **first order**, it looks like this:\n",
"\n",
"\\begin{equation*}\n",
"$$\n",
"e^{-itH}=\\exp\\left\\{-it\\sum_{j=1}^N h_j H_j\\right\\} \\approx \\left(\\prod_{j}^N e^{-it h_j H_j/r}\\right)^r + \\mathcal{O}(t^2/r).\n",
"\\end{equation*}\n",
"$$\n",
"\n",
"Details about this decomposition are in [[1]](#ts_paper).\n",
"\n",
"This formula is important and has applications in several scenarios. Additionally, if you need an error that scales better than $t^2$, it is possible to achieve higher-order Suzuki-Trotter formulas. For example, the **second-order** Suzuki-Trotter would look like this:\n",
"\n",
"\\begin{equation*}\n",
"$$\n",
"e^{-itH}=\\exp\\left\\{-i\\left(\\sum_{j=1}^N \\frac{t_j}{2}\\,H_j + \\sum_{j=N}^1 \\frac{t_j}{2}\\,H_j\\right)\\right\\} \\approx \\left(\\prod_{j=1}^N e^{-it_j\\, H_j/(2r)}\\prod_{j=N}^1 e^{-it_j\\, H_j/(2r)}\\right)^r + \\mathcal{O}(t^3/r).\n",
"\\end{equation*}\n"
"$$\n"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"### 5. Adiabatic Evolution and Null Space\n",
"\n",
"Note that there is a degeneracy in the number of null states (unlike the regular adiabatic algorithm usage where we typically look at a single ground state):\n",
"$$\\text{Null}(H_1) = \\text{span}(|\\tilde{x}\\rangle, |\\bar{b}\\rangle)$.$\n",
"$$\\text{Null}(H_1) = \\text{span}(|\\tilde{x}\\rangle, |\\bar{b}\\rangle)$$.\n",
"\n",
"We also note that for any $s$, $|\\bar{b}\\rangle$ is always in the null space of $H(f(s))$; i.e.,\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@
"$$\n",
"where $\\mathrm{Poly(\\sigma)}$ is a polynomial with a well-defined parity. The QSVT routine allows to block-encode such singular value polynomial transforms, based on the Quantum Signal Processing (QSP) approach. For the case of matrix inversion, we have the identities,\n",
"$$\n",
"\\begin{align}\n",
"\\begin{aligned}\n",
"A^\\dagger &=V^\\dagger \\Sigma W,\\\\\n",
"A^{-1} &= V^\\dagger \\Sigma^{-1}W,\n",
"\\end{align}\n",
"\\end{aligned}\n",
"$$\n",
"from which we can deduce that: \n",
"\n",
Expand Down
2 changes: 0 additions & 2 deletions algorithms/quantum_linear_solvers/vqls/vqls_with_lcu.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,10 @@
"We treat a specific example based on a system of three qubits:\n",
"\n",
"$$\\begin{aligned}\n",
"\\begin{align}\n",
"A &= c_0 A_0 + c_1 A_1 + c_2 A_2 = \\ 0.55 \\mathbb{I} \\ + \\ 0.225 Z_1 \\ + \\ 0.225 Z_2\n",
"\\\\\n",
"\\\\\n",
"|b\\rangle &= U_b |0 \\rangle = H_0 H_1 H_2 |0\\rangle,\n",
"\\end{align}\n",
"\\end{aligned}$$\n",
"\n",
"where $Z_j, X_j, H_j$ represent the Pauli $Z$, Pauli $X$, and Hadamard\n",
Expand Down
12 changes: 6 additions & 6 deletions algorithms/quantum_walks/glued_trees/glued_trees.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@
"$$\n",
"\\mathbf{H} := -\\begin{pmatrix}\n",
"\\mathbf{0} & \\mathbf{B} \\\\\n",
"\\mathbf{B}^ & \\mathbf{0}\n",
"\\mathbf{B}^\\dagger & \\mathbf{0}\n",
"\\end{pmatrix}\n",
"$$\n",
"\n",
"where $\\mathbf{B}$ is any $N \\times M$ matrix such that $\\mathbf{B}\\mathbf{B}^=\\mathbf{A}$. However, to use this matrix $\\mathbf{H}$ for Hamiltonian simulation, it must have a size corresponding to a power of two, while $\\mathbf{A}$ is size $N \\times N$. We can deal with this by ensuring that $\\mathbf{B}$ is size $N \\times (N+4)$, so the resulting Hamiltonian $\\mathbf{H}$ is a square matrix with side length $2N+4 = 2(2^{n+1}-2)+4 = 2^{n+2}$. This means that a glued trees system with $n$ columns for one tree can be simulated using $n+2$ qubits.\n",
"where $\\mathbf{B}$ is any $N \\times M$ matrix such that $\\mathbf{B}\\mathbf{B}^\\dagger=\\mathbf{A}$. However, to use this matrix $\\mathbf{H}$ for Hamiltonian simulation, it must have a size corresponding to a power of two, while $\\mathbf{A}$ is size $N \\times N$. We can deal with this by ensuring that $\\mathbf{B}$ is size $N \\times (N+4)$, so the resulting Hamiltonian $\\mathbf{H}$ is a square matrix with side length $2N+4 = 2(2^{n+1}-2)+4 = 2^{n+2}$. This means that a glued trees system with $n$ columns for one tree can be simulated using $n+2$ qubits.\n",
"\n",
"In this notebook, we generate the matrix $\\mathbf{A}$ by building the glued trees structure using the NetworkX library such that the nodes are labeled in order from the entrance to exit node and using the `nx.adjacency_matrix` function to generate an adjacency matrix using that ordering. We decompose $\\mathbf{A}$ using [Cholesky decomposition](https://en.wikipedia.org/wiki/Cholesky_decomposition) to get a square matrix where its product with its conjugate transpose is equal to $\\mathbf{A}$. This matrix is the same size as $\\mathbf{A}$, however, so we must pad it with four columns of zeroes to get our matrix $\\mathbf{B}$ of size $N \t\\times (N+4)$ so $\\mathbf{H}$ has a size corresponding to a power of two. We can then create the block Hamiltonian with the proper size using $\\mathbf{B}$ and $\\mathbf{B}^\\dagger$, and decompose it into a sum of Pauli strings using the Classiq built-in `matrix_to_pauli_operator` function. The number of terms in the decomposition grows quickly with system size, and including all of them may produce circuits too deep for current quantum hardware. We therefore use two strategies depending on the system size.\n",
"\n",
Expand Down Expand Up @@ -205,21 +205,21 @@
"\\begin{aligned}\n",
"|\\psi(t)\\rangle &\\propto \\begin{pmatrix}\n",
"\\dot{\\vec{x}}(t) \\\\\n",
"i\\mathbf{B}^{} \\vec{x}(t) \n",
"i\\mathbf{B}^{\\dagger} \\vec{x}(t) \n",
"\\end{pmatrix} \\\\\n",
"\\begin{pmatrix}\n",
"\\dot{\\vec{x}}(t) \\\\\n",
"i\\mathbf{B}^{} \\vec{x}(t) \n",
"i\\mathbf{B}^{\\dagger} \\vec{x}(t) \n",
"\\end{pmatrix} &= e^{-it\\mathbf{H}} \\begin{pmatrix}\n",
"\\dot{\\vec{x}}(0) \\\\\n",
"i\\mathbf{B}^{} \\vec{x}(0) \n",
"i\\mathbf{B}^{\\dagger} \\vec{x}(0) \n",
"\\end{pmatrix}\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"where $\\vec{x}(0)=(0,0,\\dots,0)^T$ and $\\dot{\\vec{x}}(0)=(1,0,\\dots,0)^T$ using a linear ordering of nodes. \n",
"\n",
"Since the speed of the entrance node oscillator $|\\dot{x}_1(t)|$ is represented by the quantum state $|0\\rangle$ and should have probability 1 at $t=0$, there is no specific state preparation necessary for this system. It should also be noted that since our matrix $\\mathbf{B}^$ is padded with four rows of zeroes, the highest four quantum states do not correspond to the displacement or speed of any oscillator. This means that the quantum state representing the speed of the exit node oscillator $|\\dot{x}_N(t)|$, which is what we are most interested in, corresponds to $|N-1\\rangle=|2^{n+1}-3\\rangle$. We track this particular quantum state around $t \\approx 2n$, expecting a spike that represents the system of oscillators \"reaching\" the exit node from the initial push to the entrance node."
"Since the speed of the entrance node oscillator $|\\dot{x}_1(t)|$ is represented by the quantum state $|0\\rangle$ and should have probability 1 at $t=0$, there is no specific state preparation necessary for this system. It should also be noted that since our matrix $\\mathbf{B}^\\dagger$ is padded with four rows of zeroes, the highest four quantum states do not correspond to the displacement or speed of any oscillator. This means that the quantum state representing the speed of the exit node oscillator $|\\dot{x}_N(t)|$, which is what we are most interested in, corresponds to $|N-1\\rangle=|2^{n+1}-3\\rangle$. We track this particular quantum state around $t \\approx 2n$, expecting a spike that represents the system of oscillators \"reaching\" the exit node from the initial push to the entrance node."
]
},
{
Expand Down
Loading
Loading