Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support arrays in explicit pytket circuit signatures #859

Open
tatiana-s opened this issue Mar 13, 2025 · 1 comment
Open

Support arrays in explicit pytket circuit signatures #859

tatiana-s opened this issue Mar 13, 2025 · 1 comment

Comments

@tatiana-s
Copy link
Contributor

Follow up from load_pytket_with_arrays implementation, some feedback on what would be useful needed

github-merge-queue bot pushed a commit that referenced this issue Mar 18, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Closes #671 

Allows you to load pytket circuits as function definitions that use
arrays as both inputs and outputs:
```
circ = Circuit(2)
circ.measure_all()

guppy.load_pytket("guppy_circ", circ)

@guppy
def foo(q: array[qubit, 2]) -> array[qubit, 2]:
    return guppy_circ(q)

```

Note that:
- If using more registers than just the default register, this relies on
the user sticking to lexicographic order for registers based on their
names, with the default qubit and bit registers being `q` and `c`
respectively. This is done because the tket2 conversion to HUGR relies
on this order for qubit / bit ordering. It may be worth treating default
registers differently in the future but that depends on user preferences
- I think the original idea was to use arrays when the user specifies
them as such in the explicit function signature - I've decided to go
with the implicit version as this a) seems to be used more often by
users and b) would have been more complicated to implement with more
questions with regards to how much flexibility you want to give / would
be expected in the signature definition, but this should be a follow up
issue (#859)

BREAKING CHANGE: `load_pytket` takes arrays by default (pass
`use_arrays=False` for qubit arguments)
@CalMacCQ
Copy link
Contributor

Is this fully resolved now? Arrays are now supported by guppy.load_pytket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants