CQCL / pytket-qujax

Apache License 2.0
7 stars 2 forks source link

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

Open SamDuffield opened 1 year ago

SamDuffield commented 1 year ago

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?

SamDuffield commented 1 year ago

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

SamDuffield commented 1 year ago

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