Question: How to extract a kernel matrix from a quantum state on a real quantum computer through discarding a register?
I am trying to understand the paper "Quantum Support Vector Machine for Big Data Classification" by Rebentrost et al. (2014). Specifically, this portion about extracting a kernel matrix for a given dataset:
The mentioned appendix is here:
Problem Setup:
Let’s say I have two training samples with 2 features:
- (x_0 = [0.8, 0.6])
- (x_1 = [0.28, -0.96])
These can be represented as quantum states:
$ |x_0\rangle = 0.8|0\rangle + 0.6|1\rangle, \quad |x_1\rangle = 0.28|0\rangle - 0.96|1\rangle $
I then prepare a superposition state as shown in the image, such that:
$ |\chi\rangle = |0\rangle|x_0\rangle + |1\rangle|x_1\rangle $
My Understanding:
If we discard the training register, this is equivalent to taking the partial trace over the second register of the density matrix $ |\chi\rangle \langle \chi| $. Doing this results in:
$ \langle x_0 | x_0 \rangle |0\rangle \langle 0| + \langle x_0 | x_1 \rangle |1\rangle \langle 0| + \langle x_1 | x_0 \rangle |0\rangle \langle 1| + \langle x_1 | x_1 \rangle |1\rangle \langle 1| $
Here, we can see that the coefficients are the elements of the desired kernel matrix.
Question:
What I don't understand is how to implement this on a real quantum computer. Specifically:
- How do I prepare the density matrix and take the partial trace using a real quantum computer (e.g., IBM’s quantum computers)?
- How can I extract the kernel matrix from a 2-qubit circuit prepared in the state $ |\chi\rangle $, using a quantum programming framework like Qiskit?