XanaduAI / strawberryfields

Strawberry Fields is a full-stack Python library for designing, simulating, and optimizing continuous variable (CV) quantum optical circuits.
https://strawberryfields.ai
Apache License 2.0
754 stars 191 forks source link

Compilation using directed acyclic graphs #331

Closed nquesada closed 4 years ago

nquesada commented 4 years ago

Currently many programs involving just Gaussian operations and Measurements are compiled by turning them into directed acyclic graphs. A possibly better way to approach this problem is to use the Gaussian compiler to get the Symplectic matrix representing the circuit and then doing Bloch-Messiah+Interferometer decompositions. The computations required for this latter approach are polynomial in the number of modes and fairly straightforward while also taking advantage of the Gaussianity of the circuit. On the other hand checking if two DAGs are the same seems more involved.

co9olguy commented 4 years ago

How should we determine whether this other approach is faster, more efficient, etc?

josh146 commented 4 years ago

We should do some benchmarking and profiling 🙂

For what it's worth, I think it would be a good idea to have both circuit validations present in Strawberry Fields (use the Gaussian compiler for Gaussian circuits, and the NX approach for non-Gaussian circuits).

I expect the GI algorithm we are using in NX to be quite fast for the relatively small graphs representing existing chips, so would be curious regarding benchmarking. This would obviously change as the number of modes increases.

nquesada commented 4 years ago

Closed via https://github.com/XanaduAI/strawberryfields/pull/392

For an 8 mode circuit X8 takes ~ 174 ms while Xunitary takes ~ 4.27 ms.

co9olguy commented 4 years ago

:rocket: