johanvos / quantumjava

Samples related to "Quantum Computing for Java Developers"
BSD 3-Clause "New" or "Revised" License
134 stars 34 forks source link

MacOS application has rendering issues with vertical ProbabilityGate and horizontal QubitFlows #27

Open mik3hall opened 1 year ago

mik3hall commented 1 year ago

An application doesn't render right with vertical probability gates. It seems to only render the first QuantamFlow. An example is ch07 randombitdebug from an application.

I made a change to ProbabilityGate where if you click on a cell you get slightly more information. There were issues with this because the ProbabilityGate runs vertically across all horizontal QubitFlows. Only cells in the first QubitFlow received the mouse clicks. To work around this I added the mouse listener to QubitBoard and it determines if a ProbabilityGate has been clicked on and which cell. It then shows a window with a little more information on that cell.

I was going to just mention this as a comment to Windows 10 application but noticed that it appears related to a MacOS application rendering circuits with ProbibilityGate(s) correctly. They also only seem to show the first QubitFlow. Mouse clicks on the invisible ProbabilityGate parts still work. Since this doesn't seem to only apply to my changes I thought it might merit a separate issue.

A MacOS version of the application is again available at http://mikehall.pairserver.com/qc.dmg. I have added signing. Although I think I need to renew my Apple dev account. The new window includes the superposition probability visualization I also mentioned in the above prior issue. I suggested that might be good for the wire ending visualization but will hold off on trying to change that to see if you have any thoughts.

Next I thought I'd add a File menu as previously mentioned. Maybe look at XML to circuit to XML with strange. Possibly look at the application rendering with a ProbabilityGate since I had just been looking at something sort of related. I noticed you have some drag and drop in place so maybe you had some thoughts along those lines?

mik3hall commented 1 year ago

I added a File menu with a open item that should run simple one source file strange programs. I looked at the rendering thing some. There appears to be some difference I haven't figured out yet when run as an app than when run cli. cli renders correctly, app doesn't. Maybe a difference in search order, maybe in modular handling? I added a Util class to display the contents of the QubitBoard to see if that was different for some reason. It didn't appear to be and running command line had issues with that so it is currently not used. There is a launch.sh that shows how I command line invoke and might use for now. I think with that working I will ignore the jpackage app not rendering correctly for now. The File menu import/export items currently don't do anything. That is intended to be the xml support for now. Are there any api's you would be interested in this interoperating with? I think qiskit looks like it could be a good addition. I saw you have had some connection with Deflt. I monitored a couple of their EdX courses. Mostly saving links to the corresponding YouTube video's. Since you came up with strange for java maybe this isn't of that much interest to you.

mik3hall commented 1 year ago

Rendering issues aren't the jpackage/jlink embedded jdk. Command line invocation had issues finding classes using the system jdk in compiling. Set to use app bundled jdk and it worked correctly - found classes and rendered correctly.