Skip to content

symbolic.Var lacking documentation #290

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

Open
ColeComfort opened this issue Apr 10, 2025 · 1 comment
Open

symbolic.Var lacking documentation #290

ColeComfort opened this issue Apr 10, 2025 · 1 comment

Comments

@ColeComfort
Copy link

Hello.

I am rewriting Symbolic.py to make the typeclass Poly generic, so that for example, one can represent Polynomials over finite fields, integers, etc. in a uniform way. I am also adding support for fractions of polynomials as well.

I am almost done with modifying this file to this end, but I am running into problems with the Var class. I am currently using Var as a wrapper for str, but there are other attributes of var which are not documented. For example, I have no idea what the following two attributes are meant to represent:

_is_bool: bool
_types_dict: Optional[Union[bool, Dict[str, bool]]]

Could someone please add some documentation, as I would really appreciate it.

--Cole

@jvdwetering
Copy link
Collaborator

Several of the newer features of PyZX are lacking documentation, which is indeed a shame.
_is_bool is a flag for saying whether this parameter should be treated as a bool (either 0 or 1, or in the context of ZX, 0 or pi), or as a free parameter (as in variational circuits). The reasoning for this is that there is a big class of parametrised rewrites that should work with 0/pi phases, but not arbitrary parameters.
I'm not 100% sure, but _types_dict should be a dictionary specifying for each named parameter on a graph whether its _is_bool flag is set to true.

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