Hello, I have some questions about Quantum GAN. For point (3) Non-Linear Transform, I did not know why we could add the ancilla qubit to create the non-linear transformation. Another question is, don’t we lose the critical information of the image while tracing out the ancilla qubit?
Strictly speaking, it’s not necessary to include a non-linear transformation here. The author of this demo likely included it as it’s one way to make the model “more interesting”.
Adding an ancilla qubit alone is not enough to make the quantum process nonlinear. It’s the fact that we make a measurement that causes this (as the author says, the resulting state depends on the variable z in both the numerator and the denominator, making a nonlinear dependence on z. One could also add a measurement on the non-ancilla qubits, but this would consume them. Instead, we can use an ancilla to give us something to measure without changing the number of working qubits our model uses.
As for your second question, one of the goals of introducing a nonlinearity into a (Q)ML model is in fact to lose information. For example, we may need to go down from a very high-dimensional object (an image), to a single number (prediction for the class of that image). This requires throwing away some information! The task of machine learning is to train your model (in this case, a quantum circuit) to only throw away information that is not useful, while keeping critical information that is useful for making the final prediction.
Hello, I’m new to quantum theory and I’m interested in the derivation of the expression for the post-measurement reduced density matrix for the nonlinear transform:
Actually they seem to have skipped a few steps there
The partial trace is linear, so the denominator can be brought out of the trace. The denominator is just a number, after all! The partial trace also has the cyclic property, that is
Thanks for explaining the expression; it makes more sense to me now! Just one follow-up question about the cyclic property of the partial trace: for which operators does the cyclicity hold? I tried experimenting with two random density matrices \rho_1 and \rho_2, but it seems the partial trace is different.
import numpy as np
import pennylane as qml
def random_statevector(dim):
rng = np.random.default_rng()
vec = rng.standard_normal(dim).astype(complex)
vec += 1j * rng.standard_normal(dim)
vec /= np.linalg.norm(vec)
return vec
# Set the number of qubits
n = 2
# Prepare some state vectors
state1 = random_statevector(2**n)
state2 = random_statevector(2**n)
# Create density matrices
rho1 = np.outer(state1, state1.conj())
rho2 = np.outer(state2, state2.conj())
# Trace out the first qubit of the cyclic permutations
reduced1 = qml.math.partial_trace(rho1 @ rho2, indices=[0])
reduced2 = qml.math.partial_trace(rho2 @ rho1, indices=[0])
print(np.allclose(reduced1, reduced2)) # False
Yes, I wasn’t precise enough. For this cyclic property to work, the operator must act on one of the subsystems. That is, it has to be of the form A\otimes\mathbb{I} or \mathbb{I}\otimes B. Unfortunately, the best source I have on this is this Stack Exchange post. It does seem to have the correct argument though.