Closed co9olguy closed 6 years ago
Having read the discussion in the appendix of openqml_formalism.tex and after thinking about it myself, I would summarize our conclusion as
If you only have gaussian gates and order-m polynomial observables (in x and p), in Heisenberg picture the gates act as linear transformations on (I, x, p) and thus the observables remain order-m. You can symbolically differentiate the transformation matrix and obtain an expression for the derivative which is another linear transformation on (I, x, p). Hence you should always be able to evaluate it in the lab by measuring a number of order-m observables and computing the proper linear combination of the results. This can be implemented in code.
If you also have non-gaussian gates, things get much more complicated. The gates no longer act as mere linear transformations on (I, x, p) and thus observables may be mapped to higher-order observables by each non-gaussian gate. It could probably be handled in the code, but I'm not sure how you could easily evaluate the resulting expectation values in the lab. This makes sense, since gaussian optics is intuitively "easy", non-gaussian is "hard".
Since one important design principle of OpenQML is that it's not just a simulator but you can also run the gradient algorithms on quantum hardware, I would suggest adding analytic CV gradients for gaussian circuits only in v0.1.
I fully support your summary. But I would implement analytic gradients for Gaussian circuits and operators up to quadratic in version 0.0 (is that the first one?). So we have something to also guide the attention to CV circuits.
We could check a circuit for non-Gaussianness and then choose the differentiation method...
I created a new branch and will start to write up the theory we have so far in the main manuscript.
Still a couple days for inspiration to strike, but it's looking like we'll stick with Gaussian-only circuits for CV automatic differentiation :)
We need to start planning for how to implement this.
The research deadline has now passed. We will implement automatic gradients for Gaussian CV circuits: gates from the Gaussian set and measurements of x, p, xx, xp+px, and pp.
@smite can you make this your next task to implement this? Loop in @mariaschuld @cgogolin or myself as necessary to clear up anything
I'd like to set a deadline on this. For better or for worse, we need to know soon whether it is viable to add the CV gradients to v0.1 of openqml. I'm going to set the date of Aug 12 for this.
If we do not have a very clear picture about how the code for this would look by then, we will go forward with only numerical differentiation for CV circuits.