Closed jarrodmcc closed 7 years ago
@damiansteiger and @thomashaener guys, it would be really helpful if you could notify us if responding is going to take this long. Or perhaps you are not notified when Jarrod marks you as reviewers? We are trying to determine whether this pull request uses ProjectQ in the intended way.
I currently don't have time this week to look through the full code, so I have limited this review to the ProjectQ specific stuff.
The only comment is to not store Qubit objects but either only their ids or WeakQubitRef objects.
A general comment:
If you discuss offline, please add a summary online so people can follow on what is going on :) E.g. #63
Yeah that's a fair point.
A general question: Curious why you implement the graph instead of using some existing libraries, like NetworkX or igraph? Is it because you need/want lightweight? @jarrodmcc @babbush @damiansteiger
Would it make any sense that we'd want to have the grid class by @Strilanc be a special case of your graph class? Because in principle one might want to make Hubbard models on some crazy hexagonal lattice or something. A difference I see though is that Craig's grid class has a notion of length scale whereas the graphs you introduce here do not.
@Spaceenter I didn't use an external library so as not to increase the dependencies for this fairly simple use of a graph that is somewhat infrequent in the code. If we start using heavier weight graph stuff or this becomes a bottleneck somehow, I would opt for a library though.
This adds a basic graph class that can store qubits from ProjectQ to represent a physical lattice.
The unitary CC module is upgraded to facilitate using such a graph, and an example of doing so is in the unitary coupled cluster tests. Hopefully this can help craft more general algorithms using swap networks, but at the moment it adds a ProjectQ compiler rule that examines any non-adjacent two-qubit gates, and swaps them until they are adjacent using the shortest path found on the graph by breadth-first-search, performs the gate, then swaps the qubits back.
Some review requested from ProjectQ experts to advise on best practices for passing internal references to qubits and engines.