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: JSON support for AngleAdd and float inputs #166

Merged
merged 2 commits into from
Oct 4, 2023
Merged

Conversation

lmondada
Copy link
Contributor

@lmondada lmondada commented Oct 3, 2023

Closes #135

@ss2165 I won't ask for a review from you given that you are probably busy, but feel free to have a look if you are interested and have a moment.

This isn't proper constant folding but does sort-of constant folding on the fly when serialising to TK1 json. It seemed the fastest solution to get what I needed.

@lmondada lmondada requested a review from cqc-alec October 4, 2023 08:49
assert_eq!(ser.commands[0].op.params, Some(vec![param_str.into()]));

// Note: this is not a proper roundtrip as the symbols f0 and f1 are not
// converted back to circuit inputs. This would require parsing symbolic
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does the result of deserializing look like? Normally I'd expect serializing and then deserializing should produce at least an equivalent hugr.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the input

graph TD
IN --> Rz
IN --> AngleAdd
IN --> AngleAdd --> Rz --> OUT
Loading

you'd get after a serialisation roundtrip

graph TD
IN --> Rz
C(const f0 + f1) --> Rz
Rz --> OUT
Loading

I don't see how to avoid this, short of fully parsing symbolics in rust and resolving each symbol to an input. Do you have any ideas?

Copy link
Collaborator

Choose a reason for hiding this comment

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

No, seems unavoidable, but the solution is quite fragile. However let's go with it for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added issue #168 to keep track of this.

@lmondada lmondada merged commit 6286164 into main Oct 4, 2023
7 checks passed
@lmondada lmondada deleted the feat/json-angleadd branch October 4, 2023 11:37
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.

AngleAdd support in serialisation
2 participants