Rough prototype for a composite operation in PyQ to be used for circuits and hamiltonians.
Currently it inherits from ModuleList but I don't know if this is ok in terms of general torch functionality, it just seemed to make sense that a a composite operation is just a container of smaller operations.
big_op = CompOp([X(0), X(1)]) # Composite operation equivalent to X on 2 qubits
big_op(product_state("00")) # You get "11"
The AddOp is pretty similar but the forward method sums the application of each block instead of applying it in sequence. It also allows a dict of modules in the case we want to parameterize a coefficient multiplying each term.
The Hamiltonian uses both to construct a sum of composite operations so you can build Pauli Hamiltonians. Currently all it does on top of AddOp is to comprehend a nested structure:
The goal would be to maybe have the QuantumCircuit also be just a thin wrapper on top of CompOp, since it should also just be a sequence of operations.
In the current state the tests pass locally, but not on github.
Rough prototype for a composite operation in PyQ to be used for circuits and hamiltonians.
ModuleList
but I don't know if this is ok in terms of general torch functionality, it just seemed to make sense that a a composite operation is just a container of smaller operations.AddOp
is pretty similar but the forward method sums the application of each block instead of applying it in sequence. It also allows a dict of modules in the case we want to parameterize a coefficient multiplying each term.Hamiltonian
uses both to construct a sum of composite operations so you can build Pauli Hamiltonians. Currently all it does on top ofAddOp
is to comprehend a nested structure:QuantumCircuit
also be just a thin wrapper on top ofCompOp
, since it should also just be a sequence of operations.In the current state the tests pass locally, but not on github.