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

Modeling & validation CLI #2

Merged
merged 7 commits into from
Oct 13, 2023
Merged

Modeling & validation CLI #2

merged 7 commits into from
Oct 13, 2023

Conversation

qartik
Copy link
Member

@qartik qartik commented Oct 12, 2023

No description provided.

@qartik qartik changed the title Modeling Modeling & validation CLI Oct 13, 2023
@qartik qartik requested a review from qciaran October 13, 2023 17:04
pyproject.toml Outdated Show resolved Hide resolved
Copy link

@peter-campora peter-campora left a comment

Choose a reason for hiding this comment

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

I would say it's usually best to have Ciaran review before merging. Since, it doesn't look like there are changes to the spec and you're just adding the model, then this looks good to go to me.

@qartik qartik added the enhancement New feature or request label Oct 13, 2023
@qciaran
Copy link
Collaborator

qciaran commented Oct 13, 2023

I think there might be some funniness with the cvar_ids and qvar_ids, which is probably due to what I was doing in PECOS. I was converting it to not exactly a PHIR model but what I was calling PyPMIR, which is almost the same but I was attempting to make some conversions to make simulations faster. I need to sit and squint at the model a bit longer to be sure.

phir/model.py Outdated Show resolved Hide resolved
phir/model.py Outdated Show resolved Hide resolved
"""Quantum operation."""

qop: str
args: list[list[str | int] | list[list[str | int]]]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
args: list[list[str | int] | list[list[str | int]]]
args: list[list[str, int] | list[list[str, int]]]

Copy link
Member Author

Choose a reason for hiding this comment

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

@qciaran that won't work as lists are unconstrained in size. Ideally the internal lists should be tuples in the PHIR spec to have the correct format for arguments. I wanted to bring it up as a potential change in the spec.

So the correct form should be:

args: list[ tuple[str, int] | list[tuple[str, int]] ]

Copy link
Collaborator

@qciaran qciaran Oct 13, 2023

Choose a reason for hiding this comment

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

JSON seems to only have lists. Or at least it converts tuples to lists. If it is okay for the Python model to use tuples and there is no worries about validating JSON, then sounds good. (edit: lists-> tuples)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Otherwise, what you had before might be correct and it is just something that has to be dealt with because of JSON.

@qciaran
Copy link
Collaborator

qciaran commented Oct 13, 2023

@qartik Alright, I think I might of caught all the left overs from "PyPMIR."

@qartik qartik merged commit cf575ef into main Oct 13, 2023
3 checks passed
@qartik qartik deleted the modeling branch October 13, 2023 18:21
@qartik qartik restored the modeling branch October 18, 2023 20:25
@qartik qartik deleted the modeling branch October 18, 2023 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants