You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current circuit plotting in qutip-qip uses LaTeX, which is powerful but requires dependencies that are hard to control as a Python package. The installation for users who do not already have a working tex environment is very clumsy.
As shown in this notebook. Sympy might have a way to do this already (see here). It is much easier to make SymPy an optional package than asking the user to install a full Tex distribution, which could be several Gigabytes large.
As Sympy uses a class for each gate, we could leave a method in our gate class that initialize this SymPy class, e.g:
And even better, SymPy seems to support QASM 2.0 gates! If that is true, we can first export our circuit to QASM then use SymPy to plot them. I haven't explored this yet.
The text was updated successfully, but these errors were encountered:
If this enhancement is still relevant (which I think it is, installing a Tex distribution is heavy and painful) can I take this issue up?
The approach you mentioned in the example seems easy to implement, push all the returned sympy gate objects into a list and write a function to plot them using sympy.physics.quantum.circuitplot, passing the said list as a parameter.
Hi @TheCharmingSociopath, yes, this enhancement is still relevant. You are very welcome to take this issue up.
The only thing is that right now our own gate classes have not yet been merged (#96). So you probably need to define get_sympy_object under the class Gate and add lots of if branches to check the name of the gate. Nonetheless, it should work, I think.
You probably also need to add another function that draws the sympy circuit. It would be nice to first have this in a separate file and then try to merge it with other workflows later when it is complete.
The current circuit plotting in
qutip-qip
uses LaTeX, which is powerful but requires dependencies that are hard to control as a Python package. The installation for users who do not already have a working tex environment is very clumsy.As shown in this notebook. Sympy might have a way to do this already (see here). It is much easier to make SymPy an optional package than asking the user to install a full Tex distribution, which could be several Gigabytes large.
As Sympy uses a class for each gate, we could leave a method in our gate class that initialize this SymPy class, e.g:
And even better, SymPy seems to support QASM 2.0 gates! If that is true, we can first export our circuit to QASM then use SymPy to plot them. I haven't explored this yet.
The text was updated successfully, but these errors were encountered: