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

feat!: Classical op params #56

Merged
merged 3 commits into from
Jul 9, 2024
Merged

feat!: Classical op params #56

merged 3 commits into from
Jul 9, 2024

Conversation

aborgna-q
Copy link
Collaborator

@aborgna-q aborgna-q commented Jul 9, 2024

Closes #53

drive-by: Add missing data field to Operation (schema).
drive-by: Remove created_qubits/discarded_qubits from the test files. Those fields are not in the schema.
drive-by: Mark more structs as non_exhaustive, so in the future a change like this does not have to be breaking.

BREAKING CHANGE: Added data and classical fields to Operation. Marked some structs/enums as non_exhaustive.

@aborgna-q aborgna-q requested a review from cqc-alec July 9, 2024 12:06
// Note: The order of the variants here is important.
// Serde will return the first matching variant when deserializing,
// so CopyBits and SetBits must come after other variants that
// define `values` and `n_i`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit puzzled by this, does the serialization not include the name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name is in Operation::type, but this field is not directly linked to it.
If type was a closed set we would be able to link classical and type more easily, but as it is now we just have a string field where some special values cause the classical enum to be of some type.
It's probably still possible to do something, but it'd be a big refactor of the Operation definition.

And to be pedantic, the schema does not link specific names with their required fields. It only lists a set of names for which classical must be defined. The Classical object itself is just a oneOf set of options.

https://github.com/CQCL/tket/blob/a47578ec5d79bb5caf23ef2edee3f587bc3c7d14/schemas/circuit_v1.json#L340-L359

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@aborgna-q aborgna-q added this pull request to the merge queue Jul 9, 2024
Merged via the queue into main with commit 31b3193 Jul 9, 2024
9 of 10 checks passed
@aborgna-q aborgna-q deleted the ab/classical-ops branch July 9, 2024 13:17
@hugrbot hugrbot mentioned this pull request Jul 9, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jul 9, 2024
## 🤖 New release
* `tket-json-rs`: 0.4.2 -> 0.5.0

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

## 0.5.0 (2024-07-09)

### Features

- Handle legacy tk1 optype
([#54](#54))
- [**breaking**] Classical op params
([#56](#56))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

---------

Co-authored-by: Agustín Borgna <[email protected]>
@hugrbot hugrbot mentioned this pull request Jul 16, 2024
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

Successfully merging this pull request may close these issues.

Add support for classical field in Operation
2 participants