guppylang icon indicating copy to clipboard operation
guppylang copied to clipboard

@unitary decorator for guppy

Open ss2165 opened this issue 1 year ago • 1 comments

Ability to decorate functions as unitaries (perhaps Array<N, Qubit> -> Array<N, Qubit>) This is either used as a hint or is enforced by checking the definition. It may be possible to use the HUGR extension system for that check.

This is useful for possible analyses and transforms, e.g. dagger function, gradient injections, or just unit testing by calculating the unitary.

ss2165 avatar Aug 02 '24 16:08 ss2165

I would like some equivalent of .get_unitary().

In qlibs we are able to select the block of the unitary for the relevant pre/post selection qubits. This is a very powerful feature and is how all of the testing of block encoding is done.

https://github.com/CQCL-DEV/qtmlib/blob/main/qtmlib/circuits/core/_registerbox.py calls https://github.com/CQCL-DEV/qtmlib/blob/main/qtmlib/measurement/utils.py

It could be cleaner. But it recursively slices the unitary in half, depending on the qubit post selection.

NathanCQC avatar Sep 25 '24 13:09 NathanCQC