CQCL/pytket-qujax

Automatically convert (non-parameterised?) gates not found in `qujax.gates`

SamDuffield opened this issue · 2 comments

The list of gates in qujax.gates is not exhaustive.

For unparameterised gates it should be easy enough to automatically extract the gate from tket using op.get_unitary()

Maybe we could even do something for parameterised gates? Using symbolic manipulations?

As of 0.6.0 #47, if symbol_map is given, non-parameterised gates not found in qujax.gates will be automatically converted.

The case when symbol_map is not given is tricky as it would have to assume unrecognised gates are non-parameterised. This is a dangerous assumption and therefore it is better to enforce the symbol_map implementation.

Conversion of parameterised gates not found in qujax.gates is even more tricky as a JAX function will need to be instantiated (rather than simply an array). Perhaps in this case, the better solutions are for the user to either

  • Add gates to a local qujax.gates (and possibly pull request)
  • Work directly with qujax
  • Convert the circuit to use parameterised gates that are found in qujax.gates (I wonder if pytket can do this automatically?)

As of 0.6.1 #51,pytket-qujax can also understand more sophisticated sympy expressions for parameterised gates as in the example notebook at https://github.com/CQCL/pytket/blob/main/examples/pytket-qujax_qaoa.ipynb