Quantum Processor For GoPiGo3?

Oh boy - have to bring GoPi5Go-Dave into the Quantum Computing Craze

Watched 60 minutes segment on the Quantum computing craziness last night, and don’t want GoPi5Go-Dave to miss out being the first GoPiGo3 with a Quantum Computer (…simulator).

IBM publishes a quantum computing simulator in various forms, Dockered or “venv’d”. Each present difficulties when faced with giving the quantum computer (simulator) access to the GoPiGo3 hardware.

As a start I’m trying the “build it yourself” Docker/32-bit-Buster/ibmosquito-qiskit/Jupyter approach without GoPiGo3 API which has been building for almost 45 minutes and still going strong claiming 51% done.

Have to see if it even runs on Dave’s 64-bit PiOS Bookworm, before trying the really complicated process to add the GoPiGo3 API and permissions to access to the GoPiGo3 hardware.

OOPS - build died after 44 minutes. Have to try the venv approach.

The example programs are only 7 lines of imports and 3 lines of code.

Of course everyone’s comments “I don’t know what to do with a quantum computer now that I have one” is a bit foreboding.

1 Like

That’s the first problem, right there.

And you talk to me about unicorns?

At least you’re not building an entirely new install just to test it - like I do! :man_facepalming:

And that’s my problem with ROS.  As much as I want to try it, I really don’t know what I’ll do with it once I have it.

I guess everyone has their own ways of making themselves crazy!

1 Like

Maybe not - managed to bring up a jupyter server but typing into a localhost jupyter notebook has an unusable delay.

1 Like

Found a great repo (4 years old) - “quantum-simulator-benchmark” that builds a docker container with four different quantum processor simulators (qisket-toaster, qisket-aer, quil QVM, cirq) and runs a benchmark against each one for 1 to 27 qubits.

It was written for Intel hosts, but I was able to change the build for 64-bit Raspberry Pi and all was looking good till it announced “not enough disk space”. I may need to add a 128GB USB disk and super-cool Dave down to near absolute zero to achieve “coherence”.

I deleted all the docker temporary build files to recover an additional 5GB on Dave’s card - we’ll see if I can just squeek this thing in for a test.

Looks like I should strip it down to just the cirq simulator and use less than 10 qubits. I really hate using Google software - come back a day later and nothing will work.

1 Like

There I go thinking Dave can find a use for non-deterministic quantum math when Dave’s programmer can’t handle uncertainty.

1 Like

SUCCESS - Now what?

I managed to find a very easy to install, very sophisticated Quantum Simulator, and run Dave’s “First Qisket Circuits” without having to sign up for IBM, or Google access to a cloud Quantum processor.

I haven’t the slightest idea what Dave computed, but it runs without errors and spits out true non-deterministic (quantum) results:

(qvmvenv) pi@GoPi5Go:~/GoPi5Go/systests/qvm/qvmvenv/examples $ ./first_qisket_circuit.py 

Simulating Two 2-qubit circuits
expectation values : psi1 = [ 1.53564065 -1.10584991], psi2 = 0.17500806267478156
time: 2.51 ms

Simulating 128 shots of a 2-qubit circuit
counts for Bell circuit : {'00': 66, '11': 62}
time: 1.03 ms

Simulating a 2-qubit circuit
counts for parameterized circuit : {'01': 399, '11': 394, '10': 94, '00': 137}
time: 1.49 ms


Quantum Simulator: Qiskit-Aer

“Bell State Measurement: Bell state measurement (BSM) is a quantum-mechanical measurement that determines which of the four Bell states two qubits are in. Bell states are quantum states of two qubits that are examples of quantum entanglement. When one qubit is measured, the other qubit is forced to take on a specific value as the entangled state collapses” - Yeah - that clears up a lot!

GoPi5Go-Dave has joined the Quantum Computing Revolution!

(but I will never be able to grok quantum computing: “we recommend familiarity with basic linear algebra, complex numbers, and elementary mathematical notions including sets and functions.”)

1 Like

It’s like buying an Abrams tank.  Now that you have it, what do you do with it?

Though I have to admit it’s a great experimental success - possibly way ahead of its time.

Isn’t that 9th grade Algebra?

I would have loved to have one of these things when I was taking Calculus - it would be great for functions surrounding a discontinuity and/or approaching (±)infinity.

Hmm. . .  It could be useful around “event horizons” too, where things go all pear-shaped in uniquely new and interesting ways.

1 Like

mathematical discipline that deals with vectors and matrices and, more generally, with vector spaces and linear transformations . Unlike other parts of mathematics that are frequently invigorated by new ideas and unsolved problems, linear algebra is very well understood”

Not by me, not my 9th grade. College course I struggled to get a B in, and don’t have a sense what a dot product vs a cross product vs an inversion vs a rotation or any of the Greek alphabet mean on the page,when combined with the other course I struggled with - statistics II Applied Statistics.

Put imaginary numbers in those matrices and my imagination cannot function with irrational numbers or thinking.

1 Like

Pushed it to Git, and “boast that I did it”…
And be honest when anyone asks “what can Dave do with it?” Diddly squat, but he does it real fast (near absolute zero).

And remind myself to type

P.s. At one time I wrote an entire sailing club membership maintenance system in APL. Remembering matrices and special characters reminds me how irrational that was.

1 Like

Quantum Virtual Machine and Quantum Computing for GoPiGo3 Robots

Getting Started

REF: Qiskit Aer 0.14.2

python3 -m venv qvmvenv --system-site-packages --prompt qvmvenv
cd qvmvenv
source bin/activate
pip install qiskit-aer
cd GoPi5Go/systests/qvm/qvmvenv/
source bin/activate
cd examples

(after running examples:  ```deactivate```)

first_qisket_circuit.py

(qvmvenv) pi@GoPi5Go:~/GoPi5Go/systests/qvm/qvmvenv/examples $ ./first_qisket_circuit.py 

Simulating Two 2-qubit circuits
expectation values : psi1 = [ 1.53564065 -1.10584991], psi2 = 0.17500806267478156
time: 2.51 ms

Simulating 128 shots of a 2-qubit circuit
counts for Bell circuit : {'00': 66, '11': 62}
time: 1.03 ms

Simulating a 2-qubit circuit
counts for parameterized circuit : {'01': 399, '11': 394, '10': 94, '00': 137}
time: 1.49 ms

3qubitGHZ.py

(qvmvenv) pi@GoPi5Go:~/GoPi5Go/systests/qvm/qvmvenv/examples $ ./3qubitGHZ.py 
Counts(ideal): {'111': 507, '000': 517}
Execution Time: 2.65 ms

show_qiskit_version.sh

(qvmvenv) pi@GoPi5Go:~/GoPi5Go/systests/qvm/qvmvenv/examples $ ./show_qiskit_version.sh 
Name: qiskit
Version: 1.1.1
Summary: An open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
Home-page: 
Author: 
Author-email: Qiskit Development Team <qiskit@us.ibm.com>
License: Apache 2.0
Location: /home/pi/GoPi5Go/systests/qvm/qvmvenv/lib/python3.11/site-packages
Requires: dill, numpy, python-dateutil, rustworkx, scipy, stevedore, symengine, sympy, typing-extensions
Required-by: qiskit-aer

1 Like

Me: [jaw drops]

You wrote " an entire sailing club membership maintenance system" in APL?!!  :astonished: :exploding_head:  And you’re complaining about having trouble with Dave chasing after a few measly bosons?

APL and its gibberish language constructs makes Chinese look like a Dick and Jane first grade primer!  Case in point:  The strange symbols across the bottom of a check drawn on a US bank are actually APL programming constructs saying “read this” and “print that”, etc.

I have to go out and buy more bandages for the scrapes on my chin, dragging my jaw off the floor!

P.S.
How about a brief lexicon of the strange terms you’ve been throwing around fast and loose. :wink:

1 Like

First we have to grok the big picture:

Before trying to pet Schrödinger’s cat.

Found the latest version of Qiskit Quantum Processing SDK which includes an improved simulator (55% faster at whatever you want to do with your Quantum Processor…)

Install Latest Qiskit Version

REF: GitHub - Qiskit/qiskit: Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.

python3 -m venv qiskit1 --prompt qiskit1
cd qiskit1
source bin/activate
pip install qiskit
  • pip show qiskit
(qiskit1) pi@GoPi5Go:~/GoPi5Go/systests/qvm/qiskit1 $ pip show qiskit
Name: qiskit
Version: 1.1.1
Summary: An open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
Home-page: 
Author: 
Author-email: Qiskit Development Team <qiskit@us.ibm.com>
License: Apache 2.0
Location: /home/pi/GoPi5Go/systests/qvm/qiskit1/lib/python3.11/site-packages
Requires: dill, numpy, python-dateutil, rustworkx, scipy, stevedore, symengine, sympy, typing-extensions
  • 3qubitGHZ.py
(qiskit1) pi@GoPi5Go:~/GoPi5Go/systests/qvm/qiskit1/examples $ ./3qubitGHZ.py 
 > Quasi probability distribution: [{0: np.float64(0.528), 7: np.float64(0.472)}]
Execution Time: 1.70 ms

 > Expectation values: [4.]
Execution Time: 0.69 ms

v1.1.1 appears to be roughly 55% faster than v0.14 (They claim 1000% faster)

(qiskit1) pi@GoPi5Go:~/GoPi5Go/systests/qvm/qiskit1/examples $ ./qft.py 
     ┌───┐ ┌───────┐  ░ ┌───┐                                      ░ ┌─┐      
q_0: ┤ H ├─┤ P(-π) ├──░─┤ H ├─■─────────────■──────────────────────░─┤M├──────
     ├───┤┌┴───────┴┐ ░ └───┘ │P(π/2) ┌───┐ │                      ░ └╥┘┌─┐   
q_1: ┤ H ├┤ P(-π/2) ├─░───────■───────┤ H ├─┼────────■─────────────░──╫─┤M├───
     ├───┤├─────────┤ ░               └───┘ │P(π/4)  │P(π/2) ┌───┐ ░  ║ └╥┘┌─┐
q_2: ┤ H ├┤ P(-π/4) ├─░─────────────────────■────────■───────┤ H ├─░──╫──╫─┤M├
     └───┘└─────────┘ ░                                      └───┘ ░  ║  ║ └╥┘
q_3: ─────────────────░────────────────────────────────────────────░──╫──╫──╫─
                      ░                                            ░  ║  ║  ║ 
q_4: ─────────────────░────────────────────────────────────────────░──╫──╫──╫─
                      ░                                            ░  ║  ║  ║ 
c: 5/═════════════════════════════════════════════════════════════════╩══╩══╩═
                                                                      0  1  2 
     ┌───┐ ┌───────┐  ░ ┌───┐                                                                      ░ ┌─┐         
q_0: ┤ H ├─┤ P(-π) ├──░─┤ H ├─■─────────────■─────────────────■────────────────────────────────────░─┤M├─────────
     ├───┤┌┴───────┴┐ ░ └───┘ │P(π/2) ┌───┐ │                 │                                    ░ └╥┘┌─┐      
q_1: ┤ H ├┤ P(-π/2) ├─░───────■───────┤ H ├─┼────────■────────┼─────────────■──────────────────────░──╫─┤M├──────
     ├───┤├─────────┤ ░               └───┘ │P(π/4)  │P(π/2)  │       ┌───┐ │                      ░  ║ └╥┘┌─┐   
q_2: ┤ H ├┤ P(-π/4) ├─░─────────────────────■────────■────────┼───────┤ H ├─┼────────■─────────────░──╫──╫─┤M├───
     ├───┤├─────────┤ ░                                       │P(π/8) └───┘ │P(π/4)  │P(π/2) ┌───┐ ░  ║  ║ └╥┘┌─┐
q_3: ┤ H ├┤ P(-π/8) ├─░───────────────────────────────────────■─────────────■────────■───────┤ H ├─░──╫──╫──╫─┤M├
     └───┘└─────────┘ ░                                                                      └───┘ ░  ║  ║  ║ └╥┘
q_4: ─────────────────░────────────────────────────────────────────────────────────────────────────░──╫──╫──╫──╫─
                      ░                                                                            ░  ║  ║  ║  ║ 
c: 5/═════════════════════════════════════════════════════════════════════════════════════════════════╩══╩══╩══╩═
                                                                                                      0  1  2  3 
     ┌───┐ ┌───────┐   ░ ┌───┐                                                                                                                ░ ┌─┐            
q_0: ┤ H ├─┤ P(-π) ├───░─┤ H ├─■─────────────■─────────────────■──────────────────────■───────────────────────────────────────────────────────░─┤M├────────────
     ├───┤┌┴───────┴┐  ░ └───┘ │P(π/2) ┌───┐ │                 │                      │                                                       ░ └╥┘┌─┐         
q_1: ┤ H ├┤ P(-π/2) ├──░───────■───────┤ H ├─┼────────■────────┼─────────────■────────┼──────────────────■────────────────────────────────────░──╫─┤M├─────────
     ├───┤├─────────┤  ░               └───┘ │P(π/4)  │P(π/2)  │       ┌───┐ │        │                  │                                    ░  ║ └╥┘┌─┐      
q_2: ┤ H ├┤ P(-π/4) ├──░─────────────────────■────────■────────┼───────┤ H ├─┼────────┼─────────■────────┼─────────────■──────────────────────░──╫──╫─┤M├──────
     ├───┤├─────────┤  ░                                       │P(π/8) └───┘ │P(π/4)  │         │P(π/2)  │       ┌───┐ │                      ░  ║  ║ └╥┘┌─┐   
q_3: ┤ H ├┤ P(-π/8) ├──░───────────────────────────────────────■─────────────■────────┼─────────■────────┼───────┤ H ├─┼────────■─────────────░──╫──╫──╫─┤M├───
     ├───┤├─────────┴┐ ░                                                              │P(π/16)           │P(π/8) └───┘ │P(π/4)  │P(π/2) ┌───┐ ░  ║  ║  ║ └╥┘┌─┐
q_4: ┤ H ├┤ P(-π/16) ├─░──────────────────────────────────────────────────────────────■──────────────────■─────────────■────────■───────┤ H ├─░──╫──╫──╫──╫─┤M├
     └───┘└──────────┘ ░                                                                                                                └───┘ ░  ║  ║  ║  ║ └╥┘
c: 5/════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╩══╩══╩══╩══╩═
                                                                                                                                                 0  1  2  3  4 
Basic simulator
{'00001': 1024}
{'00001': 1024}
{'00001': 1024}
1 Like